chapel
chapel copied to clipboard
[Bug]: Calling an `extern proc` with an invalid number of arguments results in an internal error
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 about foo.c
instead of foo.chpl
.
Steps to Reproduce
Source Code:
foo.chpl
require "lib.h";
extern proc func();
func();
lib.h
void func(int x);
lib.c
void func(int x) { }
Compile command:
chpl foo.chpl lib.c
Configuration Information
- Output of
chpl --version
: 2.2 prerelease - Output of
$CHPL_HOME/util/printchplenv --anonymize
:
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: llvm
CHPL_TARGET_ARCH: arm64
CHPL_TARGET_CPU: native *
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none
CHPL_TASKS: qthreads
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: jemalloc
CHPL_ATOMICS: cstdlib
CHPL_GMP: system *
CHPL_HWLOC: system *
CHPL_RE2: bundled *
CHPL_LLVM: system
CHPL_AUX_FILESYS: none
- Back-end compiler and version, e.g.
gcc --version
orclang --version
: LLVM 18