https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114374
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aldyh at gcc dot gnu.org,
| |amacleod at redhat dot com,
| |jakub at gcc dot gnu.org
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems format_integer uses the ranger even at -O0, and asks the ranger there
(talking about #c5 at -O0 -Wall) for value of loop.0_1
1398 value_range vr;
1399 ptr_qry.rvals->range_of_expr (vr, arg, dir.info->callstmt);
in
<bb 2> :
loop_4 = 1;
<bb 3> :
# loop_2 = PHI <loop_4(2), loop_6(5)>
loop.0_1 = loop_2;
loop_6 = loop.0_1 + 1;
__builtin_snprintf (&buf, 11, "%d", loop.0_1);
if (loop_6 <= 9)
goto <bb 5>; [INV]
else
goto <bb 4>; [INV]
<bb 5> :
goto <bb 3>; [100.00%]
and ranger says [irange] int [-2147483647, 9]
Haven't checked if it just for -O0 doesn't look outside of the loop or what,
not looking outside of the loop would give [-2147483648, 9] IMHO though.
Anyway, in g it is asked about old_5 in:
<bb 2> :
loop_3 = 1;
<bb 3> :
# loop_1 = PHI <loop_3(2), loop_6(5)>
old_5 = loop_1;
loop_6 = loop_1 + 1;
__builtin_snprintf (&buf, 11, "%d", old_5);
if (loop_6 <= 9)
goto <bb 5>; [INV]
else
goto <bb 4>; [INV]
<bb 5> :
goto <bb 3>; [100.00%]
and returns [irange] int [1, 9] in that case.