-
Notifications
You must be signed in to change notification settings - Fork 12k
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
pngquant sigbus error on ppc64le with clang-17 #62668
Comments
@llvm/issue-subscribers-backend-powerpc |
@llvm/issue-subscribers-openmp |
Looking at the bitcode after LTO optimization, there are a few variables that gained an align 1 after this commit: Before:@.gomp_critical_user_.var = internal global [8 x i32] zeroinitializer
@.gomp_critical_user_.reduction.var = internal global [8 x i32] zeroinitializer
@.gomp_critical_user_libpng.var = internal global [8 x i32] zeroinitializer After:@.gomp_critical_user_.var = internal global [8 x i32] zeroinitializer, align 1
@.gomp_critical_user_.reduction.var = internal global [8 x i32] zeroinitializer, align 1
@.gomp_critical_user_libpng.var = internal global [8 x i32] zeroinitializer, align 1 |
It looks like unrelated to OpenMP here. |
We make those variables in https://github.com/llvm/llvm-project/blob/main/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp#L4216. We could probably set the alignment manually here based off of the type. |
So either we fix this in OpenMP as @jhuber6 suggests or we make sure that creating a GlobalVariable in a Module also sets a natural alignment. |
I'll make a patch for OpenMP at least, don't see a reason why we shouldn't naturally align these. |
Let me know if this patch resolves it https://reviews.llvm.org/D150461 |
Even with this patch, I'm still seeing a crash in the same place. I checked the IR and the variables now have align 4 instead of align 1. The generated assembly is unchanged, though. |
This is 64-bit, right? I'm curious why the alignment would be four instead of eight. Would it be possible for you to manually change them to eight to make sure that this isn't an alignment problem? |
@jhuber6 The alignment is based on the element type of the array, so I believe four is correct. Hard-coding the alignment to eight does fix the test. This makes me think it might be a codegen bug, where load alignment is being ignored. |
@llvm/issue-subscribers-backend-powerpc |
I think the bug is here. It's casting a int[8] type (with alignment 4) to a pointer type (with alignment 8). |
I'm not too familiar with |
Still seems like a codegen issue where the It seems like alignment should be added here (I don't know the exact proper way to phrase max(sizeof(int), sizeof(void*) in clang classes/terminology) or if simply
|
@jpeyton52 Proposed fix based on your suggestion: https://reviews.llvm.org/D150723 |
I've run into a regression with Clang 17, and I've bisected it to ffc1205. @gchatelet
One of the test cases from the pngquant project fails with a SIGBUS error when built with Clang 17 on ppc64le. The SIGBUS is coming from this OpenMP loop
Below is a script to build pngquant and reproduce the error. I've also attached the good and bad disassembly of the binary. Let me know what other information would help resolve this bug.
Stack Trace:
Script to Reproduce:
good.s.txt
bad.s.txt
The text was updated successfully, but these errors were encountered: