public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/60337] New: s390: Function arguments are not aligned
@ 2014-02-25  9:55 vogt at linux dot vnet.ibm.com
  2014-02-25  9:56 ` [Bug target/60337] " vogt at linux dot vnet.ibm.com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vogt at linux dot vnet.ibm.com @ 2014-02-25  9:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60337
           Summary: s390: Function arguments are not aligned
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vogt at linux dot vnet.ibm.com

On s390, if a type with __attribute__((aligned(...))) is passed as a function
parameter, the parameters are not aligned properly.  Also, a parameter that is
passed in a register and then copied to the stack is not aligned.  Output of
the attached test program on s390x:

$ ./foo      
0x3ffff8f0000      <--- Address on main's stack is aligned
0x3ffff8e2980 5    <--- foo's parameter is not aligned
0x3ffff8e2980 5    <--- bar's parameter is not aligned
0x3ffff8e2980 123  <--- baz's parameter is not aligned


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

* [Bug target/60337] s390: Function arguments are not aligned
  2014-02-25  9:55 [Bug target/60337] New: s390: Function arguments are not aligned vogt at linux dot vnet.ibm.com
@ 2014-02-25  9:56 ` vogt at linux dot vnet.ibm.com
  2014-02-25 10:09 ` vogt at linux dot vnet.ibm.com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vogt at linux dot vnet.ibm.com @ 2014-02-25  9:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Dominik Vogt <vogt at linux dot vnet.ibm.com> ---
Created attachment 32209
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32209&action=edit
test program


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

* [Bug target/60337] s390: Function arguments are not aligned
  2014-02-25  9:55 [Bug target/60337] New: s390: Function arguments are not aligned vogt at linux dot vnet.ibm.com
  2014-02-25  9:56 ` [Bug target/60337] " vogt at linux dot vnet.ibm.com
@ 2014-02-25 10:09 ` vogt at linux dot vnet.ibm.com
  2014-02-25 10:13 ` rguenth at gcc dot gnu.org
  2014-02-26  8:34 ` vogt at linux dot vnet.ibm.com
  3 siblings, 0 replies; 5+ messages in thread
From: vogt at linux dot vnet.ibm.com @ 2014-02-25 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Dominik Vogt <vogt at linux dot vnet.ibm.com> ---
(libffi does not honour the alignment either.)


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

* [Bug target/60337] s390: Function arguments are not aligned
  2014-02-25  9:55 [Bug target/60337] New: s390: Function arguments are not aligned vogt at linux dot vnet.ibm.com
  2014-02-25  9:56 ` [Bug target/60337] " vogt at linux dot vnet.ibm.com
  2014-02-25 10:09 ` vogt at linux dot vnet.ibm.com
@ 2014-02-25 10:13 ` rguenth at gcc dot gnu.org
  2014-02-26  8:34 ` vogt at linux dot vnet.ibm.com
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-02-25 10:13 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ABI, diagnostic
             Target|                            |s390x-*-*

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's the same on x86 I suppose - the aligned() attribute would have to change
the ABI for non-register passing as aligning the argument stack cannot fulfil
alignment requirements for more than one argument.

IMHO this should be simply diagnosed.

I don't see in your testcase where "Also, a parameter that is passed in a
register and then copied to the stack is not aligned." happens.


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

* [Bug target/60337] s390: Function arguments are not aligned
  2014-02-25  9:55 [Bug target/60337] New: s390: Function arguments are not aligned vogt at linux dot vnet.ibm.com
                   ` (2 preceding siblings ...)
  2014-02-25 10:13 ` rguenth at gcc dot gnu.org
@ 2014-02-26  8:34 ` vogt at linux dot vnet.ibm.com
  3 siblings, 0 replies; 5+ messages in thread
From: vogt at linux dot vnet.ibm.com @ 2014-02-26  8:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Dominik Vogt <vogt at linux dot vnet.ibm.com> ---
With -O2 and -O3 all three cases generate the proper alignment
With -O1 only foo() has the proper alignment
With -O0 none of the cases has the proper alignment

==> Code compiled with -O0 and -O3 accidentally uses a different ABI.

Power shows the same erratic behaviour, on amd64 alignment works with all
-O{0,1,2,3}.


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

end of thread, other threads:[~2014-02-26  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-25  9:55 [Bug target/60337] New: s390: Function arguments are not aligned vogt at linux dot vnet.ibm.com
2014-02-25  9:56 ` [Bug target/60337] " vogt at linux dot vnet.ibm.com
2014-02-25 10:09 ` vogt at linux dot vnet.ibm.com
2014-02-25 10:13 ` rguenth at gcc dot gnu.org
2014-02-26  8:34 ` vogt at linux dot vnet.ibm.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).