public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57271] New: ARM: gcc generates insufficient alignment for memory passed as extra argument for function return large composite type
@ 2013-05-14 10:52 java4ada at yahoo dot com
  2013-05-14 10:55 ` [Bug c++/57271] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: java4ada at yahoo dot com @ 2013-05-14 10:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57271
           Summary: ARM: gcc generates insufficient alignment for memory
                    passed as extra argument for function return large
                    composite type
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: java4ada at yahoo dot com

Created attachment 30109
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30109&action=edit
Testcase and output

Please find enclosed input Vector4.ii and Vector4.s compiled with "./xgcc -fpic
 -mfloat-abi=softfp -mthumb -Os -march=armv7-a -mfpu=neon -S Vector4.ii".

Because function initVector4() returns instance of Vector4 16-byte in size, GCC
passes internal memory buffer as the first argument to hold the return value. 
This is shown in Vector4.s line#54 "add r0,sp,#8", and the buffer is filled at
line#33 "vst1.64 {d16-d17}, [r0:128]".  The 128-bit alignment hint is due to
the fact that class Vector4 is declared to be 16-byte aligned.  Problem is, r0
may not be aligned to 16-byte if sp is 16-byte aligned, which results in crash
at vst1.64 [:128].  It seems that GCC doesn't honor the alignment of internal
memory buffer.

If Vector4 is declared to be 32-byte align, GCC generates extra code to ensure
r0 is properly aligned.  I assume GCC should do it as low as 16-byte too.


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

end of thread, other threads:[~2015-07-30 13:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-14 10:52 [Bug c++/57271] New: ARM: gcc generates insufficient alignment for memory passed as extra argument for function return large composite type java4ada at yahoo dot com
2013-05-14 10:55 ` [Bug c++/57271] " rguenth at gcc dot gnu.org
2013-05-14 11:03 ` java4ada at yahoo dot com
2013-05-14 18:27 ` pinskia at gcc dot gnu.org
2013-05-14 21:36 ` rearnsha at gcc dot gnu.org
2013-05-14 22:36 ` java4ada at yahoo dot com
2014-02-16 10:00 ` jackie.rosen at hushmail dot com
2015-05-05  9:46 ` chefmax at gcc dot gnu.org
2015-05-13 10:58 ` [Bug target/57271] " chefmax at gcc dot gnu.org
2015-07-30 13:58 ` mhw at netris 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).