[llvm-bugs] [Bug 28391] New: ASAN incorrectly flags ODR violation on C++17 inline variables when one definition is compiled in C++14.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 1 15:09:46 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28391

            Bug ID: 28391
           Summary: ASAN incorrectly flags ODR violation on C++17 inline
                    variables when one definition is compiled in C++14.
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: eric at efcs.ca
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Reproducer:
// Steps to reproduce:
// clang++ -std=c++14 -fsanitize=address -DTU_ONE -shared -fPIC -o libfoo.so
test.cpp
// clang++ -std=c++1z -fsanitize=address test.cpp libfoo.so
// ./a.out
// EXPECTED: exit success
// ACTUAL:  AddressSanitizer: odr-violation
struct Foo {
 static constexpr bool inline_var = true;
};
#ifdef TU_ONE
constexpr bool Foo::inline_var;
#else
void test(const bool&) {}
int main() {
    test(Foo::inline_var);
}
#endif

In the above reproducer the main program generates a definition for
Foo::inline_var according to the C++17 inline variable rules. The program then
links to a library compiled as C++14 which provides the explicit definition for
`Foo::inline_bool`. When this program is run ASAN will emit an odr-violation
diagnostic for 'inline_bool'.

I believe this diagnostic is a false positive even though one of the two
definitions was not compiled with C++17 inline variable semantics.

-- 
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/20160701/9083cb6e/attachment.html>


More information about the llvm-bugs mailing list