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: "tkoenig at netcologne dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 19 Nov 2011 10:57:23 +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 #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.