This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR40011 - Problems with -fwhole-file


Paul Richard Thomas schrieb:
> The following fails at any level of optimization with or without
> -fwhole-file but is OK in 4.4.1.  I cannot tell yet if I have done
> something wrong or if the fault is downstream from the fortran
> front-end (ie. I have not yet reverted the patch to check).  Nor have
> I checked if it is expected to pass according to the standard:
>
> ! { dg-do run }
>   
Using NAG f95 -C=all one gets the run-time error:

Reference to dangling pointer
 - Target was RETURNed from procedure TEST_EQUI:CHECK
Program terminated by fatal error
In TEST_EQUI, line 18 of test.f90

Also here it fails with -O1 using the trunk. While with ifort, NAG f95,
and gfortran 4.4, valgrind shows no problems, using gfortran -O1 or g95
-O1 one gets the crash.

It works if one ensures that the target remains in the memory, e.g. by
using STATIC or by moving it into the scope of the main program.

> With earlier versions of gcc, the conditions are optimized away
> completely but now there is a strange remnant that fails.
>
>   
It would be interesting to understand why this happens. There could be a
missed optimization lurking - or it is just a side effect of this
invalid construct, which only shows up due to some patch.

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]