From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1192 invoked by alias); 15 Nov 2007 10:24:41 -0000 Received: (qmail 1176 invoked by uid 48); 15 Nov 2007 10:24:31 -0000 Date: Thu, 15 Nov 2007 10:24:00 -0000 Subject: [Bug fortran/34107] New: seg fault when writing into character variable when code compiled with -maling-double X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "j dot m dot h dot thomas at dl dot ac dot uk" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-11/txt/msg01362.txt.bz2 I'm using the latest (precompiled) version of gfortran (GNU Fortran (GCC) 4.3.0 20071105 (experimental) [trunk revision 129892]). The following code: program test integer :: pid character (len=10) :: chpid pid=12345 write(chpid,'(i10)')pid write(*,*)"chpid is ",chpid end program test when compiled with: gfortran -o test.gfortran90 -g -malign-double ./test.f90 on my ubuntu box (Ubuntu 6.06.1 LTS, Intel(R) Pentium(R) 4 CPU 2.80GHz), seg faults as shown below: Program received signal SIGSEGV, Segmentation fault. 0xb7f86f46 in next_char (fmt=0x8050528, literal=0) at /home/fx/gfortran_nightbuild/trunk/libgfortran/io/format.c:91 91 /home/fx/gfortran_nightbuild/trunk/libgfortran/io/format.c: No such file or directory. in /home/fx/gfortran_nightbuild/trunk/libgfortran/io/format.c (gdb) bt #0 0xb7f86f46 in next_char (fmt=0x8050528, literal=0) at /home/fx/gfortran_nightbuild/trunk/libgfortran/io/format.c:91 #1 0xb7f86fb1 in format_lex (fmt=0x8050528) at /home/fx/gfortran_nightbuild/trunk/libgfortran/io/format.c:181 #2 0xb7f87c65 in *_gfortrani_parse_format (dtp=0xbfbc1aa8) at /home/fx/gfortran_nightbuild/trunk/libgfortran/io/format.c:981 #3 0xb7f91e69 in data_transfer_init (dtp=0xbfbc1aa8, read_flag=0) at /home/fx/gfortran_nightbuild/trunk/libgfortran/io/transfer.c:1802 #4 0x08048616 in test () at ./test.f90:7 If I remove the -malign-double flag, the code runs fine. The same code in FORTRAN77 format works fine with g77 (with the -malign-double flag), but also crashes gfortran. -- Summary: seg fault when writing into character variable when code compiled with -maling-double Product: gcc Version: unknown Status: UNCONFIRMED Severity: critical Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: j dot m dot h dot thomas at dl dot ac dot uk GCC host triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34107