public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/30520]  New: Conflics checking of VOLATILE attribute needs improvement
Date: Sat, 20 Jan 2007 22:24:00 -0000	[thread overview]
Message-ID: <bug-30520-13404@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2007-01-20 22:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-20 22:24 burnus at gcc dot gnu dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30520-13404@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).