[LLVMbugs] [Bug 651] NEW: volatile incorrectly optimized away

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Nov 1 15:56:26 PST 2005


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=651

           Summary: volatile incorrectly optimized away
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: markus at oberhumer.com


llvm 20051031 incorrectly optimizes away the volatile in the program below.

~Markus


#undef NDEBUG
#include <assert.h>

void* volatile vget_ptr = (void *) 0;

static int vget_int(int v, int expr)
{
    if (vget_ptr) {
        * (int *) vget_ptr = v;
        * (int *) vget_ptr = expr;
        v = * (int *) vget_ptr;
    }
    return v;
}

int main()
{
    int r;
    r = vget_int(1, 2);
    assert(r == 1);
    return 0;
}



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




More information about the llvm-bugs mailing list