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

             Bug #: 50078
           Summary: [4.6.1+ SVN 2011-08-13] ARM wrong code: volatile
                    accesses optimized out
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: k...@pm.waw.pl


I think armeb-pc-linux-gnueabi-gcc 4.6.2pre 20110813 (cross-compiled on x86-64)
is a bit too optimistic with -O2:

unsigned var[2];

void test(int arg)
{
    unsigned v = *(volatile unsigned *)(&var[arg]);
    *(volatile unsigned *)(&var[arg]) = v;
}

produces:
00000000 <test>:
   0:   e12fff1e        bx      lr

Reply via email to