[Bug tree-optimization/102381] unexpected -Wmaybe-uninitialized with noreturn inside loop and conditional setting of variable

2021-09-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102381

--- Comment #2 from Andrew Pinski  ---
The noreturn messes up the anlysis fully.

[Bug tree-optimization/102381] unexpected -Wmaybe-uninitialized

2021-09-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102381

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-09-17

--- Comment #1 from Andrew Pinski  ---
Confirmed.



[AFTER NORMALIZATION -- [DEF]:
ipp_28 = PHI 
is guarded by :

i2.2_26 > 0 (.AND.) i1_10(D) != 0



[AFTER NORMALIZATION -- [USE]:
ipp_27 = PHI 
is guarded by :

i1_10(D) != 0 (.AND.)  (.NOT.) i4_17 < prephitmp_25 (.AND.) _2 == 0
(.OR.)
i1_10(D) != 0 (.AND.)  (.NOT.) i4_17 < prephitmp_25 (.AND.) i3.0_1 & 1

...
  _2 = i3.0_1 & 1;

So there is a missing simplification
It should have been:

i1_10(D) != 0 (.AND.)  (.NOT.) i4_17 < prephitmp_25

prephitmp_25 is defined as:
  # prephitmp_25 = PHI 
So i2.2_26 (as i2.2_21 is the one on the branch which would have been
uninitialized).
So we are down to:
i1_10(D) != 0 (.AND.)  (.NOT.) i4_17 < i2.2_26

i4_17 is the loop IV so it should be discarded.