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

             Bug #: 54494
           Summary: Missing store to volatile
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: pins...@gcc.gnu.org


Consider:

extern const unsigned long base;
static inline void wreg(unsigned char val, unsigned long addr)
{
   *((volatile unsigned char *) (base + addr)) = val;
}
void wreg_twice(void)
{
   wreg(0, 42);
   wreg(0, 42);
}
---- CUT ---
At -O2 the second store to the volatile char is removed by the strlen pass.

Reply via email to