[patch, fortran] Don't apply SAVE attribute to function results

Daniel Franke franke.daniel@gmail.com
Sat Jan 3 18:00:00 GMT 2009


Hi all.

The SAVE attribute shouldn't be applied to function results (posted on c.l.f 
by James Van Buskirk):

$> cat save-result.f90
  FUNCTION f() RESULT (g)
    INTEGER :: g
    SAVE
    g = 42
  END FUNCTION

$> gfortran-svn -c save-result.f90
save-result.f90:1.25:                              

 function f(x) result (g)
                         1
Error: RESULT attribute conflicts with SAVE attribute in 'g' at (1)


Regression tested on i686-pc-linux-gnu. The patch should qualify as obvious. 
I'll commit within 48h if no one objects.

Regards

	Daniel


gcc/fortran:
2009-01-03  Daniel Franke  <franke.daniel@gmail.com>

	* symbol.c (save_symbol): Don't SAVE function results.

gcc/testsuite:
2009-01-03  Daniel Franke  <franke.daniel@gmail.com>

	* gfortran.dg/func_result_4.f90: New.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: saved-func-result.diff
Type: text/x-patch
Size: 827 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090103/ead359db/attachment.bin>


More information about the Fortran mailing list