-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
missed optimization leading to compiletime assert with address sanitizer #41925
Comments
See also: ClangBuiltLinux/linux#580 |
I bisected using Arnd's reproducer: 3bf72d7 is the first bad commit
clang/lib/AST/ExprConstant.cpp | 69 +++++++++--------------- $ git bisect log good: [7b55654] Fix build breakage from llvm r351317git bisect good 7b55654 bad: [617df20] [CodeGen] Add larger vector types for i32 and f32git bisect bad 617df20 bad: [5e165fb] [NFC] Add missing revision number in libc++ ABI changeloggit bisect bad 5e165fb bad: [7f78d47] [DebugInfo] Apply subprogram attributes on behalf of owner CUgit bisect bad 7f78d47 good: [bd3adbb] [X86][SSE] Add tests showing missing SimplifyDemandedVectorElts support for X86ISD::BLENDVgit bisect good bd3adbb bad: [9e5e868] AMDGPU/GlobalISel: Fix RegBankSelect for GEP.git bisect bad 9e5e868 bad: [a2f6093] llvm-lib: Implement /list flaggit bisect bad a2f6093 good: [baf2f35] sanitizers: Introduce ThreadType enumgit bisect good baf2f35 good: [340cb87] [llvm-objcopy] Add --redefine-symsgit bisect good 340cb87 good: [2add627] [analyzer] Opt-in C Style Cast Checker for OSObject pointersgit bisect good 2add627 bad: [b041a18] Temporarily disable calls to getgrnam/getgrnam_r in test due to it hitting unrelated issues in EGLIBC 2.19.git bisect bad b041a18 bad: [1386d99] [x86] add test for miscompiling setcc transform (#40657 ); NFCgit bisect bad 1386d99 bad: [3edf63c] [lld-link] better error message when failing to open archive membersgit bisect bad 3edf63c bad: [3bf72d7] [Sema] Make string literal init an rvalue.git bisect bad 3bf72d7 good: [57e60a5] Fix typogit bisect good 57e60a5 first bad commit: [3bf72d7] [Sema] Make string literal init an rvalue. |
It looks like without my patch, "b[sizeof(b) - 2]" got constant-folded by clang; with my patch, it doesn't get constant-folded by clang. This is basically the same thing that happened to encode-test.m, and wasn't really intentional, as far as I can tell. Without asan, the load is eventually optimized away by GVN. With asan, we explicitly disable the optimization in question (see https://reviews.llvm.org/D14763). I see a few options here to move forward:
|
Thanks for the tip, will send such a patch (I've confirmed it works around the issue). |
Extended Description
The current clang-9 prerelease causes one file in the linux kernel to get fail compilation with an assertion triggering when building with -sanitize=kernel-address:
$ clang-9 -O2 -fsanitize=kernel-address -S dbg.i -o- | grep compiletime
callq __compiletime_assert_2790
both clang-8 and gcc-8 pass the assertion here.
See also https://godbolt.org/z/cPrkv4
The text was updated successfully, but these errors were encountered: