JuliaHubOSS/llvm-cbe

2 tests fail with GCC 9.3: “array subscript -1 is outside array bounds of ‘uint32_t[1]’”

Closed this issue · 1 comments

  • test_consistent_return_value_c[test_char_sized_ptr_math_decr--O2]
  • test_consistent_return_value_c[test_char_sized_ptr_math_decr--O3]

I think the error message is self-explanatory, and it seems completely correct, the generated C is indeed using -1 as an array index, and that looks like the intent of the source file test/c_tests/pointers/test_char_sized_ptr_math_decr.c too.

I don't know what to reasonably do about this. Silence the warning with another GCC flag?

Not a big deal in any case.

Adding -Warray-bounds=0 to the flags passed to GCC is enough to make it shut up.

It would probably be best to localise this to just tests based on test_char_sized_ptr_math_decr.c.