[LLVMbugs] [Bug 6349] New: miscompilation of volatile variables in msp430 backend

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Feb 18 15:54:27 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=6349

           Summary: miscompilation of volatile variables in msp430 backend
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: miscompilation
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: pagariya at cs.utah.edu
                CC: llvmbugs at cs.uiuc.edu, regehr at cs.utah.edu


Test case:

#include <stdint.h>
volatile uint32_t sink_ = 0;
volatile int32_t g_4[2];

int main(void)
{
    int i;
    for (i = 0; i < 2; i++)
        g_4[i] = 0x8B72FD49L;
    for (i = 0; i < 2; i++)
        sink_ = g_4[i];
    return 0;
}

g_4[1] is not written in the first for loop. Likewise, it is not read in the
second for loop. Both these operations are necessary since g_4 and sink_ are
volatile variables.
This miscompilation occurs only at -O0, -O1 and -Os.

pagariya at aleph:~/randprog-testing/main/tmp$ clang -ccc-host-triple msp430-elf
-I/home/pagariya/res-pagariya/llvm-msp430/msp430/include -nostdinc -v -O0 -S
test.c clang version 1.1 (trunk 170)
Target: msp430-elf-
Thread model: posix
 "/uusoc/facility/res/embed/users/pagariya/llvm-msp430/bin/clang" -cc1 -triple
msp430-elf- -S -disable-free -main-file-name test.c -mrelocation-model static
-mdisable-fp-elim -v -nostdinc -resource-dir
/uusoc/facility/res/embed/users/pagariya/llvm-msp430/lib/clang/1.1
-I/home/pagariya/res-pagariya/llvm-msp430/msp430/include -O0 -fmessage-length
102 -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o test.s -x c
test.c
clang -cc1 version 1.1 based upon llvm 2.7svn hosted on i386-pc-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
 /home/pagariya/res-pagariya/llvm-msp430/msp430/include
 /uusoc/facility/res/embed/users/pagariya/llvm-msp430/lib/clang/1.1/include
End of search list.

pagariya at aleph:~/randprog-testing/main/tmp$ clang -ccc-host-triple msp430-elf
-L/home/pagariya/res-pagariya/llvm-msp430/lib/msp430
-L/home/pagariya/res-pagariya/llvm-msp430/msp430/lib
-L/home/pagariya/res-pagariya/llvm-msp430/lib/gcc-lib/msp430/3.2.3
-Wl,-m,msp430x1611 -o test.elf
/home/pagariya/res-pagariya/llvm-msp430/msp430/lib/crt430x1611.o test.s -lgcc
-v 
clang version 1.1 (trunk 170)
Target: msp430-elf-
Thread model: posix
 "/uusoc/facility/res/embed/users/pagariya/llvm-msp430/bin/msp430-as" -o
/tmp/cc-mfSjNK.o test.s
 "/uusoc/facility/res/embed/users/pagariya/llvm-msp430/bin/msp430-ld" -o
test.elf -L/home/pagariya/res-pagariya/llvm-msp430/lib/msp430
-L/home/pagariya/res-pagariya/llvm-msp430/msp430/lib
-L/home/pagariya/res-pagariya/llvm-msp430/lib/gcc-lib/msp430/3.2.3 -m
msp430x1611 /home/pagariya/res-pagariya/llvm-msp430/msp430/lib/crt430x1611.o
/tmp/cc-mfSjNK.o -lgcc -L../lib/ -lcompiler_rt.Generic -lc


-- 
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