[LLVMbugs] [Bug 21977] New: invalid codgen for static var in inline function that is constant in some TU but not in others

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Dec 19 07:18:01 PST 2014


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: unassignedclangbugs at nondot.org
          Reporter: rafael.espindola at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141219/46e27cc1/attachment.html>


More information about the llvm-bugs mailing list