[LLVMbugs] [Bug 8279] New: const volatile bug

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Oct 2 07:04:29 PDT 2010


           Summary: const volatile bug
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: regehr at cs.utah.edu
                CC: llvmbugs at cs.uiuc.edu, chenyang at cs.utah.edu

Clang miscompiles the program below, it is not OK to optimize away the read
from g_1 in main after inlining func_1().

regehr at john-home:~$ clang -v
clang version 2.9 (trunk 115311)
Target: i386-pc-linux-gnu
Thread model: posix

regehr at john-home:~$ clang -O vol.c -S -o -
        .file   "vol.c"
        .globl  main
        .align  16, 0x90
        .type   main, at function
        pushl   %ebp
        movl    %esp, %ebp
        xorl    %eax, %eax
        popl    %ebp
        .size   main, .Ltmp0-main

        .type   g_1, at object
        .section        .rodata.cst4,"aM", at progbits,4
        .globl  g_1
        .align  4
        .long   1
        .size   g_1, 4

        .section        .note.GNU-stack,"", at progbits

regehr at john-home:~$ cat vol.c
const volatile int g_1 = 1;

static int func_1(void) {
  return g_1;

int main (void)
   return 0;

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list