[Bug c/114205] Miscompilation: the use of __builtin_object_size cause asan failure.
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Mar 2 08:06:50 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114205
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I don't see why you think this is a bug.
-1 returning from __builtin_object_size means it does not know the size.
Without optimization, GCC cannot figure out the size of the object that is
being passed to __builtin_object_size . So at -O0 it aborts.
`-fsanitize=address` will output the error message:
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x7f7a49828898 bp
0x7f7a49a1be90 sp 0x7ffc8a097720 T0)
```
When abort is called.
There is nothing wrong here.
More information about the Gcc-bugs
mailing list