public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45724]  New: segmentation fault occurs when printing string if -malign-double option is used
@ 2010-09-18 19:36 kamaraju at gmail dot com
  2010-09-18 19:47 ` [Bug fortran/45724] " ubizjak at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: kamaraju at gmail dot com @ 2010-09-18 19:36 UTC (permalink / raw)
  To: gcc-bugs

J.P. Malhado originally reported this bug in Debian BTS as
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518642.

debian_chroot:sid:kusumanchi:/home/518642# cat string.f90 
write(6,*) 'string1'
write(6,'(A)') 'string2'
end

debian_chroot:sid:kusumanchi:/home/518642# /usr/lib/gcc-snapshot/bin/gfortran
-g -malign-double string.f90 

debian_chroot:sid:kusumanchi:/home/518642# ./a.out 
 string1
Segmentation fault (core dumped)

The segmentation fault does not occur if the -malign-double option is not used.

It is reproducible in gfortran 4.3.2, 4.3.5, 4.4.4, 4.5.1 and 4.6.0.


debian_chroot:sid:kusumanchi:/home/518642# /usr/lib/gcc-snapshot/bin/gfortran
-v
Using built-in specs.                                                           
COLLECT_GCC=/usr/lib/gcc-snapshot/bin/gfortran                                  
COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/i486-linux-gnu/4.6.0/lto-wrapper 
Target: i486-linux-gnu                                                          
Configured with: ../src/configure -v --with-pkgversion='Debian 20100828-1'
--with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs
--enable-languages=c,ada,c++,fortran,objc,obj-c++
--prefix=/usr/lib/gcc-snapshot --enable-shared --enable-multiarch
--enable-linker-build-id --with-system-zlib --disable-nls --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin
--enable-gold --with-plugin-ld=ld.gold --enable-objc-gc --enable-targets=all
--with-arch-32=i586 --with-tune=generic --disable-werror --enable-checking=yes
--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu            
Thread model: posix                                                             
gcc version 4.6.0 20100828 (experimental) [trunk revision 163616] (Debian
20100828-1)        

debian_chroot:sid:kusumanchi:/home/518642# gdb -q ./a.out                       
Reading symbols from /home/518642/a.out...done.                                 
(gdb) r                                                                         
Starting program: /home/518642/a.out                                            
 string1                                                                        

Program received signal SIGSEGV, Segmentation fault.                            
format_hash (dtp=0xbffffb50) at ../../../src/libgfortran/io/format.c:152        
152     ../../../src/libgfortran/io/format.c: No such file or directory.        
        in ../../../src/libgfortran/io/format.c                                 
(gdb)bt                                                                         
#0  format_hash (dtp=0xbffffb50) at ../../../src/libgfortran/io/format.c:152    
#1  find_parsed_format (dtp=0xbffffb50) at
../../../src/libgfortran/io/format.c:189          
#2  parse_format (dtp=0xbffffb50) at ../../../src/libgfortran/io/format.c:1228  
#3  0x400c3610 in data_transfer_init (dtp=0xbffffb50, read_flag=0)              
    at ../../../src/libgfortran/io/transfer.c:2227                              
#4  0x08048619 in MAIN__ () at string.f90:2


thanks
raju


-- 
           Summary: segmentation fault occurs when printing string if -
                    malign-double option is used
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kamaraju at gmail dot com


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


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

* [Bug fortran/45724] segmentation fault occurs when printing string if -malign-double option is used
  2010-09-18 19:36 [Bug fortran/45724] New: segmentation fault occurs when printing string if -malign-double option is used kamaraju at gmail dot com
@ 2010-09-18 19:47 ` ubizjak at gmail dot com
  2010-09-18 20:29 ` kamaraju at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2010-09-18 19:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ubizjak at gmail dot com  2010-09-18 19:47 -------
`-malign-double'
`-mno-align-double'
     Control whether GCC aligns `double', `long double', and `long
     long' variables on a two word boundary or a one word boundary.
     Aligning `double' variables on a two word boundary will produce
     code that runs somewhat faster on a `Pentium' at the expense of
     more memory.

     On x86-64, `-malign-double' is enabled by default.

     *Warning:* if you use the `-malign-double' switch, structures
     containing the above types will be aligned differently than the
     published application binary interface specifications for the 386
     and will not be binary compatible with structures in code compiled
     without that switch.


-- 


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


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

* [Bug fortran/45724] segmentation fault occurs when printing string if -malign-double option is used
  2010-09-18 19:36 [Bug fortran/45724] New: segmentation fault occurs when printing string if -malign-double option is used kamaraju at gmail dot com
  2010-09-18 19:47 ` [Bug fortran/45724] " ubizjak at gmail dot com
@ 2010-09-18 20:29 ` kamaraju at gmail dot com
  2010-09-18 21:43 ` ubizjak at gmail dot com
  2010-09-18 22:26 ` kamaraju at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: kamaraju at gmail dot com @ 2010-09-18 20:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from kamaraju at gmail dot com  2010-09-18 20:29 -------
@Uros Bizjak

I dont understand your point in copy pasting the manual on -malign-double.

Are you saying that segmentation fault is an acceptable/expected behavior in
this case and this bug will not be fixed?


-- 


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


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

* [Bug fortran/45724] segmentation fault occurs when printing string if -malign-double option is used
  2010-09-18 19:36 [Bug fortran/45724] New: segmentation fault occurs when printing string if -malign-double option is used kamaraju at gmail dot com
  2010-09-18 19:47 ` [Bug fortran/45724] " ubizjak at gmail dot com
  2010-09-18 20:29 ` kamaraju at gmail dot com
@ 2010-09-18 21:43 ` ubizjak at gmail dot com
  2010-09-18 22:26 ` kamaraju at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2010-09-18 21:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ubizjak at gmail dot com  2010-09-18 21:43 -------
(In reply to comment #2)

> I dont understand your point in copy pasting the manual on -malign-double.
> 
> Are you saying that segmentation fault is an acceptable/expected behavior in
> this case and this bug will not be fixed?

-malign-double is an ABI changing option, it means that source, compiled with
this option, violates the convention on how variables are passed and/or
accessed in the memory. So, when you use -malign-double, you should link your
program with libraries that are also compiled with -malign-double. This
includes ALL libraries, including system libraries.

This is not a bug.


-- 

ubizjak at gmail dot com changed:

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


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


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

* [Bug fortran/45724] segmentation fault occurs when printing string if -malign-double option is used
  2010-09-18 19:36 [Bug fortran/45724] New: segmentation fault occurs when printing string if -malign-double option is used kamaraju at gmail dot com
                   ` (2 preceding siblings ...)
  2010-09-18 21:43 ` ubizjak at gmail dot com
@ 2010-09-18 22:26 ` kamaraju at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: kamaraju at gmail dot com @ 2010-09-18 22:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kamaraju at gmail dot com  2010-09-18 22:26 -------
Ok. Thanks for the explanation. I appreciate it.


-- 


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


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

end of thread, other threads:[~2010-09-18 22:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-18 19:36 [Bug fortran/45724] New: segmentation fault occurs when printing string if -malign-double option is used kamaraju at gmail dot com
2010-09-18 19:47 ` [Bug fortran/45724] " ubizjak at gmail dot com
2010-09-18 20:29 ` kamaraju at gmail dot com
2010-09-18 21:43 ` ubizjak at gmail dot com
2010-09-18 22:26 ` kamaraju at gmail dot com

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