Closed pyrmont closed 1 month ago
Sorry, I've updated the original post with more fulsome output after noticing that running make test
with the sanitiser on on macOS produces more errors. The issue is not simply restricted to src/core/bytecode.c
as previously stated.
The output when running with the sanitiser on on Linux is slightly different to macOS. Here's what I get:
[...]
build/janet_boot . JANET_PATH '/usr/local/lib/janet' > build/c/janet.c
src/core/bytecode.c:152:72: runtime error: left shift of negative value -1
cksum build/c/janet.c
3766895594 3097782 build/c/janet.c
cc -fsanitize=undefined -O2 -g -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -c build/c/janet.c -o build/janet.o
cp src/mainclient/shell.c build/c/shell.c
cc -fsanitize=undefined -O2 -g -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -c build/c/shell.c -o build/shell.o
cc -fsanitize=undefined -rdynamic -O2 -g -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -o build/janet build/janet.o build/shell.o -lm -lpthread -lrt -ldl
for f in test/suite*.janet; do ./build/janet "$f" || exit; done
Starting suite test/suite-array.janet...
Finished suite test/suite-array.janet in 0.006 seconds - 20 of 20 tests passed.
Starting suite test/suite-asm.janet...
Finished suite test/suite-asm.janet in 0.018 seconds - 6 of 6 tests passed.
Starting suite test/suite-boot.janet...
Finished suite test/suite-boot.janet in 0.159 seconds - 527 of 527 tests passed.
Starting suite test/suite-buffer.janet...
Finished suite test/suite-buffer.janet in 0.020 seconds - 57 of 57 tests passed.
Starting suite test/suite-bundle.janet...
src/core/math.c:88:72: runtime error: left shift of 143 by 24 places cannot be represented in type 'int'
src/core/math.c:89:72: runtime error: left shift of 164 by 24 places cannot be represented in type 'int'
src/core/math.c:90:74: runtime error: left shift of 200 by 24 places cannot be represented in type 'int'
src/core/math.c:91:76: runtime error: left shift of 181 by 24 places cannot be represented in type 'int'
Finished suite test/suite-bundle.janet in 0.120 seconds - 35 of 35 tests passed.
Starting suite test/suite-capi.janet...
Finished suite test/suite-capi.janet in 0.003 seconds - 9 of 9 tests passed.
Starting suite test/suite-cfuns.janet...
Finished suite test/suite-cfuns.janet in 0.001 seconds - 2 of 2 tests passed.
Starting suite test/suite-compile.janet...
Finished suite test/suite-compile.janet in 0.003 seconds - 10 of 10 tests passed.
Starting suite test/suite-corelib.janet...
Finished suite test/suite-corelib.janet in 0.025 seconds - 95 of 95 tests passed.
Starting suite test/suite-debug.janet...
Finished suite test/suite-debug.janet in 0.001 seconds - 1 of 1 tests passed.
Starting suite test/suite-ev.janet...
src/core/bytecode.c:152:72: runtime error: left shift of negative value -1
Finished suite test/suite-ev.janet in 2.798 seconds - 503 of 503 tests passed.
Starting suite test/suite-ffi.janet...
Finished suite test/suite-ffi.janet in 0.003 seconds - 8 of 8 tests passed.
Starting suite test/suite-inttypes.janet...
Finished suite test/suite-inttypes.janet in 0.089 seconds - 375 of 375 tests passed.
Starting suite test/suite-io.janet...
Finished suite test/suite-io.janet in 0.005 seconds - 11 of 11 tests passed.
Starting suite test/suite-marsh.janet...
Finished suite test/suite-marsh.janet in 0.023 seconds - 41 of 41 tests passed.
Starting suite test/suite-math.janet...
src/core/bytecode.c:152:72: runtime error: left shift of negative value -1
Finished suite test/suite-math.janet in 0.379 seconds - 158 of 158 tests passed.
Starting suite test/suite-os.janet...
Finished suite test/suite-os.janet in 0.550 seconds - 48 of 48 tests passed.
Starting suite test/suite-parse.janet...
test/suite-parse.janet:160:1: compile warning (normal): empty loop body
test/suite-parse.janet:165:1: compile warning (normal): empty loop body
Finished suite test/suite-parse.janet in 0.013 seconds - 43 of 43 tests passed.
Starting suite test/suite-peg.janet...
Finished suite test/suite-peg.janet in 0.094 seconds - 221 of 221 tests passed.
Starting suite test/suite-pp.janet...
Finished suite test/suite-pp.janet in 0.004 seconds - 12 of 12 tests passed.
Starting suite test/suite-specials.janet...
Finished suite test/suite-specials.janet in 0.014 seconds - 58 of 58 tests passed.
Starting suite test/suite-string.janet...
Finished suite test/suite-string.janet in 0.016 seconds - 68 of 68 tests passed.
Starting suite test/suite-strtod.janet...
Finished suite test/suite-strtod.janet in 0.001 seconds - 3 of 3 tests passed.
Starting suite test/suite-struct.janet...
Finished suite test/suite-struct.janet in 0.007 seconds - 32 of 32 tests passed.
Starting suite test/suite-symcache.janet...
Finished suite test/suite-symcache.janet in 0.017 seconds - 4 of 4 tests passed.
Starting suite test/suite-table.janet...
Finished suite test/suite-table.janet in 0.005 seconds - 15 of 15 tests passed.
Starting suite test/suite-unknown.janet...
Finished suite test/suite-unknown.janet in 0.050 seconds - 67 of 67 tests passed.
Starting suite test/suite-value.janet...
Finished suite test/suite-value.janet in 0.005 seconds - 23 of 23 tests passed.
Starting suite test/suite-vm.janet...
Finished suite test/suite-vm.janet in 0.017 seconds - 36 of 36 tests passed.
for f in examples/*.janet; do ./build/janet -k "$f"; done
src/core/bytecode.c:152:72: runtime error: left shift of negative value -1
src/core/bytecode.c:152:72: runtime error: left shift of negative value -1
src/core/bytecode.c:152:72: runtime error: left shift of negative value -1
In case it helps, on macOS, I'm running Apple clang version 16.0.0 (clang-1600.0.21.4). On Linux, I'm running cc (GCC) 13.2.0.
After prepending -fsanitize=undefined
to COMMON_CFLAGS
in Makefile
, I got similar output (Void Linux, gcc) [1]:
$ make cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/abstract.boot.o -c src/core/abstract.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/array.boot.o -c src/core/array.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/asm.boot.o -c src/core/asm.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/buffer.boot.o -c src/core/buffer.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/bytecode.boot.o -c src/core/bytecode.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/capi.boot.o -c src/core/capi.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/cfuns.boot.o -c src/core/cfuns.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/compile.boot.o -c src/core/compile.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/corelib.boot.o -c src/core/corelib.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/debug.boot.o -c src/core/debug.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/emit.boot.o -c src/core/emit.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/ev.boot.o -c src/core/ev.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/ffi.boot.o -c src/core/ffi.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/fiber.boot.o -c src/core/fiber.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/gc.boot.o -c src/core/gc.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/inttypes.boot.o -c src/core/inttypes.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/io.boot.o -c src/core/io.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/marsh.boot.o -c src/core/marsh.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/math.boot.o -c src/core/math.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/net.boot.o -c src/core/net.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/os.boot.o -c src/core/os.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/parse.boot.o -c src/core/parse.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/peg.boot.o -c src/core/peg.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/pp.boot.o -c src/core/pp.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/regalloc.boot.o -c src/core/regalloc.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/run.boot.o -c src/core/run.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/specials.boot.o -c src/core/specials.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/state.boot.o -c src/core/state.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/string.boot.o -c src/core/string.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/strtod.boot.o -c src/core/strtod.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/struct.boot.o -c src/core/struct.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/symcache.boot.o -c src/core/symcache.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/table.boot.o -c src/core/table.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/tuple.boot.o -c src/core/tuple.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/util.boot.o -c src/core/util.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/value.boot.o -c src/core/value.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/vector.boot.o -c src/core/vector.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/vm.boot.o -c src/core/vm.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/core/wrap.boot.o -c src/core/wrap.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/boot/array_test.boot.o -c src/boot/array_test.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/boot/boot.boot.o -c src/boot/boot.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/boot/buffer_test.boot.o -c src/boot/buffer_test.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/boot/number_test.boot.o -c src/boot/number_test.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/boot/system_test.boot.o -c src/boot/system_test.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/boot/table_test.boot.o -c src/boot/table_test.c cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"342a29c7\"" -O0 -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -g -o build/janet_boot build/core/abstract.boot.o build/core/array.boot.o build/core/asm.boot.o build/core/buffer.boot.o build/core/bytecode.boot.o build/core/capi.boot.o build/core/cfuns.boot.o build/core/compile.boot.o build/core/corelib.boot.o build/core/debug.boot.o build/core/emit.boot.o build/core/ev.boot.o build/core/ffi.boot.o build/core/fiber.boot.o build/core/gc.boot.o build/core/inttypes.boot.o build/core/io.boot.o build/core/marsh.boot.o build/core/math.boot.o build/core/net.boot.o build/core/os.boot.o build/core/parse.boot.o build/core/peg.boot.o build/core/pp.boot.o build/core/regalloc.boot.o build/core/run.boot.o build/core/specials.boot.o build/core/state.boot.o build/core/string.boot.o build/core/strtod.boot.o build/core/struct.boot.o build/core/symcache.boot.o build/core/table.boot.o build/core/tuple.boot.o build/core/util.boot.o build/core/value.boot.o build/core/vector.boot.o build/core/vm.boot.o build/core/wrap.boot.o build/boot/array_test.boot.o build/boot/boot.boot.o build/boot/buffer_test.boot.o build/boot/number_test.boot.o build/boot/system_test.boot.o build/boot/table_test.boot.o -lm -lpthread -lrt -ldl build/janet_boot . JANET_PATH '/usr/local/lib/janet' > build/c/janet.c src/core/bytecode.c:152:72: runtime error: left shift of negative value -1 cksum build/c/janet.c 1813887916 3097755 build/c/janet.c cc -O2 -g -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -c build/c/janet.c -o build/janet.o cp src/mainclient/shell.c build/c/shell.c cc -O2 -g -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -c build/c/shell.c -o build/shell.o cc -rdynamic -O2 -g -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -o build/janet build/janet.o build/shell.o -lm -lpthread -lrt -ldl ar rcs build/libjanet.a build/janet.o build/shell.o ./build/janet tools/patch-header.janet src/include/janet.h src/conf/janetconf.h build/janet.h cc -O2 -g -fsanitize=undefined -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -Wl,-soname,libjanet.so.1.35 -shared -o build/libjanet.so build/janet.o build/shell.o -lm -lpthread -lrt -ldl [user@dl5520 janet]$ make test for f in test/suite*.janet; do ./build/janet "$f" || exit; done src/core/util.c:345:13: runtime error: member access within misaligned address 0x563e4f1d6596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x563e4f1d6596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-array.janet... Finished suite test/suite-array.janet in 0.002 seconds - 20 of 20 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x55bebca90596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x55bebca90596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-asm.janet... Finished suite test/suite-asm.janet in 0.004 seconds - 6 of 6 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x5568992c6596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x5568992c6596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-boot.janet... Finished suite test/suite-boot.janet in 0.015 seconds - 527 of 527 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x55fa4bd3c596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x55fa4bd3c596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-buffer.janet... Finished suite test/suite-buffer.janet in 0.002 seconds - 57 of 57 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x55e3d0d1e596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x55e3d0d1e596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-bundle.janet... src/core/math.c:90:74: runtime error: left shift of 226 by 24 places cannot be represented in type 'int' src/core/math.c:91:76: runtime error: left shift of 135 by 24 places cannot be represented in type 'int' Finished suite test/suite-bundle.janet in 0.008 seconds - 35 of 35 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x558a85409596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x558a85409596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-capi.janet... Finished suite test/suite-capi.janet in 0.000 seconds - 9 of 9 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x560da548c596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x560da548c596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-cfuns.janet... Finished suite test/suite-cfuns.janet in 0.000 seconds - 2 of 2 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x561c4b6ee596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x561c4b6ee596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-compile.janet... Finished suite test/suite-compile.janet in 0.000 seconds - 10 of 10 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x56307f8b0596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x56307f8b0596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-corelib.janet... Finished suite test/suite-corelib.janet in 0.003 seconds - 95 of 95 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x56519b3ce596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x56519b3ce596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-debug.janet... Finished suite test/suite-debug.janet in 0.000 seconds - 1 of 1 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x5648fc38b596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x5648fc38b596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-ev.janet... src/core/bytecode.c:152:72: runtime error: left shift of negative value -1 Finished suite test/suite-ev.janet in 0.302 seconds - 503 of 503 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x55fc1443f596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x55fc1443f596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-ffi.janet... Finished suite test/suite-ffi.janet in 0.001 seconds - 8 of 8 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x55dab3ccb596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x55dab3ccb596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-inttypes.janet... Finished suite test/suite-inttypes.janet in 0.009 seconds - 375 of 375 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x564d9b771596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x564d9b771596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-io.janet... Finished suite test/suite-io.janet in 0.001 seconds - 11 of 11 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x5577b81f5596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x5577b81f5596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-marsh.janet... Finished suite test/suite-marsh.janet in 0.002 seconds - 41 of 41 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x55ea68d31596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x55ea68d31596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-math.janet... src/core/bytecode.c:152:72: runtime error: left shift of negative value -1 Finished suite test/suite-math.janet in 0.040 seconds - 158 of 158 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x5603d2b4e596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x5603d2b4e596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-os.janet... Finished suite test/suite-os.janet in 0.059 seconds - 48 of 48 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x55e052a10596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x55e052a10596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-parse.janet... test/suite-parse.janet:160:1: compile warning (normal): empty loop body test/suite-parse.janet:165:1: compile warning (normal): empty loop body Finished suite test/suite-parse.janet in 0.001 seconds - 43 of 43 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x55ae192da596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x55ae192da596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-peg.janet... Finished suite test/suite-peg.janet in 0.009 seconds - 221 of 221 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x5578760e5596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x5578760e5596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-pp.janet... Finished suite test/suite-pp.janet in 0.000 seconds - 12 of 12 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x562dfb7c5596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x562dfb7c5596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-specials.janet... Finished suite test/suite-specials.janet in 0.001 seconds - 58 of 58 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x563ee4761596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x563ee4761596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-string.janet... Finished suite test/suite-string.janet in 0.001 seconds - 68 of 68 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x563bd4aa1596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x563bd4aa1596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-strtod.janet... Finished suite test/suite-strtod.janet in 0.000 seconds - 3 of 3 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x55eabbc9f596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x55eabbc9f596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-struct.janet... Finished suite test/suite-struct.janet in 0.001 seconds - 32 of 32 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x563d85eaa596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x563d85eaa596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-symcache.janet... Finished suite test/suite-symcache.janet in 0.001 seconds - 4 of 4 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x556275bc9596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x556275bc9596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-table.janet... Finished suite test/suite-table.janet in 0.000 seconds - 15 of 15 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x56056a436596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x56056a436596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-unknown.janet... Finished suite test/suite-unknown.janet in 0.005 seconds - 67 of 67 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x55cdb6b6e596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x55cdb6b6e596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-value.janet... Finished suite test/suite-value.janet in 0.000 seconds - 23 of 23 tests passed. src/core/util.c:345:13: runtime error: member access within misaligned address 0x55d5995ce596 for type 'struct JanetStringHead', which requires 8 byte alignment 0x55d5995ce596: note: pointer points here 75 6e 63 61 74 65 64 00 75 6e 64 65 66 69 6e 65 64 20 73 69 67 6e 61 6c 20 25 76 00 72 65 61 6c ^ Starting suite test/suite-vm.janet... Finished suite test/suite-vm.janet in 0.002 seconds - 36 of 36 tests passed. for f in examples/*.janet; do ./build/janet -k "$f"; done src/core/bytecode.c:152:72: runtime error: left shift of negative value -1 src/core/bytecode.c:152:72: runtime error: left shift of negative value -1 src/core/bytecode.c:152:72: runtime error: left shift of negative value -1
[1] Needed to install an appropriate lib too -- here I installed libsanitizer-devel
.
I no longer see the "runtime error..." output when I try the aforementioned steps on a checkout of https://github.com/janet-lang/janet/commit/771956b5b631fc31679455ad0aef332a8a64a401.
I no longer see it on Linux, either.
On macOS, the flag causes a warning related to the (int? 8589934592)
call in test/suite-codelib.janet
but that seems like a warning that's acceptable to ignore given the point of this test is to ensure Janet correctly identifies this as not an int.
I'll mark this as closed. Thanks for such a responsive fix.
I tried compiling Janet's source code using Zig's C compiler and kept having the compiler crash. After reading that Zig turns on
-fsanitize=undefined
by default, I tried enabling it on my default compiler (Clang) when runningmake test
and got the following output:I confirmed similar (although not the same) errors on GCC on Linux with the undefined behaviour sanitiser turned on.