Bug 18476 - internal compiler error on strange read
Summary: internal compiler error on strange read
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks: 18959 19292
  Show dependency treegraph
 
Reported: 2004-11-14 11:25 UTC by Thomas Koenig
Modified: 2005-03-26 17:50 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-11-14 17:21:30


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Koenig 2004-11-14 11:25:05 UTC
The following should be a syntax error, not
an ICE.

$ cat internal.f90
program internal
  character(len=80) chr
  real a
  namelist /nl/ a
  chr = "&NL A=0.1 /"
  read(chr,nml)
  print *,a
end program internal
$ gfortran -v
Reading specs from /home/ig25/lib/gcc/i686-pc-linux-gnu/4.0.0/specs
Configured with: ../gcc/configure --prefix=/home/ig25
--enable-languages=c,c++,f95 : (reconfigured) ../gcc/configure
--prefix=/home/ig25 --with-gcc-version-trigger=/home/ig25/gcc/gcc/version.c
--enable-languages=c,c++,f95 --no-create --no-recursion
Thread model: posix
gcc version 4.0.0 20041114 (experimental)
$ gfortran internal.f90
internal.f90: In function 'MAIN__':
internal.f90:5: internal compiler error: in gfc_conv_string_parameter, at
fortran/trans-expr.c:1986
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Andrew Pinski 2004-11-14 17:21:30 UTC
Confirmed.
Comment 2 Tobias Schlüter 2005-01-06 17:34:29 UTC
This is a regression from g77:
[tobi@marktplatz tests]$ g77 pr18476.f
[tobi@marktplatz tests]$ ./a.out
startint: error in format
apparent state: internal I/O
last format: Pf@
lately writing sequential formatted internal IO
Aborted
[tobi@marktplatz tests]$ gfortran pr18476.f
pr18476.f: In function ‘MAIN__’:
pr18476.f:5: internal compiler error: in gfc_conv_string_parameter, at
fortran/trans-expr.c:1985
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 3 Tobias Schlüter 2005-01-06 17:52:05 UTC
I think we should issue an error, because nml is not ASSIGNed a FORMAT, but
since g77 accepts this code I'm not sure.
Comment 4 Thomas Koenig 2005-01-07 13:58:41 UTC
(In reply to comment #3)
> I think we should issue an error, because nml is not ASSIGNed a FORMAT, but
> since g77 accepts this code I'm not sure.

g77 does bomb out at runtime, though; a warning at -Wuninitialized would
probably be best (but g77 doesn't do that).

The case of an assigned integer variable is already covered in
PR 18481.  This bug may be a bit different because of the possible
confusion between an integer variable named NML and
the NML option to the read statement.
Comment 5 Paul Thomas 2005-03-26 17:37:27 UTC
Tobi and Thomas,

This one is fixed: as of 20050324, you get a nice friendly error message:

 In file namelist/pr18476.f90:6

  read(chr,nml)
          1
Error: Variable 'nml' has not been assigned a format label at (1)

I just spent an hour tracking down the source without trying gfc first. 
*dughhh*
Comment 6 Andrew Pinski 2005-03-26 17:44:13 UTC
Fixed since at least 20050321.
Comment 7 Tobias Schlüter 2005-03-26 17:50:26 UTC
This is most probably related to Feng Wang's 2005-03-15 patch.