https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116224

--- Comment #2 from Zdenek Sojka <zsojka at seznam dot cz> ---
(In reply to Jakub Jelinek from comment #1)
> This needs to be
> signed char g;
> 
> int
> foo (signed char c, int i, _BitInt(65) b)
> {
>   __builtin_memmove (&g, &b, 1);
>   return b / i / c;
> }
> 
> int
> main ()
> {
>   int x = foo (-15, -15, 900);
>   if (x != 4)
>     __builtin_abort ();
> }
> 
> because you are relying on the char being signed.

Thank you for reminding me of this; with the original testcase:
$ aarch64-unknown-linux-gnu-gcc testcase.c -static -O0 -fsigned-char && ./a.out 
$ aarch64-unknown-linux-gnu-gcc testcase.c -static -O0 -funsigned-char &&
./a.out 
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted
$ aarch64-unknown-linux-gnu-gcc testcase.c -static -O1 -fsigned-char && ./a.out 
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted
$ aarch64-unknown-linux-gnu-gcc testcase.c -static -O1 -funsigned-char &&
./a.out 
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted

it fails with -fsigned-char as well (and of course with your fixed testcase).

But I might have missed something again.

Reply via email to