chapel
chapel copied to clipboard
Confusing error messages when trying to use "nothing" sync variable
I want to use a sync variable as a mechanism to coordinate execution between tasks but I don't particularly care about its value (beyond whether it's full or empty).
I could make the sync a bool
and just give it a dummy values but why should I have to waste the bit? Hey, there's a type called nothing
maybe I should use that instead? After taking a look at the doc I now see this is an egregious misuse (I suppose nothing
would really be used to signal that the s$
variable should be removed by the compiler) but I don't think it's a totally unreasonable confusion (or thing to want), let's try it out anyway to see how it blows up:
use Time;
config const N = 2;
var s$ : sync nothing;
begin {
writeln("Here I am in a separate task");
sleep(N);
s$.writeEF(none);
}
writeln("Here I am before the barrier");
s$.readFE();
writeln("Here I am after the barrier");
I get these confusing errors:
$ chpl foo.chpl
In file included from /var/folders/_n/2jvfdkwd1l786q9j729kq39r0000gr/T//chpl-stonea_local.deleteme-SkAufT/_main.c:2:
/var/folders/_n/2jvfdkwd1l786q9j729kq39r0000gr/T//chpl-stonea_local.deleteme-SkAufT/chpl__header.h:574:9: error: unknown type name 'nothing_chpl'; did you mean
'string_chpl'?
typedef nothing_chpl *c_ptr_nothing_chpl;
^~~~~~~~~~~~
string_chpl
/var/folders/_n/2jvfdkwd1l786q9j729kq39r0000gr/T//chpl-stonea_local.deleteme-SkAufT/chpl__header.h:544:3: note: 'string_chpl' declared here
} string_chpl;
^
In file included from /var/folders/_n/2jvfdkwd1l786q9j729kq39r0000gr/T//chpl-stonea_local.deleteme-SkAufT/_main.c:24:
/var/folders/_n/2jvfdkwd1l786q9j729kq39r0000gr/T//chpl-stonea_local.deleteme-SkAufT/ChapelSyncvar.c:78:36: error: too few arguments to function call, single argument 'x' was
not specified
call_tmp_chpl42 = c_pointer_return();
~~~~~~~~~~~~~~~~ ^
/Users/stonea_local/chapel/runtime/include/chpltypes.h:76:1: note: 'c_pointer_return' declared here
static inline void* c_pointer_return(void* x) { return x; }
^
In file included from /var/folders/_n/2jvfdkwd1l786q9j729kq39r0000gr/T//chpl-stonea_local.deleteme-SkAufT/_main.c:24:
/var/folders/_n/2jvfdkwd1l786q9j729kq39r0000gr/T//chpl-stonea_local.deleteme-SkAufT/ChapelSyncvar.c:79:26: error: expected expression
call_tmp_chpl43 = sizeof();
^
/var/folders/_n/2jvfdkwd1l786q9j729kq39r0000gr/T//chpl-stonea_local.deleteme-SkAufT/ChapelSyncvar.c:156:36: error: too few arguments to function call, single argument 'x'
was not specified
call_tmp_chpl42 = c_pointer_return();
~~~~~~~~~~~~~~~~ ^
/Users/stonea_local/chapel/runtime/include/chpltypes.h:76:1: note: 'c_pointer_return' declared here
static inline void* c_pointer_return(void* x) { return x; }
^
4 errors generated.
Even more odd, if I compile like this:
> chpl foo.chpl -o foo
I get a different error message?
zsh: segmentation fault chpl foo.chpl -o foo
Configuration Information
- Output of
chpl --version
:
chpl version 1.29.0 pre-release (8348468f44)
Copyright 2020-2022 Hewlett Packard Enterprise Development LP
Copyright 2004-2019 Cray Inc.
(See LICENSE file for more details)
- Output of
$CHPL_HOME/util/printchplenv --anonymize
:
$ $CHPL_HOME/util/printchplenv --anonymize
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: clang
CHPL_TARGET_ARCH: x86_64
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: bundled
CHPL_HWLOC: bundled
CHPL_RE2: bundled
CHPL_LLVM: none *
CHPL_AUX_FILESYS: none
- Back-end compiler and version, e.g.
gcc --version
orclang --version
:
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin