This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR40011 - Problems with -fwhole-file
- From: Tobias Burnus <burnus at net-b dot de>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, fortran at gcc dot gnu dot org
- Date: Fri, 24 Jul 2009 00:48:20 +0200
- Subject: Re: [Patch, fortran] PR40011 - Problems with -fwhole-file
- References: <339c37f20907231505t2d33dad0oc9f886eb0b22cb27@mail.gmail.com>
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