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

            Bug ID: 21977
           Summary: invalid codgen for static var in inline function that
                    is constant in some TU but not in others
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

Both clang and gcc have problems with these tests.

In the first one, if it is compiled as

$CXX -c test1a.cpp -fPIC -O2
$CXX -c test1b.cpp -fPIC
$CXX test1b.o test1a.o -o t1

the resulting program will segfault trying to write to constant memory.

On the second test, if compiled as

$CXX -c test2a.cpp -fPIC -O2
$CXX -c test2b.cpp -fPIC
$CXX test2a.o test2b.o -o t2

it will return the wrong value since the linker will keep the zero initialized
x but the inlined f will think that x is constant and doesn't need
initialization.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to