This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51218] [4.7 Regression] Potential optimization bug due to implicit_pure?
- From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 19 Nov 2011 16:08:06 +0000
- Subject: [Bug fortran/51218] [4.7 Regression] Potential optimization bug due to implicit_pure?
- Auto-submitted: auto-generated
- References: <bug-51218-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51218
--- Comment #12 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2011-11-19 16:08:06 UTC ---
On Sat, Nov 19, 2011 at 10:57:23AM +0000, tkoenig at netcologne dot de wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51218
>
> --- Comment #10 from tkoenig at netcologne dot de <tkoenig at netcologne dot de> 2011-11-19 10:57:23 UTC ---
> Am 19.11.2011 11:18, schrieb anlauf at gmx dot de:
> > This won't work. The implementation of the management
> > of temporaries does not allow that the same instance
> > is used more than once.
>
> If I understand your code, you are modifying the arguments of your
> function and evaluating that function more than once in a single
> expression. This is illegal in Fortran, so gfortran could, in
> principle, do anything with it. I would advise you to fix your code to
> be standard-conforming.
>
> Because such code is unfortunately quite common, gfortran by default
> does not do such optimizations unless directed to be. The fact that
> it does here nonetheless is, indeed, a bug.
>
The code is also invalid because it manipulates the
pointer (not the target) of a derived-type dummy
argument with the intent(in) attribute. The code
has at least two bugs and the PR should be closed.