xref: /llvm-project/compiler-rt/test/asan/TestCases/Posix/lto-constmerge-odr.cpp (revision dde44f488c454b71d77ac022642b8711a8c340ca)
1 /// Instrumented globals are added to llvm.compiler.used, so LTO will not const
2 /// merge them (which will cause spurious ODR violation).
3 // RUN: %clangxx_asan -O3 -fuse-ld=lld -flto %s -o %t
4 // RUN: %run %t 2>&1
5 
6 // REQUIRES: lld-available, lto
7 
main(int argc,const char * argv[])8 int main(int argc, const char * argv[]) {
9   struct { long width, height; } a = {16, 16};
10   struct { long width, height; } b = {16, 16};
11 
12   // Just to make sure 'a' and 'b' don't get optimized out.
13   asm volatile("" : : "r" (&a), "r" (&b));
14 
15   return 0;
16 }
17