Skip to content
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

"misaligned address" problem with gcc 12 and gcc 13 #192

Open
N-Maas opened this issue Oct 2, 2024 · 0 comments
Open

"misaligned address" problem with gcc 12 and gcc 13 #192

N-Maas opened this issue Oct 2, 2024 · 0 comments

Comments

@N-Maas
Copy link
Collaborator

N-Maas commented Oct 2, 2024

TL;DR: switching to gcc 14 or gcc 11 fixes the errors

With gcc 12 and gcc 13, running the tests in debug mode with address sanitizer enabled causes "misaligned address" errors that look like this (compare #188):

/usr/include/oneapi/tbb/parallel_invoke.h:40:5: runtime error: reference binding to misaligned address 0x76d6aa343320 for type 'struct __as_base ', which requires 64 byte alignment
0x76d6aa343320: note: pointer points here
 d6 76 00 00  40 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  20 8f cc 94 d6 76 00 00  40 00 00 00
              ^ 
/usr/include/oneapi/tbb/parallel_invoke.h:40:5: runtime error: member access within misaligned address 0x76d6aa343320 for type 'struct function_invoker', which requires 64 byte alignment
0x76d6aa343320: note: pointer points here
 d6 76 00 00  40 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  20 8f cc 94 d6 76 00 00  40 00 00 00
              ^ 

This issue should ensure awareness of the problem. However, as discussed in the following, there is likely no action required.

The errors only happen when using either gcc 12 or gcc 13 (tested on Ubuntu 24.04). Neither older gcc versions, gcc 14.0.1 nor clang cause the same problem. The stack trace points into TBB internals, it seems that a TBB struct declared as alignas(64) is misaligned. However, as far as I can tell the struct is just stack allocated, so the alignment should be ensured by the compiler itself.

Overall, I'm not sure whether it is UB in our code, UB in TBB or a compiler bug. However, the fact that it only happens with two specific gcc versions makes the last option actually seem plausible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant