public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/52402] New: IPA-SRA creates aligned loads from unaligned memory
@ 2012-02-27 15:22 rguenth at gcc dot gnu.org
  2012-02-27 15:32 ` [Bug tree-optimization/52402] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-27 15:22 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52402
           Summary: IPA-SRA creates aligned loads from unaligned memory
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org
                CC: jamborm@gcc.gnu.org
            Target: x86_64-*-*


The following segfaults at -O2

typedef int v4si __attribute__((vector_size(16)));
struct T { v4si i[2]; int j; };

static v4si __attribute__((noinline))
foo (struct T t)
{
  return t.i[0];
}

static struct T *__attribute__((noinline))
init ()
{
  char *p = __builtin_malloc (sizeof (struct T) + 1);
  p++;
  __builtin_memset (p, 1, sizeof (struct T));
  return (struct T *)p;
}

int main()
{
  struct T *p;
  p = init ();
  if (foo (*p)[0] != 0x01010101)
    __builtin_abort ();
  return 0;
}

this is because ipa-prop.c:ipa_modify_call_arguments blindly loads
from *p as if it were properly aligned.


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

end of thread, other threads:[~2013-08-27 13:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-27 15:22 [Bug tree-optimization/52402] New: IPA-SRA creates aligned loads from unaligned memory rguenth at gcc dot gnu.org
2012-02-27 15:32 ` [Bug tree-optimization/52402] " rguenth at gcc dot gnu.org
2012-02-27 15:50 ` rguenth at gcc dot gnu.org
2012-02-28  9:17 ` rguenth at gcc dot gnu.org
2012-02-28  9:20 ` rguenth at gcc dot gnu.org
2013-07-30 10:58 ` amylaar at gcc dot gnu.org
2013-08-27 13:43 ` rguenth 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).