public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31696]  New: -malign-double trashes fortran format
@ 2007-04-25  9:33 KnowlesPJ at Cardiff dot ac dot uk
  2007-04-25 15:34 ` [Bug fortran/31696] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: KnowlesPJ at Cardiff dot ac dot uk @ 2007-04-25  9:33 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1259 bytes --]

The following code goes wrong with gfortran -malign-double (but is OK without
malign-double)

PROGRAM test
 CHARACTER(80) :: buffer
 READ (*,1) buffer
1 FORMAT(a)
END PROGRAM test

$ gfortran -v
Using built-in specs.
Target: i386-apple-darwin8.9.1
Configured with: ../gcc-4.3-20070316/configure --enable-languages=fortran,c++
Thread model: posix
gcc version 4.3.0 20070316 (experimental)
$ uname -a
Darwin m038.chem.cf.ac.uk 8.9.1 Darwin Kernel Version 8.9.1: Thu Feb 22
20:55:00 PST 2007; root:xnu-792.18.15~1/RELEASE_I386 i386 i386
$ gfortran -malign-double format.f90
$ echo xxx | ./a.out
At line 3 of file format.f90
Fortran runtime error: Missing initial left parenthesis in format
H       å? 
$ gfortran  format.f90
$ echo xxx | ./a.out


-- 
           Summary: -malign-double trashes fortran format
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: KnowlesPJ at Cardiff dot ac dot uk
 GCC build triplet: i386-apple-darwin8.9.1
  GCC host triplet: i386-apple-darwin8.9.1
GCC target triplet: i386-apple-darwin8.9.1


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


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

* [Bug fortran/31696] -malign-double trashes fortran format
  2007-04-25  9:33 [Bug fortran/31696] New: -malign-double trashes fortran format KnowlesPJ at Cardiff dot ac dot uk
@ 2007-04-25 15:34 ` pinskia at gcc dot gnu dot org
  2007-04-25 15:47 ` KnowlesPJ at Cardiff dot ac dot uk
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-25 15:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-04-25 16:34 -------
what do you expect from an abi changing option?


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/31696] -malign-double trashes fortran format
  2007-04-25  9:33 [Bug fortran/31696] New: -malign-double trashes fortran format KnowlesPJ at Cardiff dot ac dot uk
  2007-04-25 15:34 ` [Bug fortran/31696] " pinskia at gcc dot gnu dot org
@ 2007-04-25 15:47 ` KnowlesPJ at Cardiff dot ac dot uk
  2007-04-25 17:12 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: KnowlesPJ at Cardiff dot ac dot uk @ 2007-04-25 15:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from KnowlesPJ at Cardiff dot ac dot uk  2007-04-25 16:47 -------
I don't understand your response, or the assumptions that might be behind it.
The program is standard fortran that compiles without warning, and I cannot see
why I would not want doubles aligned at 64 bits on x86 hardware, just like all
the other compilers, including the other free one, do. Is it written down
somewhere that there is no intention to support this mode of operation in the
foreseeable future? Google sends me to, for example,
http://gcc.gnu.org/ml/fortran/2007-02/msg00026.html which does not undermine my
assumptions as unreasonable.  If you speak on behalf of the gfortran community
in saying you will not address this, then we will simply once again for a while
walk away from attempting support of gfortran in our large and widely-used
code.


-- 

KnowlesPJ at Cardiff dot ac dot uk changed:

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


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


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

* [Bug fortran/31696] -malign-double trashes fortran format
  2007-04-25  9:33 [Bug fortran/31696] New: -malign-double trashes fortran format KnowlesPJ at Cardiff dot ac dot uk
  2007-04-25 15:34 ` [Bug fortran/31696] " pinskia at gcc dot gnu dot org
  2007-04-25 15:47 ` KnowlesPJ at Cardiff dot ac dot uk
@ 2007-04-25 17:12 ` pinskia at gcc dot gnu dot org
  2007-04-25 18:58 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-25 17:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-04-25 18:12 -------
Does not matter, this option changes the ABI, it is like any other ABI changing
option, you should not use it unless you understand what you are doing which is
clearly not the case.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/31696] -malign-double trashes fortran format
  2007-04-25  9:33 [Bug fortran/31696] New: -malign-double trashes fortran format KnowlesPJ at Cardiff dot ac dot uk
                   ` (2 preceding siblings ...)
  2007-04-25 17:12 ` pinskia at gcc dot gnu dot org
@ 2007-04-25 18:58 ` burnus at gcc dot gnu dot org
  2007-04-25 21:46 ` KnowlesPJ at Cardiff dot ac dot uk
  2007-04-25 21:58 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-04-25 18:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-04-25 19:58 -------
>From the man page:
"-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."

NOW COMES THE IMPORTANT PART:

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


Thus if you want to use -malign-double, you need to compile at least also the
gfortran library with that option. (Maybe other libraries as well.)


-- 


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


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

* [Bug fortran/31696] -malign-double trashes fortran format
  2007-04-25  9:33 [Bug fortran/31696] New: -malign-double trashes fortran format KnowlesPJ at Cardiff dot ac dot uk
                   ` (3 preceding siblings ...)
  2007-04-25 18:58 ` burnus at gcc dot gnu dot org
@ 2007-04-25 21:46 ` KnowlesPJ at Cardiff dot ac dot uk
  2007-04-25 21:58 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 9+ messages in thread
From: KnowlesPJ at Cardiff dot ac dot uk @ 2007-04-25 21:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from KnowlesPJ at Cardiff dot ac dot uk  2007-04-25 22:46 -------
I guess I walk away from you guys at this point. You need to think carefully
about the fortran standard, which does not define any abi whatsoever
(unfortunately). The fortran programmer is not supposed to think about this,
but instead write within the language. It is just different to C and CPP. If
you can not think about the overall system (compiler and supporting libraries
that aim to implement the standard) as a single entity instead of just the
compiler, then you will not win friends in the application code development
community.


-- 


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


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

* [Bug fortran/31696] -malign-double trashes fortran format
  2007-04-25  9:33 [Bug fortran/31696] New: -malign-double trashes fortran format KnowlesPJ at Cardiff dot ac dot uk
                   ` (4 preceding siblings ...)
  2007-04-25 21:46 ` KnowlesPJ at Cardiff dot ac dot uk
@ 2007-04-25 21:58 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-25 21:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2007-04-25 22:58 -------
Yes the fortran standard does not define the ABI, the target which you are
compiling for does and if you change it in any way (which is what options like
-malign-double does) you are going to run into problems like this.

GCC is more than a fortran compiler and more than a C compiler, if you use
options in general that warn that they change the ABI (this is documented as
shown by comment #4 ), you should be expected to understand what you are trying
to do might not always work.  There are so many options which change the ABI
(argument passing, struct layout) that it is not the correct thing to warn
about all of them,  though maybe we should not supply them as options in the
first place but that is up to the target maintainers to decide if they want to
have these options.  Also note -malign-double is just an example of the ABI
changing options and it just happens to be the most reported one that "breaks"
code.


-- 


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


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

* [Bug fortran/31696] -malign-double trashes fortran format
       [not found] <bug-31696-4@http.gcc.gnu.org/bugzilla/>
  2012-10-14  4:35 ` dominiq at lps dot ens.fr
@ 2012-10-31  3:55 ` gnu.0kn at gishpuppy dot com
  1 sibling, 0 replies; 9+ messages in thread
From: gnu.0kn at gishpuppy dot com @ 2012-10-31  3:55 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Drew <gnu.0kn at gishpuppy dot com> 2012-10-31 03:55:13 UTC ---
After some googling I have found that ABI means application binary interface
and how this affects the problem, thank you.

I would be happy if someone could direct me to a tutorial on how to maintain
two different ABIs on the same machine (so as not to break unaligned code
elsewhere) and how to obtain it precompiled from a package maintainer.

As another workaround, it has been indicated that $LD_PRELOAD may be used to
link to an aligned malloc

http://gcc.gnu.org/ml/fortran/2007-08/msg00320.html

For information on how to do either I, and I'm sure many others attempting to
call SSE functions or DMA transfers from 32 bit gfortran, would be very
thankful.


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

* [Bug fortran/31696] -malign-double trashes fortran format
       [not found] <bug-31696-4@http.gcc.gnu.org/bugzilla/>
@ 2012-10-14  4:35 ` dominiq at lps dot ens.fr
  2012-10-31  3:55 ` gnu.0kn at gishpuppy dot com
  1 sibling, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-10-14  4:35 UTC (permalink / raw)
  To: gcc-bugs


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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gnu.0kn at gishpuppy dot
                   |                            |com

--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-10-14 04:35:34 UTC ---
*** Bug 54923 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2012-10-31  3:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-25  9:33 [Bug fortran/31696] New: -malign-double trashes fortran format KnowlesPJ at Cardiff dot ac dot uk
2007-04-25 15:34 ` [Bug fortran/31696] " pinskia at gcc dot gnu dot org
2007-04-25 15:47 ` KnowlesPJ at Cardiff dot ac dot uk
2007-04-25 17:12 ` pinskia at gcc dot gnu dot org
2007-04-25 18:58 ` burnus at gcc dot gnu dot org
2007-04-25 21:46 ` KnowlesPJ at Cardiff dot ac dot uk
2007-04-25 21:58 ` pinskia at gcc dot gnu dot org
     [not found] <bug-31696-4@http.gcc.gnu.org/bugzilla/>
2012-10-14  4:35 ` dominiq at lps dot ens.fr
2012-10-31  3:55 ` gnu.0kn at gishpuppy 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).