public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/45813] New: alias analysis problem ?
@ 2010-09-28 12:34 darrenrjenkins at gmail dot com
  2010-09-28 14:06 ` [Bug rtl-optimization/45813] " rguenth at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: darrenrjenkins at gmail dot com @ 2010-09-28 12:34 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: alias analysis problem ?
           Product: gcc
           Version: 4.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: darrenrjenkins@gmail.com


I think I am having some wrong code generated due to a compiler bug.
I am compiling for ARM/Thumb.

USB_INT16U  ReadLE16U ( volatile USB_INT08U  *pmem )
{
    USB_INT16U  val;
    USB_INT08U *bytes = (USB_INT08U *)&val;

    bytes[0] = pmem[0];
    bytes[1] = pmem[1];

    return (val);
}

gives me

    B580        push {r7, lr}
    B081        sub sp, #4
    AF00        add r7, sp, #0
    1CBB        adds r3, r7, #2
    7802        ldrb r2, [r0, #0]
    701A        strb r2, [r3, #0]
    7842        ldrb r2, [r0, #1]
    8818        ldrh r0, [r3, #0]
    46BD        mov sp, r7
    B001        add sp, #4
    BC80        pop {r7}
    BC02        pop {r1}
    4708        bx r1

Which reads the second byte into r2 but does not store it on the stack, so the
second byte of val is returned uninitialized.
It looks like the alias analysis knows that bytes points to val but doesn't
know that bytes+1 points to a part of val also, so optimizes it away.

Yell out if you need any more information


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

end of thread, other threads:[~2012-07-02 10:46 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-28 12:34 [Bug rtl-optimization/45813] New: alias analysis problem ? darrenrjenkins at gmail dot com
2010-09-28 14:06 ` [Bug rtl-optimization/45813] " rguenth at gcc dot gnu.org
2010-09-28 15:09 ` mikpe at it dot uu.se
2010-09-29 11:04 ` mikpe at it dot uu.se
2010-09-29 11:04 ` darrenrjenkins at gmail dot com
2010-09-29 11:20 ` darrenrjenkins at gmail dot com
2010-09-29 11:21 ` darrenrjenkins at gmail dot com
2010-09-29 12:01 ` darrenrjenkins at gmail dot com
2010-09-29 12:48 ` rguenth at gcc dot gnu.org
2010-09-30  1:18 ` mikpe at it dot uu.se
2010-09-30  4:50 ` mikpe at it dot uu.se
2010-09-30 10:58 ` [Bug rtl-optimization/45813] [4.4/4.5 Regression] alias analysis problem with -mthumb rguenth at gcc dot gnu.org
2010-10-01 11:53 ` jakub at gcc dot gnu.org
2010-11-12 14:04 ` rguenth at gcc dot gnu.org
2011-04-16 10:15 ` jakub at gcc dot gnu.org
2011-04-19  9:06 ` rguenth at gcc dot gnu.org
2012-03-13 14:40 ` [Bug rtl-optimization/45813] [4.5 " jakub at gcc dot gnu.org
2012-03-13 17:06 ` bernds at gcc dot gnu.org
2012-03-15  8:45 ` mikpe at it dot uu.se
2012-07-02 10:46 ` 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).