The code is invalid, but the compiler shouldn't segfault.

$ cat assign2.f
      program main
      integer*4 i(4)
      assign 1000 to i
 1000 continue
      end
$ gfortran assign2.f
 In file assign2.f:3

      assign 1000 to i
                                                                       1
Warning: Obsolete: ASSIGN statement at (1)
assign2.f: In function 'MAIN__':
assign2.f:3: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
$ 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 --disable-shared
Thread model: posix
gcc version 4.0.0 20041204 (experimental)

$ gdb ~/libexec/gcc/i686-pc-linux-gnu/4.0.0/f951
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...Using host libthread_db library
"/lib/tls/libthread_db.so.1".

(gdb) r assign2.f
Starting program: /home/ig25/libexec/gcc/i686-pc-linux-gnu/4.0.0/f951 assign2.f
 In file assign2.f:3

      assign 1000 to i
                                                                       1
Warning: Obsolete: ASSIGN statement at (1)
 MAIN__

Program received signal SIGSEGV, Segmentation fault.
0x08096c40 in gfc_conv_scalarized_array_ref (se=0xbffff424, ar=0x860207c)
    at ../../gcc/gcc/fortran/trans-array.c:1617
1617        n = se->loop->order[0];
(gdb) bt
#0  0x08096c40 in gfc_conv_scalarized_array_ref (se=0xbffff424, ar=0x860207c)
    at ../../gcc/gcc/fortran/trans-array.c:1617
#1  0x08096cfe in gfc_conv_array_ref (se=0xbffff424, ar=0x860207c)
    at ../../gcc/gcc/fortran/trans-array.c:1661
#2  0x080a5f4a in gfc_conv_expr (se=0xbffff424, expr=0x8602018)
    at ../../gcc/gcc/fortran/trans-expr.c:376
#3  0x080b2020 in gfc_trans_label_assign (code=0x8602148)
    at ../../gcc/gcc/fortran/trans-stmt.c:100
#4  0x080948c5 in gfc_trans_code (code=0x8602148)
    at ../../gcc/gcc/fortran/trans.c:499
#5  0x080a369c in gfc_generate_function_code (ns=0x8601820)
    at ../../gcc/gcc/fortran/trans-decl.c:2217
#6  0x08094b2a in gfc_generate_code (ns=0x8601820)
    at ../../gcc/gcc/fortran/trans.c:679
#7  0x0807b621 in gfc_parse_file () at ../../gcc/gcc/fortran/parse.c:2628
#8  0x08091c45 in gfc_be_parse_file (set_yydebug=0)
    at ../../gcc/gcc/fortran/f95-lang.c:266
#9  0x083a7485 in toplev_main (argc=0, argv=0xbffff6a4)
    at ../../gcc/gcc/toplev.c:992
#10 0x400757f8 in __libc_start_main () from /lib/tls/libc.so.6
#11 0x0804ad61 in _start () at ../sysdeps/i386/elf/start.S:102

-- 
           Summary: compiler segfault on assign to array
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Thomas dot Koenig at online dot de
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to