[fortran, patch] Fix conflict detesction for VOLATILE attribute (PR30520)

Tobias Burnus burnus@net-b.de
Sun Jan 21 01:50:00 GMT 2007


:ADDPATCH fortran:

The following patch fixes the problems found by Steven Correll,
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/6ec0a526ea59aa94

The first one is an accepts-invalid. We didn't honour:

C1232 (R1221) If an actual argument is an array section or an
assumed-shape array, and the corresponding dummy argument has either the
VOLATILE or ASYNCHRONOUS attribute, that dummy argument shall be an
assumed-shape array.

C1233 (R1221) If an actual argument is a pointer array, and the
corresponding dummy argument has either the VOLATILE or ASYNCHRONOUS
attribute, that dummy argument shall be an assumed-shape array or a
pointer array.


The second one is an ifort bug, only.


The third one is an rejects-valid bug, which I only partially fixed.
(PR30522 contains the missing bits.)

Section 11.2.1 of the Fortran 2003 contains:
"The local identifier of an entity made accessible by a USE statement
... may be given the ASYNCHRONOUS or VOLATILE attribute."


The missing bits are:

- Using "volatile :: foo; volatile :: foo" gives no error for
use-associated variables
- For host associated variables, which are marked as volatile in the
host, using a VOLATILE statement (in the subroutine) gives an error.
- I didn't check the scope of the volatile attribute for host-associated
variables (the subroutine only [as expected] or the whole module/program
including all subroutines?)

Build and regression tested on x86_64-unknown-linux-gnu.
Ok for the trunk? (4.2 does not make sense as there is no VOLATILE.)

Tobias


2007-01-21  Tobias Burnus  <burnus@net-b.de>

    PR fortran/30520
    * interface.c (compare_actual_formal): Check conformance between
    actual and VOLATILE dummy arguments.
    * symbol.c (gfc_add_volatile): Allow setting of VOLATILE
    multiple times in different scopes.
    * decl.c (gfc_match_volatile): Search symbol in host association.

2007-01-21  Tobias Burnus  <burnus@net-b.de>

    PR fortran/30520
    * gfortran.dg/volatile8.f90: New argument conformance test.
    * gfortran.dg/volatile9.f90: New scope test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: volatile-conf.diff
Type: text/x-patch
Size: 6719 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070121/33f10850/attachment.bin>


More information about the Gcc-patches mailing list