New: ICE on invalid print statement
8 answers - 564 bytes -

From a typo of mine
$ cat ice-print.f
program main
print precision(1.2_8)
end
$ gfortran ice-print.f
ice-print.f: In function 'MAIN__':
ice-print.f:2: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <for instructions.
$ gfortran -v
Using built-in specs.
Target: ia64-unknown-linux-gnu
Configured with: /gcc-4.1-20050806/configure /home/zfkts
languages=c,f95
Thread model: posix
gcc version 4.1.0 20050806 (experimental)
No.1 | | 87 bytes |
| 
Additional Comments From pinskia at gcc dot gnu dot org 2005-08-16 12:12
Confirmed.
No.2 | | 1288 bytes |
| 
Additional Comments From tobi at gcc dot gnu dot org 2005-09-09 15:20
Backtrace:
(gdb) run pr23420.f90
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: / pr23420.f90
Program received signal SIGSEGV, Segmentation fault.
0x0806dfb8 in match_io (k=M_PRINT) at //gcc/fortran/io.c:2144
2144 if ((gfc_match_name (name) == MATCH_YES)
(gdb) bt
#0 0x0806dfb8 in match_io (k=M_PRINT) at //gcc/fortran/io.c:2144
#1 0x0806e1be in gfc_match_print () at //gcc/fortran/io.c:2342
#2 0x0807b23a in match_word (str=Variable "str" is not available.
) at //gcc/fortran/parse.c:65
#3 0x0807b4b9 in decode_statement () at //gcc/fortran/parse.c:251
#4 0x0807bd85 in next_statement () at //gcc/fortran/parse.c:356
#5 0x0807c895 in parse_spec (st=ST_NNE) at //gcc/fortran/parse.c:1530
#6 0x0807d6f9 in parse_progunit (st=ST_ARITHMETIC_IF)
at //gcc/fortran/parse.c:2295
#7 0x0807d9e4 in gfc_parse_file () at //gcc/fortran/parse.c:2581
#8 0x08097455 in gfc_be_parse_file (set_yydebug=0)
at
#9 0x0836b89a in toplev_main (argc=2, argv=0xbffff9d4)
at //gcc/toplev.c:971
#10 0x40065db6 in __libc_start_main () from /lib/libc.so.6
#11 0x0804ab91 in _start ()
(gdb)
No.3 | | 91 bytes |
| 
Additional Comments From tobi at gcc dot gnu dot org 2005-09-09 15:32
Working on a fix.
No.4 | | 2386 bytes |
| 
Additional Comments From tobi at gcc dot gnu dot org 2005-09-09 15:58
This patch fixes the problem in match_io.c, but leaves us with a preexisting
deficiency in I/ statement parsing:
PRINT I+I
END
will now segfault in trans-io.c.
Index: io.c
RCS file: /cvs/gcc/gcc/gcc/fortran/io.c,v
retrieving revision 1.31
diff -c -3 -p -r1.31 io.c
io.c 4 Sep 2005 12:08:40 -0000 1.31
io.c 9 Sep 2005 15:38:07 -0000
match_io (io_kind k)
2133,2169
if (gfc_match_char ('(') == MATCH_N)
{
if (k == M_WRITE)
goto syntax;
! else if (k == M_PRINT
! && (gfc_current_form == FRM_FIXED
! || gfc_peek_char () == ' '))
{
/* Treat the non-standard case of PRINT namelist. */
! where = gfc_current_locus;
! if ((gfc_match_name (name) == MATCH_YES)
! && !gfc_find_symbol (name, NULL, 1, &sym)
! && sym->attr.flavor == FL_NAMELIST)
{
! if (gfc_notify_std (GFC_STD_GNU, "PRINT namelist at "
! "%C is an extension") == FAILURE)
{
! m = MATCH_ERRR;
! goto cleanup;
}
! if (gfc_match_eos () == MATCH_N)
! {
! gfc_error ("Namelist followed by I/ list at %C");
! m = MATCH_ERRR;
! goto cleanup;
! }
!
! dt->io_unit = default_unit (k);
! dt->namelist = sym;
! goto get_io_list;
}
- else
- gfc_current_locus = where;
}
if (gfc_current_form == FRM_FREE)
2133,2170
if (gfc_match_char ('(') == MATCH_N)
{
+ where = gfc_current_locus
if (k == M_WRITE)
goto syntax;
! else if (k == M_PRINT)
{
/* Treat the non-standard case of PRINT namelist. */
! if ((gfc_current_form == FRM_FIXED || gfc_peek_char () == ' ')
! && gfc_match_name (name) == MATCH_YES)
{
! gfc_find_symbol (name, NULL, 1, &sym);
! if (sym && sym->attr.flavor == FL_NAMELIST)
{
! if (gfc_notify_std (GFC_STD_GNU, "PRINT namelist at "
! "%C is an extension") == FAILURE)
! {
! m = MATCH_ERRR;
! goto cleanup;
! }
! if (gfc_match_eos () == MATCH_N)
! {
! gfc_error ("Namelist followed by I/ list at %C");
! m = MATCH_ERRR;
! goto cleanup;
! }
!
! dt->io_unit = default_unit (k);
! dt->namelist = sym;
! goto get_io_list;
}
! else
! gfc_current_locus = where;
}
}
if (gfc_current_form == FRM_FREE)
No.5 | | 1295 bytes |
| 
Additional Comments From tobi at gcc dot gnu dot org 2005-09-09 16:01
The new segfault's here:
(gdb) run pr23420.f90
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: / pr23420.f90
MAIN__
Program received signal SIGSEGV, Segmentation fault.
0x080b56a7 in set_string (block=0xbfffda24, postblock=0xbfffda1c, var=Variable
"var" is not available.
)
at
456 if (e->ts.type == BT_INTEGER && e->symtree->n.sym->attr.assign == 1)
(gdb) bt
#0 0x080b56a7 in set_string (block=0xbfffda24, postblock=0xbfffda1c,
var=Variable "var" is not available.
)
at
#1 0x080b6343 in build_dt (function=0x85d6078, code=0x868d2f0)
at
#2 0x080987da in gfc_trans_code (code=0x868d2f0)
at //gcc/fortran/trans.c:593
#3 0x080a82ae in gfc_generate_function_code (ns=0x868cd08)
at
#4 0x08097e54 in gfc_generate_code (ns=0x868cd08)
at //gcc/fortran/trans.c:683
#5 0x0807df21 in gfc_parse_file () at //gcc/fortran/parse.c:2642
#6 0x08097815 in gfc_be_parse_file (set_yydebug=0)
at
#7 0x0836c275 in toplev_main (argc=2, argv=0xbfffdc44)
at //gcc/toplev.c:990
#8 0x40065db6 in __libc_start_main () from /lib/libc.so.6
#9 0x0804ab91 in _start ()
No.6 | | 85 bytes |
| 
Additional Comments From tobi at gcc dot gnu dot org 2005-09-15 12:00
PAtch here:
No.7 | | 606 bytes |
| 
Additional Comments From cvs-commit at gcc dot gnu dot org 2005-09-20 15:06
Subject: Bug 23420
CVSRT:/cvs/gcc
Module name:gcc
Changes by:tobi (AT) gcc (DOT) gnu.org2005-09-20 15:05:33
Modified files:
gcc/fortran : ChangeLog io.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gfortran.dg: print_fmt_4.f
Log message:
fortran/
PR fortran/23420
* io.c (resolve_tag): Don't allow non-CHARACTER constants as formats.
(match_io): Fix usage of gfc_find_symbol.
testsuite/
PR fortran/23420
* gfortran.dg/print_fmt_4.f: New.
Patches:
No.8 | | 116 bytes |
| 
Additional Comments From tobi at gcc dot gnu dot org 2005-09-20 15:27
The segfault from numbers 4 and 5 remains.