Probably related to PR 18960, except that two
null pointers are swapped here :-)

$ cat reshape-char.f90
program main
  character(len=1), dimension(2,2) :: a,b
  a = transpose(reshape((/'a', 'b', 'c', 'd'/), shape(a)))
  print *,a
end program main
$ gfortran reshape-char.f90
reshape-char.f90: In function 'MAIN__':
reshape-char.f90: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
Using built-in specs.
Configured with: ../gcc-4.0-20050102/configure --prefix=/home/zfkts
--enable-languages=c,c++,f95
Thread model: posix
gcc version 4.0.0 20050102 (experimental)
$ gfortran -dumpmachine
ia64-unknown-linux-gnu
$ gdb ~/libexec/gcc/ia64-unknown-linux-gnu/4.0.0/f951
GNU gdb Red Hat Linux (6.1post-1.20040607.52rh)
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 "ia64-redhat-linux-gnu"...Using host libthread_db
library "/lib/tls/libthread_db.so.1".

(gdb) r reshape-char.f90
Starting program: /home/zfkts/libexec/gcc/ia64-unknown-linux-gnu/4.0.0/f951
reshape-char.f90
 MAIN__

Program received signal SIGSEGV, Segmentation fault.
tree_swap_operands_p (arg0=0x0, arg1=0x0, reorder=1 '\001')
    at ../../gcc-4.0-20050102/gcc/fold-const.c:5933
5933      STRIP_SIGN_NOPS (arg1);
(gdb) bt
#0  tree_swap_operands_p (arg0=0x0, arg1=0x0, reorder=1 '\001')
    at ../../gcc-4.0-20050102/gcc/fold-const.c:5933
#1  0x400000000041e690 in fold (expr=0x20000000024cceb0)
    at ../../gcc-4.0-20050102/gcc/fold-const.c:6328
#2  0x40000000000b8460 in gfc_trans_allocate_temp_array (
    loop=0x60000fffffff9350, info=0x60000000000ed3b0, eltype=Variable "eltype"
is not available.
)
    at ../../gcc-4.0-20050102/gcc/fortran/trans-array.c:621
#3  0x40000000000d9150 in gfc_conv_function_call (se=0x60000fffffff91a0,
    sym=0x60000000000ed510, arg=0x60000000000eb5a0)
    at ../../gcc-4.0-20050102/gcc/fortran/trans-expr.c:1091
#4  0x40000000000e2490 in gfc_conv_intrinsic_funcall (se=0x60000fffffff91a0,
    expr=0x60000000000eb330)
    at ../../gcc-4.0-20050102/gcc/fortran/trans-intrinsic.c:1083
#5  0x40000000000e99f0 in gfc_conv_intrinsic_function (se=0x60000fffffff91a0,
    expr=0x60000000000eb330)
    at ../../gcc-4.0-20050102/gcc/fortran/trans-intrinsic.c:3007
#6  0x40000000000d97c0 in gfc_conv_function_expr (se=0x60000fffffff91a0,
    expr=0x60000000000eb330)
    at ../../gcc-4.0-20050102/gcc/fortran/trans-expr.c:1404
#7  0x40000000000da3a0 in gfc_conv_expr (se=0x60000fffffff91a0,
    expr=0x60000000000eb330)
    at ../../gcc-4.0-20050102/gcc/fortran/trans-expr.c:1780
#8  0x40000000000c4e40 in gfc_add_loop_ss_code (loop=0x60000fffffff9350,
---Type <return> to continue, or q <return> to quit---
    ss=0x60000000000ed390, subscript=0 '\0')
    at ../../gcc-4.0-20050102/gcc/fortran/trans-array.c:1232
#9  0x40000000000c57c0 in gfc_conv_loop_setup (loop=0x60000fffffff9350)
    at ../../gcc-4.0-20050102/gcc/fortran/trans-array.c:2563
#10 0x40000000000df810 in gfc_trans_assignment (expr1=0x60000000000ea360,
    expr2=0x60000000000eb330)
    at ../../gcc-4.0-20050102/gcc/fortran/trans-expr.c:2146
#11 0x40000000000dfef0 in gfc_trans_assign (code=Variable "code" is not 
available.
)
    at ../../gcc-4.0-20050102/gcc/fortran/trans-expr.c:2235
#12 0x40000000000b6310 in gfc_trans_code (code=0x60000000000ec360)
    at ../../gcc-4.0-20050102/gcc/fortran/trans.c:495
#13 0x40000000000d5910 in gfc_generate_function_code (ns=0x60000000000e9b70)
    at ../../gcc-4.0-20050102/gcc/fortran/trans-decl.c:2217
#14 0x40000000000b69b0 in gfc_generate_code (ns=0x60000000000e9b70)
    at ../../gcc-4.0-20050102/gcc/fortran/trans.c:679
#15 0x400000000007a9a0 in gfc_parse_file ()
    at ../../gcc-4.0-20050102/gcc/fortran/parse.c:2628
#16 0x40000000000ae3f0 in gfc_be_parse_file (set_yydebug=-27088)
    at ../../gcc-4.0-20050102/gcc/fortran/f95-lang.c:266
#17 0x400000000063d9e0 in toplev_main (argc=Variable "argc" is not available.
)
    at ../../gcc-4.0-20050102/gcc/toplev.c:992
#18 0x4000000000106e70 in main (argc=2, argv=0x60000fffffff9ab8)
    at ../../gcc-4.0-20050102/gcc/main.c:35

-- 
           Summary: transpose(reshape(...)) of character array segfaults.
           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=19269

Reply via email to