public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/33818]  New: [Regression 4.3]  Bogus error "Variable 'str' is used at (1) before the ENTRY statement"
@ 2007-10-19 14:54 burnus at gcc dot gnu dot org
  2007-10-19 15:07 ` [Bug fortran/33818] " dominiq at lps dot ens dot fr
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-10-19 14:54 UTC (permalink / raw)
  To: gcc-bugs

Reduced from http://gcc.gnu.org/ml/fortran/2007-10/msg00280.html

The following gives the bogus error:

  write(lu,'(a)') 'UNIT '//UpperCase(UNAME(1))
                                             1
Error: Variable 'str' is used at (1) before the ENTRY statement in which it is
a parameter

subroutine ExportZMX(lu)
  implicit real(selected_real_kind(15)) (a-h,o-z)
  character(*),parameter :: UNAME(1:1)=(/'XXX'/)
  write(lu,'(a)') 'UNIT '//UpperCase(UNAME(1))
  entry ExportSEQ(lu)
contains
  function UpperCase(str) result(res)
    character(*),intent(in) :: str
    character(len(str)) res
    res=str
  end function
end


-- 
           Summary: [Regression 4.3]  Bogus error "Variable 'str' is used at
                    (1) before the ENTRY statement"
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          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=33818


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

* [Bug fortran/33818] [Regression 4.3]  Bogus error "Variable 'str' is used at (1) before the ENTRY statement"
  2007-10-19 14:54 [Bug fortran/33818] New: [Regression 4.3] Bogus error "Variable 'str' is used at (1) before the ENTRY statement" burnus at gcc dot gnu dot org
@ 2007-10-19 15:07 ` dominiq at lps dot ens dot fr
  2007-10-19 15:10 ` tobi at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-10-19 15:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dominiq at lps dot ens dot fr  2007-10-19 15:07 -------
The bug is not present in 4.2.2, and appeared before revision 129038.


-- 


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


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

* [Bug fortran/33818] [Regression 4.3]  Bogus error "Variable 'str' is used at (1) before the ENTRY statement"
  2007-10-19 14:54 [Bug fortran/33818] New: [Regression 4.3] Bogus error "Variable 'str' is used at (1) before the ENTRY statement" burnus at gcc dot gnu dot org
  2007-10-19 15:07 ` [Bug fortran/33818] " dominiq at lps dot ens dot fr
@ 2007-10-19 15:10 ` tobi at gcc dot gnu dot org
  2007-10-19 15:13 ` dominiq at lps dot ens dot fr
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tobi at gcc dot gnu dot org @ 2007-10-19 15:10 UTC (permalink / raw)
  To: gcc-bugs



-- 

tobi 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-10-19 15:10:44
               date|                            |


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


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

* [Bug fortran/33818] [Regression 4.3]  Bogus error "Variable 'str' is used at (1) before the ENTRY statement"
  2007-10-19 14:54 [Bug fortran/33818] New: [Regression 4.3] Bogus error "Variable 'str' is used at (1) before the ENTRY statement" burnus at gcc dot gnu dot org
  2007-10-19 15:07 ` [Bug fortran/33818] " dominiq at lps dot ens dot fr
  2007-10-19 15:10 ` tobi at gcc dot gnu dot org
@ 2007-10-19 15:13 ` dominiq at lps dot ens dot fr
  2007-10-19 15:15 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-10-19 15:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dominiq at lps dot ens dot fr  2007-10-19 15:12 -------
It is not in gcc version 4.3.0 20070713.


-- 


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


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

* [Bug fortran/33818] [Regression 4.3]  Bogus error "Variable 'str' is used at (1) before the ENTRY statement"
  2007-10-19 14:54 [Bug fortran/33818] New: [Regression 4.3] Bogus error "Variable 'str' is used at (1) before the ENTRY statement" burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-10-19 15:13 ` dominiq at lps dot ens dot fr
@ 2007-10-19 15:15 ` burnus at gcc dot gnu dot org
  2007-10-19 21:16 ` [Bug fortran/33818] [4.3 Regression] " burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-10-19 15:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-10-19 15:15 -------
Slightly further reduced test:

subroutine ExportZMX(lu)
  implicit none
  integer :: lu
  interface
    function UpperCase(str)
      character(*),intent(in) :: str
      character(len(str))     :: UpperCase ! Rejected
!     character(1)     :: UpperCase ! Works
    end function UpperCase
  end interface
  character, parameter :: UNAME ='X'
  write(lu,'(a)') 'UNIT '//UpperCase(UNAME) ! Rejected
!  write(lu,'(a)') UpperCase(UNAME) ! Works
  entry ExportSEQ(lu)
end


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |32834
              nThis|                            |


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


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

* [Bug fortran/33818] [4.3 Regression]  Bogus error "Variable 'str' is used at (1) before the ENTRY statement"
  2007-10-19 14:54 [Bug fortran/33818] New: [Regression 4.3] Bogus error "Variable 'str' is used at (1) before the ENTRY statement" burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-10-19 15:15 ` burnus at gcc dot gnu dot org
@ 2007-10-19 21:16 ` burnus at gcc dot gnu dot org
  2007-10-20  4:24 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-10-19 21:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-10-19 21:16 -------
I'm not completely sure which bug is triggered that, but the error occurs for
the expression
   character(len(str))     :: UpperCase

"str" is a dummy (of the interface function UpperCase) and despite being a
dummy it is not a dummy of the current entry function (which is "ExportZMX").

The check assumes: Dummy + not-dummy of current function => Dummy of another
Entry -> invalid.

The solution is to add a check whether the dummy in in the current name space
or not.

I could not find any bit in the patches which caused this, but my un-educated
guess would be http://gcc.gnu.org/viewcvs?view=rev&revision=127939 which added
some character substring fixes.

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 129495)
+++ gcc/fortran/resolve.c       (working copy)
@@ -3935,7 +3935,7 @@ resolve_variable (gfc_expr *e)
       bool seen;

       /* If the symbol is a dummy...  */
-      if (sym->attr.dummy)
+      if (sym->attr.dummy && sym->ns == gfc_current_ns)
        {
          entry = gfc_current_ns->entries;
          seen = false;
@@ -3952,7 +3952,7 @@ resolve_variable (gfc_expr *e)
          if (!seen)
            {
              if (specification_expr)
-               gfc_error ("Variable '%s',used in a specification expression, "
+               gfc_error ("Variable '%s', used in a specification expression,
"
                           "is referenced at %L before the ENTRY statement "
                           "in which it is a parameter",
                           sym->name, &cs_base->current->loc);


-- 


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


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

* [Bug fortran/33818] [4.3 Regression]  Bogus error "Variable 'str' is used at (1) before the ENTRY statement"
  2007-10-19 14:54 [Bug fortran/33818] New: [Regression 4.3] Bogus error "Variable 'str' is used at (1) before the ENTRY statement" burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-10-19 21:16 ` [Bug fortran/33818] [4.3 Regression] " burnus at gcc dot gnu dot org
@ 2007-10-20  4:24 ` patchapp at dberlin dot org
  2007-10-20 11:34 ` burnus at gcc dot gnu dot org
  2007-10-20 11:39 ` burnus at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: patchapp at dberlin dot org @ 2007-10-20  4:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from patchapp at dberlin dot org  2007-10-20 04:24 -------
Subject: Bug number PR 33818

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-10/msg01188.html


-- 


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


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

* [Bug fortran/33818] [4.3 Regression]  Bogus error "Variable 'str' is used at (1) before the ENTRY statement"
  2007-10-19 14:54 [Bug fortran/33818] New: [Regression 4.3] Bogus error "Variable 'str' is used at (1) before the ENTRY statement" burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-10-20  4:24 ` patchapp at dberlin dot org
@ 2007-10-20 11:34 ` burnus at gcc dot gnu dot org
  2007-10-20 11:39 ` burnus at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-10-20 11:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from burnus at gcc dot gnu dot org  2007-10-20 11:34 -------
Subject: Bug 33818

Author: burnus
Date: Sat Oct 20 11:34:21 2007
New Revision: 129510

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129510
Log:
2007-10-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/33818
        * resolve.c (resolve_variable): Check that symbol is in the same
        namespace as the entry function.

2007-10-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/33818
        * gfortran.dg/entry_dummy_ref_3.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/entry_dummy_ref_3.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/33818] [4.3 Regression]  Bogus error "Variable 'str' is used at (1) before the ENTRY statement"
  2007-10-19 14:54 [Bug fortran/33818] New: [Regression 4.3] Bogus error "Variable 'str' is used at (1) before the ENTRY statement" burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-10-20 11:34 ` burnus at gcc dot gnu dot org
@ 2007-10-20 11:39 ` burnus at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-10-20 11:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2007-10-20 11:39 -------
FIXED on the trunk (4.3.0).


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2007-10-20 11:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-19 14:54 [Bug fortran/33818] New: [Regression 4.3] Bogus error "Variable 'str' is used at (1) before the ENTRY statement" burnus at gcc dot gnu dot org
2007-10-19 15:07 ` [Bug fortran/33818] " dominiq at lps dot ens dot fr
2007-10-19 15:10 ` tobi at gcc dot gnu dot org
2007-10-19 15:13 ` dominiq at lps dot ens dot fr
2007-10-19 15:15 ` burnus at gcc dot gnu dot org
2007-10-19 21:16 ` [Bug fortran/33818] [4.3 Regression] " burnus at gcc dot gnu dot org
2007-10-20  4:24 ` patchapp at dberlin dot org
2007-10-20 11:34 ` burnus at gcc dot gnu dot org
2007-10-20 11:39 ` 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).