https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104288

--- Comment #5 from Andrew Macleod <amacleod at redhat dot com> ---
The issue is that the routine to determine non-nullness is being called to
check for range-on-entry of the current block instead of just the dominators. 

The trace shows:
24   range_on_entry (value_1_7(D)) to BB 2
25     range_of_stmt (value_1_7(D)) at stmt GIMPLE_NOP
       TRUE : (25) range_of_stmt (value_1_7(D)) const char * VARYING
     TRUE : (24) range_on_entry (value_1_7(D)) const char * [1B, +INF]

so it correctly determines that the range of value_1_7 is VARYING, but
range-on-entry to bb2 is adjusted to be non-null.  Ultimately,this is because
then routine in question answers the question "is there a non-null reference in
block BB".

Range on entry should not consider the current block, it should instead start
looking at the dominator to this block.

That section of code has changed between gcc11 and 12, so there will be 2
slightly different patches coming.

Reply via email to