[Bug ada/82813] warning: '.builtin_memcpy' writing between 2 and 6 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
ebotcazou at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 2 17:20:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82813
--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> The warning will go away once pr80545 is fixed but I wonder if a better
> (independent) solution in this case is to detect that the code is, in fact,
> unreachable, and avoid emitting it to begin with.
Yes, it's a missed optimization at the GIMPLE level.
> Alternatively, if it is too hard to determine that it's unreachable, it should
> be possible to detect that the memcpy call is invalid earlier and replace it
> with either __builtin_unreachable or __builtin_trap.
Possibly, 121t.phicprop1 has:
S117b.276_245 = .builtin_alloca_with_align (0, 8);
# DEBUG S117b.276 => S117b.276_245
_46 = (sizetype) j_231;
_48 = &*sw.246_6[1 ...]{lb: 1 sz: 1};
_49 = &*S117b.276_245[1 ...]{lb: 1 sz: 1};
.builtin_memcpy (_49, _48, _46);
More information about the Gcc-bugs
mailing list