[gfortran,patch] Fix multiple evaluation of arg for REPEAT intrinsic

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Feb 4 20:57:00 GMT 2007


On Sun, Feb 04, 2007 at 01:43:01PM +0100, FX Coudert wrote:
> :ADDPATCH fortran:
> 
> Attached patch fixes PR30611, which is both a wrong-code and a  
> diagnostic bug, by:
>   - not evaluating multiple times the NCOPIES argument of the REPEAT  
> intrinsic
>   - generate code to check that NCOPIES is not negative, instead of  
> doing this in the library; this is cleaner, more easily optimised  
> away, and is done *before* we allocate temporary space, which  
> prevents us allocating negative amount of memory (which, even on non- 
> legal code, is not a very good diagnostic)
> 
> Bootstrapped on i686-linux, regtesting under progress. Comes with a  
> testcase. OK for mainline and 4.2?
> 

OK with some minor fixes.


+  arglist = gfc_chainon_list (arglist, TREE_VALUE(args));
+  arglist = gfc_chainon_list (arglist, TREE_VALUE(TREE_CHAIN(args)));

You're missing whitespace.  These should be

+  arglist = gfc_chainon_list (arglist, TREE_VALUE (args));
+  arglist = gfc_chainon_list (arglist, TREE_VALUE (TREE_CHAIN (args)));

-- 
Steve



More information about the Fortran mailing list