[patch, fortran] Implement VOLATILE statement/attribute (PR 29601)

Tobias Burnus burnus@net-b.de
Sat Nov 4 19:44:00 GMT 2006


Hi,

As suggested by FX via IRC:

1. Changed error message to the standard(?) wording:
-                               "In the selected standard, the VOLATILE "
+                              "New in Fortran 2003: the VOLATILE "
                               "attribute is not allowed at %C")

(I was thinking before of using these words, but I found them misleading:
It *is* allowed in Fortran 2003, but not in Fortran 95. I had therefore
chosen the wordings of ALLOCATABLE. I now changed it as suggested
to match the standard. Comments?)

I also changed the unrelated message
-                                  "In the selected standard, the
ALLOCATABLE "
+                                  "New in Fortran 2003: the ALLOCATABLE "
                                   "attribute at %C is not allowed in a
TYPE "
                                   "definition") == FAILURE)
to be in line with the standard.


2. Added volatile4.f90 which shows that a volatile variable is not
optimized away.

Regression-tested on x86_64-unknown-linux-gnu (alias openSUSE Factory).
Further comments? Ok for the trunk?


Tobias


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

    fortran/29601
    * symbol.c (check_conflict, gfc_add_volatile): Add volatile support.
    * decl.c (match_attr_spec, gfc_match_volatile): Add volatile support.
    * gfortran.h (symbol_attribute): Add volatile_ to struct.
    * resolve.c (was_declared): Add volatile support.
    * trans-decl.c (gfc_finish_var_decl): Add volatile support.
    * match.h: Declare gfc_match_volatile.
    * parse.c (decode_statement): Recognize volatile.


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

    fortran/29601
    * volatile.f90: Add.
    * volatile2.f90: Add.
    * volatile3.f90: Add.
    * volatile4.f90: Add.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: volatile3.diff
Type: text/x-patch
Size: 12078 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061104/acb0941d/attachment.bin>


More information about the Gcc-patches mailing list