public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30733]  New: VOLATILE: Missed optimization - attribute not restricted to scope
@ 2007-02-08  9:40 burnus at gcc dot gnu dot org
  2007-02-11 21:02 ` [Bug fortran/30733] " tkoenig at gcc dot gnu dot org
  2009-07-02 15:07 ` burnus at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-08  9:40 UTC (permalink / raw)
  To: gcc-bugs

+++ This bug was initially created as a clone of Bug #30522 +++

Setting the VOLATILE attribute to a host- or use-associated variable currently
marks the variable everywhere as VOLATILE. The attribute should be, however,
restricted to the scope. (This is a missed optimization only.)

Possible implementation:

decl.c: gfc_match_volatile

        case MATCH_YES:
          /* If the use- or host-associated symbol is not volatile, we
             clone it.  */
          if (!sym->attr.volatile_ && sym->ns != gfc_current_ns)
            {
/* note somewhere that in this namespace VOLATILE is needed, e.g. by cloning
the variable here and setting below the attribute only to the cloned variable.
And then put a check in trans-decl.c in e.g. gfc_generate_function_code near
generate_local_vars to actually mark this variable as volatile; be careful that
the variable should be "external volatile" not a new local variable.
*/
            }

          if (gfc_add_volatile (&sym->attr, sym->name, &gfc_current_locus)

Test case: See PR30522's volatile10.f90 (search for TODO).

Maybe the fact that -fdump-tree-original does not show the VOLATILE attribute
for module variables could be solved as collateral damage.


-- 
           Summary: VOLATILE: Missed optimization - attribute not restricted
                    to scope
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
 BugsThisDependsOn: 30522


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30733


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/30733] VOLATILE: Missed optimization - attribute not restricted to scope
  2007-02-08  9:40 [Bug fortran/30733] New: VOLATILE: Missed optimization - attribute not restricted to scope burnus at gcc dot gnu dot org
@ 2007-02-11 21:02 ` tkoenig at gcc dot gnu dot org
  2009-07-02 15:07 ` burnus at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-02-11 21:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tkoenig at gcc dot gnu dot org  2007-02-11 21:02 -------
Confirmed.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-02-11 21:02:02
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30733


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/30733] VOLATILE: Missed optimization - attribute not restricted to scope
  2007-02-08  9:40 [Bug fortran/30733] New: VOLATILE: Missed optimization - attribute not restricted to scope burnus at gcc dot gnu dot org
  2007-02-11 21:02 ` [Bug fortran/30733] " tkoenig at gcc dot gnu dot org
@ 2009-07-02 15:07 ` burnus at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-07-02 15:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2009-07-02 15:07 -------
Restricting can be done via casting to volatile - then it is only 
  *(volatile int *)&i
That needs then to be applies in all expressions.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30733


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-02 15:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-08  9:40 [Bug fortran/30733] New: VOLATILE: Missed optimization - attribute not restricted to scope burnus at gcc dot gnu dot org
2007-02-11 21:02 ` [Bug fortran/30733] " tkoenig at gcc dot gnu dot org
2009-07-02 15:07 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).