JuliaHubOSS / llvm-cbe

resurrected LLVM "C Backend", with improvements
Other
838 stars 144 forks source link

Respect the alignment attribute of functions. #186

Closed bcoppens closed 8 months ago

bcoppens commented 9 months ago

This is necessary to support calls to function pointer calls to member functions (which need to be aligned to 2, and the generated code crashes if this happens to be not the case)

vtjnash commented 8 months ago
C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\popen-gw3\test_consistent_return_value_c7\cbe.c(62): error C2024: 'alignas' attribute applies to variables, data members and tag types only

The test needs to be disabled for windows

vtjnash commented 8 months ago

Some test_dtor seem to still need fixing. And run git clang-format on the branch please

bcoppens commented 8 months ago

For the remaining failures:

vtjnash commented 8 months ago

Yes, building with no-strict-aliasing should be fine, since the output isn't tbaa-safe anyways (I think there is an issue about that). I'd guess that it considers an aligned function to be a different type than the loaded function type?

No idea why test_char_sized_ptr_math_decr would be affected, since this change would fail on msvc anyways if it affected the code. Hopefully it will pass next time. EDIT: https://github.com/JuliaHubOSS/llvm-cbe/issues/169