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

* [Bug fortran/34107] seg fault when writing into character variable when code compiled with -maling-double
  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 ` pault at gcc dot gnu dot org
  2007-11-15 11:26 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-11-15 10:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pault at gcc dot gnu dot org  2007-11-15 10:54 -------
Jens,

I cannot reproduce this bug, even with the same flags that you are using, under
Cygwin_NT and last night's build.  I will check on a Linux system tonight.

I have downrated the severity because "critical" refers to bugs that prevent
the gcc build.  I assure you that the gfortran maintainers will take the report
just as seriously.

Thanks for the report

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu dot org
           Severity|critical                    |normal


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34107


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

* [Bug fortran/34107] seg fault when writing into character variable when code compiled with -maling-double
  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
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-15 11:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2007-11-15 11:26 -------
-malign-double changes the ABI.  You need to rebuild libgfortran with that
option.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34107


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

* [Bug fortran/34107] seg fault when writing into character variable when code compiled with -maling-double
  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
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-11-15 11:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2007-11-15 11:58 -------
(In reply to comment #2)
> -malign-double changes the ABI.  You need to rebuild libgfortran with that
> option.

Ah! Thanks, Richard.  For that, I'll take a look at achar_4.f90 for you:)

Paul


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34107


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

* [Bug fortran/34107] seg fault when writing into character variable when code compiled with -maling-double
  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
                   ` (2 preceding siblings ...)
  2007-11-15 11:58 ` pault at gcc dot gnu dot org
@ 2007-11-15 14:57 ` jvdelisle at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-11-15 14:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jvdelisle at gcc dot gnu dot org  2007-11-15 14:57 -------
There is a good chance that if you try to build the runtime library with
malign-double that you will break it.  My recommendation is don't use
-malign-double for I/O related things.


-- 


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).