Bug 29601

Summary: VOLATILE attribute and statement
Product: gcc Reporter: Francois-Xavier Coudert <fxcoudert>
Component: fortranAssignee: Tobias Burnus <burnus>
Status: RESOLVED FIXED    
Severity: enhancement CC: burnus, gcc-bugs
Priority: P3    
Version: 4.3.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2006-10-30 21:23:05
Bug Depends on:    
Bug Blocks: 20585    

Description Francois-Xavier Coudert 2006-10-26 08:25:04 UTC
5.2.15   VOLATILE statement
R548  volatile-stmt  is  VOLATILE [ :: ] object-name-list
The VOLATILE statement specifies the VOLATILE attribute (5.1.2.16) for a list of objects.



5.1.2.16   VOLATILE attribute
The VOLATILE attribute specifies that an object may be referenced, defined, or become undefined, by means not specified by the program.
An object may have the VOLATILE attribute in a particular scoping unit without necessarily having it in other scoping units. If an object has the VOLATILE attribute, then all of its subobjects also have the VOLATILE attribute.

      NOTE 5.21
      The Fortran processor should use the most recent definition of a volatile object when a value is required. Likewise, it should make the most recent Fortran definition available. It is the programmer's responsibility to manage the interactions with the non-Fortran processes.

A pointer with the VOLATILE attribute may additionally have its association status and array bounds changed by means not specified by the program.

      NOTE 5.22
      If the target of a pointer is referenced, defined, or becomes undefined, by means not specified by the program, while the pointer is associated with the target, then the pointer shall have the VOLATILE attribute. Usually a pointer should have the VOLATILE attribute if its target has the VOLATILE attribute. Similarly, all members of an EQUIVALENCE group should have the VOLATILE attribute if one member has the VOLATILE attribute.

An allocatable object with the VOLATILE attribute may additionally have its allocation status, dynamic type and type parameters, and array bounds changed by means not specified by the program.
Comment 1 Tobias Burnus 2006-10-30 21:23:05 UTC
Taking this bug.
Comment 2 patchapp@dberlin.org 2006-10-31 00:25:09 UTC
Subject: Bug number PR 29601

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01601.html
Comment 3 Tobias Burnus 2006-11-07 13:28:09 UTC
Subject: Bug 29601

Author: burnus
Date: Tue Nov  7 13:27:53 2006
New Revision: 118545

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118545
Log:
fortran/
2006-11-06  Tobias Burnus  <burnus@net-b.de>

    PR 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.
    * modules.c (ab_attribute, attr_bits, mio_symbol_attribute):
      Add volatile support.
    * dump-parse-tree.c (gfc_show_attr): Add volatile support.


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

    PR fortran/29601
    * gfortran.dg/volatile.f90: Add.
    * gfortran.dg/volatile2.f90: Add.
    * gfortran.dg/volatile3.f90: Add.
    * gfortran.dg/volatile4.f90: Add.
    * gfortran.dg/volatile5.f90: Add.
    * gfortran.dg/volatile6.f90: Add.
    * gfortran.dg/volatile7.f90: Add.


Added:
    trunk/gcc/testsuite/gfortran.dg/volatile.f90
    trunk/gcc/testsuite/gfortran.dg/volatile2.f90
    trunk/gcc/testsuite/gfortran.dg/volatile3.f90
    trunk/gcc/testsuite/gfortran.dg/volatile4.f90
    trunk/gcc/testsuite/gfortran.dg/volatile5.f90
    trunk/gcc/testsuite/gfortran.dg/volatile6.f90
    trunk/gcc/testsuite/gfortran.dg/volatile7.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/dump-parse-tree.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/match.h
    trunk/gcc/fortran/module.c
    trunk/gcc/fortran/parse.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Tobias Burnus 2006-11-07 13:32:05 UTC
Mark as fixed.