This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/82090] Bogus warning: ‘magic_p’ may be used uninitialized in this function [-Wmaybe-uninitialized]
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 04 Sep 2017 08:55:23 +0000
- Subject: [Bug tree-optimization/82090] Bogus warning: ‘magic_p’ may be used uninitialized in this function [-Wmaybe-uninitialized]
- Auto-submitted: auto-generated
- References: <bug-82090-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82090
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-09-04
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed (at -O1 even).
We fail to jump-thread oldmem_5(D) == 0 and get
<bb 2> [100.00%]:
if (oldmem_5(D) == 0B)
goto <bb 3>; [4.07%]
else
goto <bb 7>; [95.93%]
<bb 7> [95.93%]:
goto <bb 4>; [100.00%]
<bb 3> [4.07%]:
<bb 4> [100.00%]:
# magic_p_17 = PHI <magic_p_18(D)(3), oldmem_5(D)(7)>
__asm__ __volatile__("cmpl $0, __libc_multiple_threads(%%rip)
...
if (oldmem_5(D) == 0B)
goto <bb 5>; [0.04%]
else
goto <bb 6>; [99.96%]
<bb 5> [0.04%]:
malloc_printerr ("realloc(): invalid pointer");
<bb 6> [99.96%]:
_2 = *magic_p_17;
_3 = ~_2;
*magic_p_17 = _3;
return oldmem_5(D);
and the late uninit pass is not able to "prove" we're not using magic_p_18(D).
Jump threading probably gives up because of the asm ().