This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/32937] New: segfault with string and -fdefault-integer-8
- From: "tkoenig at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jul 2007 19:25:05 -0000
- Subject: [Bug fortran/32937] New: segfault with string and -fdefault-integer-8
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The failure in actual_array_constructor_2.f90
can be reduced to
$ cat actual_array_constructor_2.f90
character(4), dimension(4) :: c1, c2
integer m
m = 4
call foo ((/(c1(i), i = m,1,-1)/), c2)
if (any(c2(4:1:-1) .ne. c1)) call abort ()
contains
subroutine foo (chr1, chr2)
character(*), dimension(:) :: chr1, chr2
chr2 = chr1
end subroutine foo
end
$ gfortran -g -fdefault-integer-8 actual_array_constructor_2.f90
$ gdb ./a.out
GNU gdb 6.4.90-debian
Copyright (C) 2006 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 "i486-linux-gnu"...Using host libthread_db library
"/lib/i686/cmov/libthread_db.so.1".
(gdb) r
Starting program: /home/ig25/Krempel/Def-8/a.out
Program received signal SIGSEGV, Segmentation fault.
0xb7eff5f9 in *_gfortrani_compare_string (len1=4, s1=0x0, len2=-1080156276,
s2=0x4 <Address 0x4 out of bounds>)
at ../../../../gcc/trunk/libgfortran/intrinsics/string_intrinsics.c:86
86 res = memcmp (s1, s2, (len1 < len2) ? len1 : len2);
The problem appears to be that the first argument to gfortani_compare_string
is pushed as an 8-byte integer, which messes things up.
--
Summary: segfault with string and -fdefault-integer-8
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tkoenig at gcc dot gnu dot org
BugsThisDependsOn: 32770
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32937