public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51991] New: Wrong error message with variables named "SAVE*"
@ 2012-01-25 10:26 bardeau at iram dot fr
  2012-01-25 11:06 ` [Bug fortran/51991] " burnus at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: bardeau at iram dot fr @ 2012-01-25 10:26 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51991
           Summary: Wrong error message with variables named "SAVE*"
    Classification: Unclassified
           Product: gcc
           Version: fortran-dev
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bardeau@iram.fr


Created attachment 26455
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26455
This file raises an error, but with wrong message

Hello,

in the attached you will find a subroutine which raises an error (on purpose).

While one expect the following message:

gfortran-error.f90:11.11:

    savej = a%j
               1
Error: 'j' at (1) is not a member of the 'mytyp' structure


gfortran (4.7.0 20111119) raises:


gfortran-error.f90:11.9:

    savej = a%j
         1
Error: Syntax error in SAVE statement at (1)


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

* [Bug fortran/51991] Wrong error message with variables named "SAVE*"
  2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
@ 2012-01-25 11:06 ` burnus at gcc dot gnu.org
  2012-01-25 11:17 ` dominiq at lps dot ens.fr
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-25 11:06 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org
            Version|fortran-dev                 |4.7.0

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-25 10:46:23 UTC ---
Works for me:

With GCC 4.1, 4.3, 4.4, 4.5, 4.6 and 4.7 I get the expected diagnostic. For
4.7, I tried
  4.7.0 20120118 [trunk revision 183273]
and
  4.7.0 20120125 Rev. 183512 (with some unrelated patches)
and all gave exactly the same error:

    j = a%j
           1
Error: 'j' at (1) is not a member of the 'mytyp' structure


I wonder why it does not work for you with GCC 4.7 2011-11-19.

I do not recall any issue, but it might have been some intermediate glitch.
Does a newer 4.7 work? And which platform are you on? It could also be some
target-dependent bug.


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

* [Bug fortran/51991] Wrong error message with variables named "SAVE*"
  2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
  2012-01-25 11:06 ` [Bug fortran/51991] " burnus at gcc dot gnu.org
@ 2012-01-25 11:17 ` dominiq at lps dot ens.fr
  2012-01-25 12:56 ` bardeau at iram dot fr
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-01-25 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-25
     Ever Confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-01-25 11:09:19 UTC ---
It looks like the test should be

module mymod
  type :: mytyp
    integer :: i
  end type mytyp
contains
  subroutine mysub
    implicit none
    type(mytyp) :: a
    integer :: i,j
    i = a%i
    savej = a%j
  end subroutine mysub
end module mymod

and for the variant above I confirm that the error is 

pr51991_db.f90:11.9:

    savej = a%j
         1
Error: Syntax error in SAVE statement at (1)

for gfortran 4.4.6, 4.5.3, 4.6.3, and 4.7.0 (trunk r183455).


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

* [Bug fortran/51991] Wrong error message with variables named "SAVE*"
  2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
  2012-01-25 11:06 ` [Bug fortran/51991] " burnus at gcc dot gnu.org
  2012-01-25 11:17 ` dominiq at lps dot ens.fr
@ 2012-01-25 12:56 ` bardeau at iram dot fr
  2012-01-25 13:17 ` dominiq at lps dot ens.fr
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bardeau at iram dot fr @ 2012-01-25 12:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Sebastien Bardeau <bardeau at iram dot fr> 2012-01-25 12:39:59 UTC ---
(In reply to comment #1)
> I wonder why it does not work for you with GCC 4.7 2011-11-19.
> 
> I do not recall any issue, but it might have been some intermediate glitch.
> Does a newer 4.7 work? And which platform are you on? It could also be some
> target-dependent bug.

Same problem with the nightly version under x86_64-unknown-linux-gnu:

pctcp27 Scripts/Fortran> gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/bardeau/Softs/gcc-4.7.0-20120125/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk-source/gcc/configure
--enable-languages=c,c++,fortran --enable-checking=release --disable-bootstrap
--disable-libmudflap --enable-libgomp --enable-lto --enable-gold
--with-plugin-ld=/usr/bin/gold --prefix=/usr/local/gcc-trunk
Thread model: posix
gcc version 4.7.0 20120125 (experimental) [trunk revision 183507] (GCC)

And also with an old gfortran I have on my system:
pctcp27 Scripts/Fortran> gfortran44 -v
Using built-in specs.
Target: x86_64-redhat-linux6E
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-languages=c,c++,fortran
--disable-libgcj
--with-mpfr=/builddir/build/BUILD/gcc-4.4.0-20090514/obj-x86_64-redhat-linux6E/mpfr-install/
--with-ppl=/builddir/build/BUILD/gcc-4.4.0-20090514/obj-x86_64-redhat-linux6E/ppl-install
--with-cloog=/builddir/build/BUILD/gcc-4.4.0-20090514/obj-x86_64-redhat-linux6E/cloog-install
--with-tune=generic --with-arch_32=i586 --build=x86_64-redhat-linux6E
Thread model: posix
gcc version 4.4.0 20090514 (Red Hat 4.4.0-6) (GCC)



(In reply to comment #2)
> It looks like the test should be
> 
> and for the variant above I confirm that the error is 

Well, ok, the 2 tests are just different and should raise different errors.


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

* [Bug fortran/51991] Wrong error message with variables named "SAVE*"
  2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
                   ` (2 preceding siblings ...)
  2012-01-25 12:56 ` bardeau at iram dot fr
@ 2012-01-25 13:17 ` dominiq at lps dot ens.fr
  2012-01-25 13:32 ` bardeau at iram dot fr
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-01-25 13:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-01-25 12:59:39 UTC ---
> Well, ok, the 2 tests are just different and should raise different errors.

Your original test gives

pr51991.f90:11.11:

    j = a%j
           1
Error: 'j' at (1) is not a member of the 'mytyp' structure

for 4.4, 4.5, 4.6, and trunk.


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

* [Bug fortran/51991] Wrong error message with variables named "SAVE*"
  2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
                   ` (3 preceding siblings ...)
  2012-01-25 13:17 ` dominiq at lps dot ens.fr
@ 2012-01-25 13:32 ` bardeau at iram dot fr
  2012-01-25 13:37 ` bardeau at iram dot fr
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bardeau at iram dot fr @ 2012-01-25 13:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Sebastien Bardeau <bardeau at iram dot fr> 2012-01-25 13:19:21 UTC ---
(In reply to comment #4)
> > Well, ok, the 2 tests are just different and should raise different errors.
> 
> Your original test gives
> 
> pr51991.f90:11.11:
> 
>     j = a%j
>            1
> Error: 'j' at (1) is not a member of the 'mytyp' structure
> 
> for 4.4, 4.5, 4.6, and trunk.


Ok. Not sure what goes wrong, but I do observe the error reported in my first
message with gfortran trunk (I am using gfortran precompiled binaries, and
dependencies compiled by myself a while ago). I run gfortran under Scientific
Linux 5.5.

home/bardeau> uname -a
Linux pctcp27 2.6.18-194.8.1.el5 #1 SMP Thu Jul 1 16:05:53 EDT 2010 x86_64
x86_64 x86_64 GNU/Linux
Scripts/Fortran> gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/bardeau/Softs/gcc-4.7.0-20120125/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk-source/gcc/configure
--enable-languages=c,c++,fortran --enable-checking=release --disable-bootstrap
--disable-libmudflap --enable-libgomp --enable-lto --enable-gold
--with-plugin-ld=/usr/bin/gold --prefix=/usr/local/gcc-trunk
Thread model: posix
gcc version 4.7.0 20120125 (experimental) [trunk revision 183507] (GCC)
Scripts/Fortran> cat gfortran-error1.f90
module mymod
  type :: mytyp
    integer :: i
  end type mytyp
contains
  subroutine mysub
    implicit none
    type(mytyp) :: a
    integer :: savei,savej
    savei = a%i
    savej = a%j
  end subroutine mysub
end module mymod
Scripts/Fortran> gfortran -c gfortran-error1.f90
gfortran-error1.f90:11.9:

    savej = a%j
         1
Error: Syntax error in SAVE statement at (1)


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

* [Bug fortran/51991] Wrong error message with variables named "SAVE*"
  2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
                   ` (4 preceding siblings ...)
  2012-01-25 13:32 ` bardeau at iram dot fr
@ 2012-01-25 13:37 ` bardeau at iram dot fr
  2012-01-25 14:09 ` dominiq at lps dot ens.fr
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bardeau at iram dot fr @ 2012-01-25 13:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Sebastien Bardeau <bardeau at iram dot fr> 2012-01-25 13:29:41 UTC ---
Created attachment 26461
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26461
Correct version this time.

Sorry, previous version had no problem. The symptom is the following: whatever
if "savej" is declared or not, the line "savej = %j" raise a wrong error
message.


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

* [Bug fortran/51991] Wrong error message with variables named "SAVE*"
  2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
                   ` (5 preceding siblings ...)
  2012-01-25 13:37 ` bardeau at iram dot fr
@ 2012-01-25 14:09 ` dominiq at lps dot ens.fr
  2012-01-25 14:11 ` bardeau at iram dot fr
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-01-25 14:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-01-25 13:32:34 UTC ---
> ... I do observe the error reported in my first message with gfortran trunk ...

I am quite confused: in order to have 'savej' in the error message, you must
have it in the source, i.e., use the tests in comment #2 or in #5. 

IIUC in free-form spaces are required and 'savej' should not be parsed as 'save
j', so the error message seems bogus (Tobias?).


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

* [Bug fortran/51991] Wrong error message with variables named "SAVE*"
  2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
                   ` (6 preceding siblings ...)
  2012-01-25 14:09 ` dominiq at lps dot ens.fr
@ 2012-01-25 14:11 ` bardeau at iram dot fr
  2012-01-25 16:39 ` kargl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bardeau at iram dot fr @ 2012-01-25 14:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Sebastien Bardeau <bardeau at iram dot fr> 2012-01-25 13:36:51 UTC ---
(In reply to comment #7)
> > ... I do observe the error reported in my first message with gfortran trunk ...
> 
> I am quite confused: in order to have 'savej' in the error message, you must
> have it in the source, i.e., use the tests in comment #2 or in #5. 

Yes, sorry, I first uploaded the wrong version of my test file (I made more
tests between the file selection in the form and the upload).

The new attachment should show the errors now.


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

* [Bug fortran/51991] Wrong error message with variables named "SAVE*"
  2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
                   ` (7 preceding siblings ...)
  2012-01-25 14:11 ` bardeau at iram dot fr
@ 2012-01-25 16:39 ` kargl at gcc dot gnu.org
  2012-02-08 10:39 ` bardeau at iram dot fr
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: kargl at gcc dot gnu.org @ 2012-01-25 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #9 from kargl at gcc dot gnu.org 2012-01-25 16:16:30 UTC ---
Index: decl.c
===================================================================
--- decl.c      (revision 183295)
+++ decl.c      (working copy)
@@ -6997,8 +6997,13 @@ gfc_match_save (void)
   return MATCH_YES;

 syntax:
-  gfc_error ("Syntax error in SAVE statement at %C");
-  return MATCH_ERROR;
+  if (gfc_current_ns->seen_save)
+    {
+      gfc_error ("Syntax error in SAVE statement at %C");
+      return MATCH_ERROR;
+    }
+   else
+      return MATCH_NO;
 }


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

* [Bug fortran/51991] Wrong error message with variables named "SAVE*"
  2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
                   ` (8 preceding siblings ...)
  2012-01-25 16:39 ` kargl at gcc dot gnu.org
@ 2012-02-08 10:39 ` bardeau at iram dot fr
  2012-02-08 16:15 ` sgk at troutmask dot apl.washington.edu
  2012-02-08 16:23 ` bardeau at iram dot fr
  11 siblings, 0 replies; 13+ messages in thread
From: bardeau at iram dot fr @ 2012-02-08 10:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Sebastien Bardeau <bardeau at iram dot fr> 2012-02-08 10:38:42 UTC ---
I checked the gfortran trunk revision 183991 and the "bug" does not seem to be
fixed. I can also add that the DATA*-named variables give also erroneous
messages.

gfortran -v:

Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/bardeau/Softs/gcc-4.7.0-20120208/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk-source/gcc/configure
--enable-languages=c,c++,fortran --enable-checking=release --disable-bootstrap
--disable-libmudflap --enable-libgomp --enable-lto --enable-gold
--with-plugin-ld=/usr/bin/gold --prefix=/usr/local/gcc-trunk
Thread model: posix
gcc version 4.7.0 20120208 (experimental) [trunk revision 183991] (GCC)


code:

subroutine sav
  integer :: save1
  save1 = something wrong
end subroutine sav
!
subroutine dat
  integer :: data1
  data1 = something wrong
end subroutine dat

messages:

gfortran-error4.f90:3.6:

  save1 = something wrong
      1
Error: Syntax error in SAVE statement at (1)
gfortran-error4.f90:8.6:

  data1 = something wrong
      1
Error: Syntax error in DATA statement at (1)


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

* [Bug fortran/51991] Wrong error message with variables named "SAVE*"
  2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
                   ` (9 preceding siblings ...)
  2012-02-08 10:39 ` bardeau at iram dot fr
@ 2012-02-08 16:15 ` sgk at troutmask dot apl.washington.edu
  2012-02-08 16:23 ` bardeau at iram dot fr
  11 siblings, 0 replies; 13+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2012-02-08 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2012-02-08 16:15:20 UTC ---
On Wed, Feb 08, 2012 at 10:38:42AM +0000, bardeau at iram dot fr wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51991
> 
> --- Comment #10 from Sebastien Bardeau <bardeau at iram dot fr> 2012-02-08 10:38:42 UTC ---
> I checked the gfortran trunk revision 183991 and the "bug" does not seem to be
> fixed. I can also add that the DATA*-named variables give also erroneous
> messages.

The patch has not been checked-in.  And, I have no idea
when I'll have time to add it.


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

* [Bug fortran/51991] Wrong error message with variables named "SAVE*"
  2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
                   ` (10 preceding siblings ...)
  2012-02-08 16:15 ` sgk at troutmask dot apl.washington.edu
@ 2012-02-08 16:23 ` bardeau at iram dot fr
  11 siblings, 0 replies; 13+ messages in thread
From: bardeau at iram dot fr @ 2012-02-08 16:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Sebastien Bardeau <bardeau at iram dot fr> 2012-02-08 16:22:47 UTC ---
Ok, I did not realize that this patch was just a fix candidate.

This bug is not a problem to me, so there is no hurry.

Thanks.


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

end of thread, other threads:[~2012-02-08 16:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-25 10:26 [Bug fortran/51991] New: Wrong error message with variables named "SAVE*" bardeau at iram dot fr
2012-01-25 11:06 ` [Bug fortran/51991] " burnus at gcc dot gnu.org
2012-01-25 11:17 ` dominiq at lps dot ens.fr
2012-01-25 12:56 ` bardeau at iram dot fr
2012-01-25 13:17 ` dominiq at lps dot ens.fr
2012-01-25 13:32 ` bardeau at iram dot fr
2012-01-25 13:37 ` bardeau at iram dot fr
2012-01-25 14:09 ` dominiq at lps dot ens.fr
2012-01-25 14:11 ` bardeau at iram dot fr
2012-01-25 16:39 ` kargl at gcc dot gnu.org
2012-02-08 10:39 ` bardeau at iram dot fr
2012-02-08 16:15 ` sgk at troutmask dot apl.washington.edu
2012-02-08 16:23 ` bardeau at iram dot fr

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).