public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30520]  New: Conflics checking of VOLATILE attribute needs improvement
@ 2007-01-20 22:24 burnus at gcc dot gnu dot org
  2007-01-20 22:29 ` [Bug fortran/30520] " burnus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-01-20 22:24 UTC (permalink / raw)
  To: gcc-bugs

From
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/6ec0a526ea59aa94/

gfortran accepts in the three test cases in "1.", which violate C1232 (R1221)
and C1233 (R1221).

Fourth test case (should pass as dummy is pointer array, passes with gfortran)
 subroutine s10()
    implicit none
    interface
      subroutine sub10(dummy10)
        integer, volatile, dimension(:),pointer :: dummy10
      end subroutine sub10
    end interface
    integer, dimension(:), pointer :: a
    call sub10(a)
  end subroutine s10


"3." This is valid fortran and should be accepted.

Patch for "3.":

Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c        (Revision 121011)
+++ gcc/fortran/symbol.c        (Arbeitskopie)
@@ -877,8 +877,8 @@
 gfc_add_volatile (symbol_attribute * attr, const char *name, locus * where)
 {

-  if (check_used (attr, name, where))
-    return FAILURE;
+  /* No check_used needed as the volatile attribute is allowed for
+     use-associated entities.  */

   if (attr->volatile_)
     {



Early draft for item "1.". The following does not work properly as array
sections are not detected (first test case) and test case four is also
rejected.

*** gcc/fortran/interface.c     (revision 121011)
--- gcc/fortran/interface.c     (working copy)
*************** compare_actual_formal (gfc_actual_arglis
*** 1417,1422 ****
--- 1417,1449 ----
          return 0;
        }

+       /* C1232 (R1221) For an actual argument which is a array sections or
+          an assumed-shaped array, the dummy argument shall be an assumed-
+          shaped array, if the dummy argument has the VOLATILE attribute.
+          C1233 (R1221) Similarly for actual pointer arrays: The VOLATILE
+          dummy argument shall be an assumed-shaped array or pointer array. 
*/
+
+       if (((a->expr->symtree->n.sym->as
+             && a->expr->symtree->n.sym->as->type == AS_ASSUMED_SHAPE)
+          ||(a->expr->symtree->n.sym->as && a->expr->symtree->n.sym->as->type
== AR_SECTION))
+           && f->sym->attr.volatile_
+           && !(f->sym->as && f->sym->as->type == AS_ASSUMED_SHAPE))
+       {
+         if (where)
+           gfc_error ("Assumed-shaped or array-section actual argument at "
+                      "%L is incompatible with the non-assumed-shaped "
+                      "dummy argument '%s' due to VOLATILE attribute",
+                      &a->expr->where,f->sym->name);
+         return 0;
+       }
+


-- 
           Summary: Conflics checking of VOLATILE attribute needs
                    improvement
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid, accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug fortran/30520] Conflics checking of VOLATILE attribute needs improvement
  2007-01-20 22:24 [Bug fortran/30520] New: Conflics checking of VOLATILE attribute needs improvement burnus at gcc dot gnu dot org
@ 2007-01-20 22:29 ` burnus at gcc dot gnu dot org
  2007-01-21  0:23 ` brooks at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-01-20 22:29 UTC (permalink / raw)
  To: gcc-bugs



-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |burnus at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-01-20 22:29:11
               date|                            |


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


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

* [Bug fortran/30520] Conflics checking of VOLATILE attribute needs improvement
  2007-01-20 22:24 [Bug fortran/30520] New: Conflics checking of VOLATILE attribute needs improvement burnus at gcc dot gnu dot org
  2007-01-20 22:29 ` [Bug fortran/30520] " burnus at gcc dot gnu dot org
@ 2007-01-21  0:23 ` brooks at gcc dot gnu dot org
  2007-01-21  1:55 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: brooks at gcc dot gnu dot org @ 2007-01-21  0:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from brooks at gcc dot gnu dot org  2007-01-21 00:23 -------
I would suggest that your comment about "No check_used needed" should reference
11.2.1 of the F2003 standard.  The relevant language is towards the end (p252,
lines 30-34 of the page): "The local identifier of an entity made accessible by
a USE statement ... may be given the ASYNCHRONOUS or VOLATILE attribute."

There is no other restriction on this that would prevent this from applying to
an entity that already has the relevant ASYNCHRONOUS or VOLATILE attribute.


-- 

brooks at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brooks at gcc dot gnu dot
                   |                            |org


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


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

* [Bug fortran/30520] Conflics checking of VOLATILE attribute needs improvement
  2007-01-20 22:24 [Bug fortran/30520] New: Conflics checking of VOLATILE attribute needs improvement burnus at gcc dot gnu dot org
  2007-01-20 22:29 ` [Bug fortran/30520] " burnus at gcc dot gnu dot org
  2007-01-21  0:23 ` brooks at gcc dot gnu dot org
@ 2007-01-21  1:55 ` patchapp at dberlin dot org
  2007-01-31  9:20 ` burnus at gcc dot gnu dot org
  2007-01-31  9:20 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: patchapp at dberlin dot org @ 2007-01-21  1:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2007-01-21 01:55 -------
Subject: Bug number PR30520

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/2007-01/msg01703.html


-- 


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


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

* [Bug fortran/30520] Conflics checking of VOLATILE attribute needs improvement
  2007-01-20 22:24 [Bug fortran/30520] New: Conflics checking of VOLATILE attribute needs improvement burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-01-21  1:55 ` patchapp at dberlin dot org
@ 2007-01-31  9:20 ` burnus at gcc dot gnu dot org
  2007-01-31  9:20 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-01-31  9:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-01-31 09:18 -------
Subject: Bug 30520

Author: burnus
Date: Wed Jan 31 09:18:33 2007
New Revision: 121379

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121379
Log:
fortran/
2007-01-31  Tobias Burnus  <burnus@net-b.de>

       PR fortran/30520
       * interface.c (compare_actual_formal): Check conformance between
         actual and VOLATILE dummy arguments.
       * symbol.c (gfc_add_volatile): Allow setting of VOLATILE
         multiple times in different scopes.
       * decl.c (gfc_match_volatile): Search symbol in host association.

testsuite/
2007-01-31  Tobias Burnus  <burnus@net-b.de>

       PR fortran/30520
       * gfortran.dg/volatile8.f90: New argument conformance test.
       * gfortran.dg/volatile9.f90: New scope test.


Added:
    trunk/gcc/testsuite/gfortran.dg/volatile8.f90
    trunk/gcc/testsuite/gfortran.dg/volatile9.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/interface.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/30520] Conflics checking of VOLATILE attribute needs improvement
  2007-01-20 22:24 [Bug fortran/30520] New: Conflics checking of VOLATILE attribute needs improvement burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-01-31  9:20 ` burnus at gcc dot gnu dot org
@ 2007-01-31  9:20 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-01-31  9:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-01-31 09:20 -------
FIXED in gcc 4.3 (note: VOLATILE is not in 4.2).
See PR 30522 for the missing parts.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2007-01-31  9:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-20 22:24 [Bug fortran/30520] New: Conflics checking of VOLATILE attribute needs improvement burnus at gcc dot gnu dot org
2007-01-20 22:29 ` [Bug fortran/30520] " burnus at gcc dot gnu dot org
2007-01-21  0:23 ` brooks at gcc dot gnu dot org
2007-01-21  1:55 ` patchapp at dberlin dot org
2007-01-31  9:20 ` burnus at gcc dot gnu dot org
2007-01-31  9:20 ` 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).