------- Comment #2 from steven at gcc dot gnu dot org  2006-02-22 07:35 -------
Confirmed.

Before forwprop1:

  D.2354_2 = operator new [] (416);
  a_3 = (int *) D.2354_2;
  *a_3 = 1;
  if (a_3 == 0B) goto <L0>; else goto <L1>;

After forwprop1:
  D.2354_2 = operator new [] (416);
  a_3 = (int *) D.2354_2;
  *a_3 = 1;
  if (D.2354_2 == 0B) goto <L0>; else goto <L1>;

Now VRP can't see that D.2354_2 is non-NULL:

ASSERT_EXPRs to be inserted

Assertions to be inserted for a_3
        *a_3 = 1
        BB #2
        PREDICATE: a_3 ne_expr 0B

(...)

Visiting conditional with predicate: D.2354_2 == 0B
With known ranges
        D.2354_2: VARYING

(...)

b_1: VARYING
D.2354_2: VARYING
a_3: VARYING
<retval>_4: VARYING
a_5: ~[0B, 0B]  EQUIVALENCES: { a_3 a_11 } (2 elements)
b_6: VARYING
b_7: [b_6, b_6]  EQUIVALENCES: { b_6 } (1 elements)
a_11: ~[0B, 0B]  EQUIVALENCES: { a_3 } (1 elements)

So D.2354_2 stays VARYING and this blocks us from optimizing away the
condition:
  D.2354_2 = operator new [] (416);
  a_3 = (int *) D.2354_2;
  *a_3 = 1;
  if (D.2354_2 == 0B) goto <L0>; else goto <L1>;


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dnovillo at gcc dot gnu dot
                   |                            |org, law at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-02-22 07:35:56
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26406

Reply via email to