This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/51218] [4.7 Regression] Potential optimization bug due to implicit_pure?


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

--- Comment #13 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2011-11-19 16:18:18 UTC ---
On Sat, Nov 19, 2011 at 11:46:28AM +0000, anlauf at gmx dot de wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51218
> 
> --- Comment #11 from Harald Anlauf <anlauf at gmx dot de> 2011-11-19 11:46:28 UTC ---
> (In reply to comment #10)
> The code does memory management similar to that required by

s/does/tries to do/

> TR15581 for allocatable DT components and allocatable function
> results, but it also has to work for compilers that do not
> support TR15581.  It does so by overloading everything needed.
> 
> > If I understand your code, you are modifying the arguments of your 
> > function and evaluating that function more than once in a single
> > expression.
> 
> The expression xi*wi allocates a temporary, which needs to
> get deallocated after it was used to avoid a memory leak.
> All bookkeeping is done with the temporaries.  Functions
> check whether they access a variable or a temporary.
> Using the temporaries is not a pure operation, which is
> consistent with the way the functions are declared.

*If* the compiler generates a temporary for xi*wi, the
compiler will/should generate the necessary code to
garbage collect any memory used by that temporary.

> > I would advise you to fix your code to
> > be standard-conforming.
> 
> Do you have a suggestion without introducing a memory leak?
> 

Let the compiler do its job?
Don't manipulate pointers in a non-conforming way?


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