[Fortran, patch] Give an error for empty CONTAINS statemens for F95/F2003 (PR29806)

Tobias Burnus burnus@net-b.de
Mon Nov 13 18:54:00 GMT 2006


:ADDPATCH fortran:

The Fortran 95 and 2003 standard prohibit to use CONTAINS without an
internal-subprogram or module-subprogram.
(See R1101, R210 and R1107 in the Fortran 2003 standard.)
All compilers I tested reject this.

As Erik pointed out, Fortran 2008 lifts this restriction (at least it is
lifted in 06-007r1.pdf); thus I didn't use gfc_error but allowed it in
STD_GNU.

I needed to change derived_function_interface_1.f90 as with -pedantic a
warning is given.

I did only add a check for the error, I didn't add a check whether no
error is given without -std=f95.
(This is implicitly tested by derived_function_interface_1.f90, which
only gives a warning.)

Build and regression-tested on x86_64-unknown-linux-gnu.

Tobias


fortran/
2006-11-13  Tobias Burnus  <burnus@net-b.de>

    * parse.c (parse_contained): Check for empty contains statement.

testsuite/
2006-11-13  Tobias Burnus  <burnus@net-b.de>

    * gfortran.dg/contains.f90: Added.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: contains.diff
Type: text/x-patch
Size: 2256 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061113/7ba71b88/attachment.bin>


More information about the Gcc-patches mailing list