Bug 35873 - problem with gfortran -malign-double
Summary: problem with gfortran -malign-double
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.4.0
: P3 major
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-08 16:44 UTC by Hans Jørgen Aa. Jensen
Modified: 2008-04-09 00:35 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Jørgen Aa. Jensen 2008-04-08 16:44:45 UTC
--> discovered error with gcc 4.2.1
--> fetched newest gcc binary (4.4.0): error persists
--> my system: openSuse 10.3 Linux i686 (Pentium 4)
--> gcc -malign-double test.f; a.out # ERROR: Segmentation violation
--> gcc test.f; a.out # OK

--> test.f:
      program test
      character*20 wrkmem
      call getenv("WRKMEM",wrkmem)
      write (0,*)   wrkmem
      read (wrkmem, '(I20)', err=10) lmwrkmem
      write (0,*) lmwrkmem
      stop
   10 continue
      write (0,*) 'err'
      end
Comment 1 Hans Jørgen Aa. Jensen 2008-04-08 16:47:50 UTC
(In reply to comment #0)
> --> gfortran -malign-double test.f; a.out # ERROR: Segmentation violation
> --> gfortran test.f; a.out # OK

Fix of typo (gcc instead of gfortran)
Comment 2 Andrew Pinski 2008-04-08 16:51:27 UTC
This is not a bug, -malign-double changes the ABI.
Comment 3 Hans Jørgen Aa. Jensen 2008-04-08 18:50:33 UTC
I don't understand how you can call it not a bug when a flag (no matter that it changes the ABI) makes valid fortran code not work ????

It did work under earlier versions of gfotran.
Comment 4 Andrew Pinski 2008-04-08 18:54:47 UTC
(In reply to comment #3)
> I don't understand how you can call it not a bug when a flag (no matter that it
> changes the ABI) makes valid fortran code not work ????

You have to compile all of libgfortran with -malign-double and all of libc with it too.

Please read the documentation more closely since it explicitly says it breaks compatibility.

See PR 29562, PR 30594, PR 31696 also.
Comment 5 Jerry DeLisle 2008-04-09 00:35:59 UTC
If you can separate the I/O functions you need into a separate file and use -malign-double only for those portions that do computations, you can make this work.  I can not know from where I sit how important -malign-double is to your application.