[patch, fortran] Fix PR 30235

Brooks Moses brooks.moses@codesourcery.com
Sun Dec 17 19:10:00 GMT 2006


In interface.c, when compare_actual_formal() has finished checking all 
of the actual arguments, it then loops through any remaining formal 
arguments to confirm that they are all optional.  When doing this, it 
looks at f->sym->attr.optional.  However, if the formal argument is an 
alternate return, then f->sym is NULL, and this causes a segfault ICE.

The attached patch adds a check for this, approximately copied from the 
checks a bit earlier in the function when compare_actual_formal() is 
checking actual arguments against formal ones.

The testcase is derived from the example program that I attached to the 
PR when I filed it.

--------------------------------------------------------------
2006-12-17  Brooks Moses  <brooks.moses@codesourcery.com>

	PR 30235
	* interface.c (compare_actual_formal): check for
	alternate returns when iterating over non-present
	arguments.

--------------------------------------------------------------
2006-12-17  Brooks Moses  <brooks.moses@codesourcery.com>

	PR 30235
	* gfortran.dg/altreturn_2.f90: new test.

--------------------------------------------------------------

Tested on i686_pc_linux_gnu; everything works, except that without the 
interface.c patch the failures on the new test don't seem to cycle 
through the -O1, O2, etc. flags like they should; instead I only get this:

   FAIL: gfortran.dg/altreturn_2.f90  -O  (internal compiler error)
   FAIL: gfortran.dg/altreturn_2.f90  -O   (test for errors, line 3)
   FAIL: gfortran.dg/altreturn_2.f90  -O  (test for excess errors)

Any idea what I'm missing?

Ok for trunk, once I fix that testsuite problem?

Should this be backported to 4.2 (and, if so, on what sort of timeschedule)?

- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: altreturn2.diff
Type: text/x-patch
Size: 917 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061217/490f13b1/attachment.bin>


More information about the Fortran mailing list