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

Tobias Burnus burnus@net-b.de
Tue Jan 30 19:38:00 GMT 2007


Hi,

Jerry DeLisle schrieb:
> See wording here:
> Tobias Burnus wrote:
>>> !   /* TODO: The following allows multiple VOLATILE statements for
>>> !      use-associated variables and it prevents setting VOLATILE for
>>> a host-
>>> !      associated variable which is already marked as VOLATILE in
>>> the host.  */
> I did not go back and look at the rest of the thread to see if you
> fixed this already.
Well, I'm note sure what you mean by this. I added this TODO (which is
PR30522) as I didn't see how I could easily fix it.

The patch fixes (PR30520):
- Check for contrains C1232 (R1221) and C1233 (R1221) [This is fully fixed]
- Allow use-associated variable to be marked VOLATILE [This is fully fixed]
- Allow use-associated variable which are already VOLATILE to be marked
as VOLATILE again [This is allows for a rejects-valid, see below]

It does not touch (PR30522):
- Host-associated cannot be marked VOLATILE, if they are already marked
such (rejects valid) [no change]

It causes the following accepts-invalid (PR30522):
- Declare use-associated VOLATILE multiple times
(before marking them VOLATILE once was rejected)

I think this patch is an improvement even though it does not fix all the
rejects-valid cases and creates a accepts-invalid.
Thus I would like to get this checked in as a first step (but see below,
after the "* * *").

The current check is:

!   if (check_used (attr, name, where))
!     return FAILURE;
!   if (attr->volatile_)

That is: Reject if use associated or already marked volatile

Current patch:
! if (attr->volatile_ && !attr->use_assoc)
Reject, if already set as volatile, unless the variable is use associated.

 * * *

Other than that:

What is the best way to fix the remaining part, especially:

* Allowing to mark use- and host-associated variables as VOLATILE
with the condition
* Reject multiple VOLATILE in one scope.
I.e. one needs to track in which namespace volatile has been set.

I could add to "symbol_attribute":
  gfc_namespace *volatile_ns;
but somehow that does not look that elegant. Better suggestions?
Or is this indeed the right way to proceed?

Tobias



More information about the Fortran mailing list