Fix bit_set upper endpoint representability check

This commit is contained in:
Michael Tesař
2026-08-16 00:30:42 +02:00
parent d511234bf4
commit b17c10162d
3 changed files with 12 additions and 1 deletions

View File

@@ -1368,7 +1368,7 @@ gb_internal void check_bit_set_type(CheckerContext *c, Type *type, Type *named_t
gb_free(a, s.text);
return;
}
if (!check_representable_as_constant(c, iv, t, nullptr)) {
if (!check_representable_as_constant(c, jv, t, nullptr)) {
gbAllocator a = heap_allocator();
String s = big_int_to_string(a, &j);
gbString ts = type_to_string(t);

View File

@@ -107,6 +107,13 @@ else
exit 1
fi
if [[ $($ODIN check ../test_issue_7304.odin -no-entry-point $COMMON_CHECK 2>&1 >/dev/null | grep -c "9223372036854775808 is not representable by int") -eq 1 ]]; then
echo "SUCCESSFUL 1/1"
else
echo "SUCCESSFUL 0/1"
exit 1
fi
clang -c ../test_issue_7010.c -o test_issue_7010_c.o
$ODIN test ../test_issue_7010.odin $COMMON

View File

@@ -0,0 +1,4 @@
// Tests issue #7304 https://github.com/odin-lang/Odin/issues/7304
package test_issues
Bad_Bit_Set :: bit_set[-1 ..< 9223372036854775808]