public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/50527] New: inconsistent vla align
@ 2011-09-26 14:48 vries at gcc dot gnu.org
  2011-09-26 15:13 ` [Bug middle-end/50527] " rguenth at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: vries at gcc dot gnu.org @ 2011-09-26 14:48 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50527
           Summary: inconsistent vla align
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vries@gcc.gnu.org


Created attachment 25367
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25367
testcase, modified from pr43513.c testcase

To reproduce on x86_64:
...
$ gcc -Os pr43513-align.c --param large-stack-frame=30
$ ./a.out 
16byte aligned
7fff5c4ce00c
...

The address of the vla is printed, and it's not 16-byte aligned (ends in 'c').
Nevertheless the test whether the address is 16-byte aligned succeeds, and the
string '16byte aligned' is printed.

During compilation the following scenario happens:
- During the propagation of the first ccp phase, the align of the alloca (16)
  is progagated to the lhs results.0D.3306_13 as lattice value
  'CONSTANT 0x00000000000000000 (0xfffffffffffffffffffffffffffffff0)'.
- This not propagated through 'D.3307_14 = &*results.0D.3306_13'. The
  propagation does not look at the lattice value of results.0D.3306_13, but at
  the alignment of the ptr_info, which at this point is not initialised yet.
- During the finalize of the first ccp phase, ptr_info of results.0D.3306_13 is
  initialized with align 16, based on the lattice value.
- During the propagation of the second ccp phase, the align of the ptr_info
  of results.0D.3306_13 of 16 is used to propagate through to the comparison
  'if (D.3309_16 == 0)', which makes sure the '16byte aligned' string is
  printed.
- During the finalize of the second ccp phase, the alloca is folded, and
  the new declared array gets an align of 4 bytes.


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

end of thread, other threads:[~2011-10-13 11:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-26 14:48 [Bug middle-end/50527] New: inconsistent vla align vries at gcc dot gnu.org
2011-09-26 15:13 ` [Bug middle-end/50527] " rguenth at gcc dot gnu.org
2011-09-26 15:30 ` rguenth at gcc dot gnu.org
2011-09-27  9:29 ` vries at gcc dot gnu.org
2011-09-27 10:06 ` vries at gcc dot gnu.org
2011-09-27 10:08 ` rguenther at suse dot de
2011-09-27 11:11 ` vries at gcc dot gnu.org
2011-09-27 11:25 ` rguenther at suse dot de
2011-09-27 13:47 ` vries at gcc dot gnu.org
2011-10-07 12:50 ` vries at gcc dot gnu.org
2011-10-07 12:51 ` vries at gcc dot gnu.org
2011-10-07 13:38 ` vries at gcc dot gnu.org
2011-10-13 11:10 ` vries at gcc dot gnu.org
2011-10-13 11:18 ` vries at gcc dot gnu.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).