This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/29396] New: segfault with character pointer association
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Oct 2006 21:45:57 -0000
- Subject: [Bug fortran/29396] New: segfault with character pointer association
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
$ cat a3.f90
CHARACTER(LEN=2), DIMENSION(:), POINTER :: a
CHARACTER(LEN=4), DIMENSION(3), TARGET :: b
b=(/"bbbb","bbbb","bbbb"/)
a=>b(:)(2:3)
a="aa"
IF (ANY(b.NE.(/"baab","baab","baab"/))) CALL ABORT()
END
$ gfortran a3.f90
a3.f90:0: internal compiler error: Segmentation fault
gdb backtrace is:
Program received signal SIGSEGV, Segmentation fault.
0x00000000004179b2 in gfc_check_pointer_assign (lvalue=0xce3ae0,
rvalue=0xce3de0) at ../../trunk/gcc/fortran/expr.c:2330
2330 if (lvalue->ts.type == BT_CHARACTER
(gdb) where
#0 0x00000000004179b2 in gfc_check_pointer_assign (lvalue=0xce3ae0,
rvalue=0xce3de0) at ../../trunk/gcc/fortran/expr.c:2330
#1 0x000000000044a349 in resolve_code (code=0xce42c0, ns=0xce2380)
at ../../trunk/gcc/fortran/resolve.c:4967
#2 0x000000000044b765 in gfc_resolve (ns=0xce2380)
at ../../trunk/gcc/fortran/resolve.c:6919
#3 0x0000000000440a68 in gfc_parse_file ()
at ../../trunk/gcc/fortran/parse.c:3212
2330 if (lvalue->ts.type == BT_CHARACTER
2331 && lvalue->ts.cl->length && rvalue->ts.cl->length
2332 && abs (gfc_dep_compare_expr (lvalue->ts.cl->length,
2333 rvalue->ts.cl->length)) == 1)
(gdb) p lvalue->ts
$1 = {type = BT_CHARACTER, kind = 1, derived = 0x0, cl = 0xcb0800}
(gdb) p rvalue->ts
$2 = {type = BT_CHARACTER, kind = 1, derived = 0x0, cl = 0x0}
So rvalue->ts.cl->length should not be referenced.
--
Summary: segfault with character pointer association
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fxcoudert at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29396