public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34107]  New: seg fault when writing into character variable when code compiled with -maling-double
@ 2007-11-15 10:24 j dot m dot h dot thomas at dl dot ac dot uk
  2007-11-15 10:54 ` [Bug fortran/34107] " pault at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: j dot m dot h dot thomas at dl dot ac dot uk @ 2007-11-15 10:24 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-11-15 14:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-15 10:24 [Bug fortran/34107] New: seg fault when writing into character variable when code compiled with -maling-double j dot m dot h dot thomas at dl dot ac dot uk
2007-11-15 10:54 ` [Bug fortran/34107] " pault at gcc dot gnu dot org
2007-11-15 11:26 ` rguenth at gcc dot gnu dot org
2007-11-15 11:58 ` pault at gcc dot gnu dot org
2007-11-15 14:57 ` jvdelisle at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).