-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Regression in Fedora adcli package caused by 7954a0514ba7de40dba6c598af830fd1b7a8bf0c #119099
Comments
@tstellar could you provide more details on how this project is built, i.e. how to configure the build and what flags are used? |
Here is a Dockerfile that will reproduce the issue:
|
The issue boils down to a strict-aliasing violation https://clang.godbolt.org/z/6PKqE4b88 We have
Here we define
|
Is there a flag or sanitizer I can use to catch these, so I don't end up filing more erroneous bugs? |
There's a work-in-progress type sanitizer (#76261), which is getting close to landing. This particular case is currently missed by it though unfortunately due to missing instrumentation for the case |
While there are no special rules in the standards regarding void pointers and strict aliasing, emitting distinct tags for void pointers break some common idioms and there is no good alternative to re-write the code without strict-aliasing violations. An example is to count the entries in an array of pointers: int count_elements(void * values) { void **seq = values; int count; for (count = 0; seq && seq[count]; count++); return count; } https://clang.godbolt.org/z/8dTv51v8W An example in the wild is from llvm#119099 This patch avoids emitting distinct tags for void pointers, to avoid those idioms causing mis-compiles for now.
While there are no special rules in the standards regarding void pointers and strict aliasing, emitting distinct tags for void pointers break some common idioms and there is no good alternative to re-write the code without strict-aliasing violations. An example is to count the entries in an array of pointers: int count_elements(void * values) { void **seq = values; int count; for (count = 0; seq && seq[count]; count++); return count; } https://clang.godbolt.org/z/8dTv51v8W An example in the wild is from llvm#119099 This patch avoids emitting distinct tags for void pointers, to avoid those idioms causing mis-compiles for now.
I put up #122116 to not emit distinct TBAA tags for void * pointers, to avoid breaking common idioms using void * |
I worry a bit about that leading to more confusion (propagating myths about Also, this is AFAICT the only reported instance so far. I would say it should be reported upstream to adcli first and see what they say. EDIT: That said, see Andrew Pinski's comment about GCC's behaviour at #122116 (comment). |
I agree that ideally we wouldn't have to add a special carveout for But it might be worth being pragmatic here (and follow GGC's behavior). The PR is not specifically to fix |
(also might be good to use the #122116 to discuss the change itself :) ) |
(yes, quite fair - sorry!) |
While there are no special rules in the standards regarding void pointers and strict aliasing, emitting distinct tags for void pointers break some common idioms and there is no good alternative to re-write the code without strict-aliasing violations. An example is to count the entries in an array of pointers: int count_elements(void * values) { void **seq = values; int count; for (count = 0; seq && seq[count]; count++); return count; } https://clang.godbolt.org/z/8dTv51v8W An example in the wild is from llvm#119099 This patch avoids emitting distinct tags for void pointers, to avoid those idioms causing mis-compiles for now.
While there are no special rules in the standards regarding void pointers and strict aliasing, emitting distinct tags for void pointers break some common idioms and there is no good alternative to re-write the code without strict-aliasing violations. An example is to count the entries in an array of pointers: int count_elements(void * values) { void **seq = values; int count; for (count = 0; seq && seq[count]; count++); return count; } https://clang.godbolt.org/z/8dTv51v8W An example in the wild is from llvm#119099 This patch avoids emitting distinct tags for void pointers, to avoid those idioms causing mis-compiles for now.
While there are no special rules in the standards regarding void pointers and strict aliasing, emitting distinct tags for void pointers break some common idioms and there is no good alternative to re-write the code without strict-aliasing violations. An example is to count the entries in an array of pointers: int count_elements(void * values) { void **seq = values; int count; for (count = 0; seq && seq[count]; count++); return count; } https://clang.godbolt.org/z/8dTv51v8W An example in the wild is from llvm#119099 This patch avoids emitting distinct tags for void pointers, to avoid those idioms causing mis-compiles for now.
While there are no special rules in the standards regarding void pointers and strict aliasing, emitting distinct tags for void pointers break some common idioms and there is no good alternative to re-write the code without strict-aliasing violations. An example is to count the entries in an array of pointers: int count_elements(void * values) { void **seq = values; int count; for (count = 0; seq && seq[count]; count++); return count; } https://clang.godbolt.org/z/8dTv51v8W An example in the wild is from llvm#119099 This patch avoids emitting distinct tags for void pointers, to avoid those idioms causing mis-compiles for now.
While there are no special rules in the standards regarding void pointers and strict aliasing, emitting distinct tags for void pointers break some common idioms and there is no good alternative to re-write the code without strict-aliasing violations. An example is to count the entries in an array of pointers: int count_elements(void * values) { void **seq = values; int count; for (count = 0; seq && seq[count]; count++); return count; } https://clang.godbolt.org/z/8dTv51v8W An example in the wild is from llvm#119099 This patch avoids emitting distinct tags for void pointers, to avoid those idioms causing mis-compiles for now.
I'm seeing a test case (test_ldap) for the adcli-0.9.2 Fedora package segfaulting with current main (342c8db). I've bisected the failure to commit 7954a05
The backtrace for the segfault is:
The source code for the project is here
It seems like it could be a case of UB, but I'm not sure. What other information would be helpful for reproducing?
The text was updated successfully, but these errors were encountered: