https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104076
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Looking at the IL before r12-6694 I'm not sure I see what could be done to keep
the warning from triggering but maybe someone has an idea for a solution I'm
not seeing, in case this comes back with a different test case.
struct S2 f2 (bool b)
{
const struct S1 D.2507[1];
...
<bb 2> :
cleanup.1_26 = 0;
cleanup.2_27 = 0;
if (b_28(D) != 0)
goto <bb 3>; [INV]
else
goto <bb 4>; [INV]
<bb 3> :
f1 ();
goto <bb 6>; [INV]
<bb 4> :
_29 = &D.2507; <<< &D.2507
_30 = _29;
_31 = 0;
cleanup.1_32 = 1;
S1::S1 (_30, 0);
<bb 5> :
_35 = _30 + 1;
_36 = _31 + -1;
retval.0_37 = _29;
_38 = 0;
cleanup.2_39 = 1;
D.2529.array = &D.2507;
D.2529.nelts = 1;
S2::S2 (&D.2525, D.2529);
<bb 6> :
# _7 = PHI <_29(5), _44(D)(3)> <<< _7 == _29(5) == &D.2507 or
undefined
# _9 = PHI <_38(5), _45(D)(3)>
# cleanup.1_13 = PHI <cleanup.1_32(5), cleanup.1_26(3)>
# cleanup.2_15 = PHI <cleanup.2_39(5), cleanup.2_27(3)>
if (cleanup.2_15 != 0)
goto <bb 7>; [INV]
else
goto <bb 10>; [INV]
<bb 7> :
_46 = &D.2507 + 1;
<bb 8> :
# _5 = PHI <_46(7), _47(9)>
if (&D.2507 == _5)
goto <bb 10>; [INV]
else
goto <bb 9>; [INV]
<bb 9> :
_47 = _5 + 18446744073709551615;
S1::~S1 (_47);
goto <bb 8>; [INV]
<bb 10> :
D.2507 ={v} {CLOBBER}; <<< D.2507 clobbered
if (cleanup.1_13 != 0)
goto <bb 11>; [INV]
else
goto <bb 15>; [INV]
<bb 11> :
if (_7 != 0B)
goto <bb 12>; [INV]
else
goto <bb 15>; [INV]
<bb 12> :
_1 = -_9;
_2 = (sizetype) _1;
_50 = _7 + _2;
<bb 13> :
# _11 = PHI <_50(12), _51(14)> <<< _11 points to &D.2507
if (_11 == _7) <<< -Wdangling-pointer
goto <bb 15>; [INV]
else
goto <bb 14>; [INV]
<bb 14> :
_51 = _11 + 18446744073709551615; <<< _51
S1::~S1 (_51);
goto <bb 13>; [INV]
<bb 15> :
return D.2525;
...
}
cc1plus.r12-6693: all warnings being treated as errors