llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-compiler-rt-sanitizer Author: Vitaly Buka (vitalybuka) <details> <summary>Changes</summary> Also make sure we have dynamic init variables with any `-O`. --- Full diff: https://github.com/llvm/llvm-project/pull/101584.diff 2 Files Affected: - (modified) compiler-rt/test/asan/TestCases/Helpers/initialization-nobug-extra.cpp (+3-3) - (modified) compiler-rt/test/asan/TestCases/initialization-nobug.cpp (+9-8) ``````````diff diff --git a/compiler-rt/test/asan/TestCases/Helpers/initialization-nobug-extra.cpp b/compiler-rt/test/asan/TestCases/Helpers/initialization-nobug-extra.cpp index 886165affd760..0ce5359b405d0 100644 --- a/compiler-rt/test/asan/TestCases/Helpers/initialization-nobug-extra.cpp +++ b/compiler-rt/test/asan/TestCases/Helpers/initialization-nobug-extra.cpp @@ -1,9 +1,9 @@ // Linker initialized: int getAB(); -static int ab = getAB(); +int ab = getAB(); // Function local statics: int countCalls(); -static int one = countCalls(); +int one = countCalls(); // Trivial constructor, non-trivial destructor: int getStructWithDtorValue(); -static int val = getStructWithDtorValue(); +int val = getStructWithDtorValue(); diff --git a/compiler-rt/test/asan/TestCases/initialization-nobug.cpp b/compiler-rt/test/asan/TestCases/initialization-nobug.cpp index d4dc855148ad3..0b8fca3dee8b3 100644 --- a/compiler-rt/test/asan/TestCases/initialization-nobug.cpp +++ b/compiler-rt/test/asan/TestCases/initialization-nobug.cpp @@ -1,19 +1,16 @@ // A collection of various initializers which shouldn't trip up initialization // order checking. If successful, this will just return 0. -// RUN: %clangxx_asan -O0 %s %p/Helpers/initialization-nobug-extra.cpp -o %t -// RUN: %env_asan_opts=check_initialization_order=true %run %t 2>&1 -// RUN: %clangxx_asan -O1 %s %p/Helpers/initialization-nobug-extra.cpp -o %t -// RUN: %env_asan_opts=check_initialization_order=true %run %t 2>&1 -// RUN: %clangxx_asan -O2 %s %p/Helpers/initialization-nobug-extra.cpp -o %t -// RUN: %env_asan_opts=check_initialization_order=true %run %t 2>&1 -// RUN: %clangxx_asan -O3 %s %p/Helpers/initialization-nobug-extra.cpp -o %t -// RUN: %env_asan_opts=check_initialization_order=true %run %t 2>&1 +// RUN: %clangxx_asan -O0 %s %p/Helpers/initialization-nobug-extra.cpp -o %t && %env_asan_opts=check_initialization_order=true:report_globals=3 %run %t 2>&1 | FileCheck %s --implicit-check-not "DynInit" +// RUN: %clangxx_asan -O1 %s %p/Helpers/initialization-nobug-extra.cpp -o %t && %env_asan_opts=check_initialization_order=true:report_globals=3 %run %t 2>&1 | FileCheck %s --implicit-check-not "DynInit" +// RUN: %clangxx_asan -O2 %s %p/Helpers/initialization-nobug-extra.cpp -o %t && %env_asan_opts=check_initialization_order=true:report_globals=3 %run %t 2>&1 | FileCheck %s --implicit-check-not "DynInit" +// RUN: %clangxx_asan -O3 %s %p/Helpers/initialization-nobug-extra.cpp -o %t && %env_asan_opts=check_initialization_order=true:report_globals=3 %run %t 2>&1 | FileCheck %s --implicit-check-not "DynInit" // Simple access: // Make sure that accessing a global in the same TU is safe bool condition = true; +__attribute__((noinline, weak)) int initializeSameTU() { return condition ? 0x2a : 052; } @@ -46,3 +43,7 @@ StructWithDtor struct_with_dtor; int getStructWithDtorValue() { return struct_with_dtor.value; } int main() { return 0; } + + +// CHECK: DynInitPoison module: {{.*}}initialization-nobug.cpp +// CHECK: DynInitPoison module: {{.*}}initialization-nobug-extra.cpp `````````` </details> https://github.com/llvm/llvm-project/pull/101584 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits