[Bug middle-end/50628] [4.7 Regression] gfortran.fortran-torture/execute/entry_4.f fails

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 6 13:35:00 GMT 2011


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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-10-06
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-06 13:34:38 UTC ---
PRE now changes

-<bb 6>:
   D.2317 = VIEW_CONVERT_EXPR<union munion.1.f2>(__complex__ (4.5e+1, 0.0));
   D.2317.e2 = 0;
-  D.2329_19 = REALPART_EXPR <VIEW_CONVERT_EXPR<complex(kind=4)>(D.2317)>;
+  D.2329_19 = 0.0;
   D.2330_20 = IMAGPART_EXPR <VIEW_CONVERT_EXPR<complex(kind=4)>(D.2317)>;
-  D.2331_21 = D.2329_19 != 4.5e+1;
+  D.2331_21 = 1;
   D.2332_22 = D.2330_20 != 0.0;
-  D.2333_23 = D.2332_22 | D.2331_21;
-  if (D.2333_23 == 1)

but you can see that the transform is correct - __complex__ (4.5e+1, 0.0)
is stored to D.2317 but then the realpart is overwritten by a boolean(kind=4)
false.  Which is interpreted as 0.0 by REALPART_EXPR
<VIEW_CONVERT_EXPR<complex(kind=4)>(D.2317)>; thus the D.2329_19 != 4.5e+1
is always true.

that's the e1 (7) test.  Without PRE it fails at the g4 (2) test (via FRE).

I suppose the frontend eventually fails foul of aliasing issues here?


Reduced testcase:

        complex function f2 (a)
        integer a
        logical e2
        entry e2 (a)
        if (a .gt. 0) then
          e2 = a .lt. 46
        else
          f2 = 45
        endif
        end function

        program entrytest
        complex f2
        if (f2 (0) .ne. 45) call abort ()
        end



More information about the Gcc-bugs mailing list