The testcase of PR30668 is miscompiled with -fwhole-file:

$> gfortran-svn -Wall -W pr30668.f90 && ./a.out 
   2.0000000               4
$> gfortran-svn -Wall -W pr30668.f90 -fwhole-file && ./a.out
   0.0000000               4

Expected output for the latter:
   2.0000000...            8

The dump shows that the kind is properly recognized for the result variable
('-' without -fwhole-file, '+' with):
-      real(kind=4) D.1505;
+      real(kind=8) D.1504;

but the kind information is not passed on
-      _gfortran_transfer_real (&dt_parm.1, &D.1505, 4);
+      _gfortran_transfer_real (&dt_parm.1, &D.1504, 4);
i.e. the last argument to gfortran_transfer_real() should be '8' instead. 

The same holds for
-      static integer(kind=4) C.1506 = 4;
+      static integer(kind=4) C.1505 = 4;

where the second line should have '8' as well.


-- 
           Summary: miscompilation with -fwhole-file
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dfranke at gcc dot gnu dot org


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

Reply via email to