This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hi Tobias,

First, thanks for taking care of this. I think you're getting a nice tour of the Fortran front-end :)

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")

For the error message, I'd be OK with Steve changing all "New in Fortran 2003" into "Fortran 2003". Also, I think it will have to be the subject of another follow-up patch, because we don't want to make it too hard to get this VOLATILE patch in. So, use either "New in Fortran 2003" or "Fortran 2003", and we'll do the overall change later.

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


2006-11-04 Tobias Burnus <>

* 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.

I can think of at least one thing you've missed: modules. This is all in module.c, grep for AB_TARGET to see how attributes are handled, and you can most probably handle it the same way (it should only be a few more lines to change). If you could also add another optimized- out variable, coming from a module where it is specified VOLATILE, in your testcase, that would be nice.

Also, making grep-ing TARGET in gcc/fortran/ to make sure there's nothing else you and I are forgetting would be nice.

Thanks again,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]