Open jabraham17 opened 1 month ago
It would be difficult to improve the situation for the C back-end without having our compiler parse .h
files and validate that extern
declarations match the C declarations.
The LLVM back-end effectively does this, (which is presumably what results in the internal error in developer/verify mode?), so seems more directly addressable.
Summary of Problem
Description: Incorrectly specifying and calling an extern function results in an internal error with the LLVM backend. If
CHPL_DEVELOPER
is set or--verify
is used, the internal error is replaced by a LLVM verification error.Using the C backend gets a nicer error during codegen:
too few arguments to function call, single argument 'x' was not specified
. However since this error comes from the C backend compiler, there error is aboutfoo.c
instead offoo.chpl
.Steps to Reproduce
Source Code:
foo.chpl
lib.h
lib.c
Compile command:
chpl foo.chpl lib.c
Configuration Information
chpl --version
: 2.2 prerelease$CHPL_HOME/util/printchplenv --anonymize
:gcc --version
orclang --version
: LLVM 18