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

Respect the alignment attribute of functions. #186

Merged
merged 8 commits into from
Jan 15, 2024

Conversation

bcoppens
Copy link
Contributor

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)

…pport 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
Copy link
Member

vtjnash commented Jan 12, 2024

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
Copy link
Member

vtjnash commented Jan 13, 2024

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

…ate #define for this, which is a no-op on MSVC

Given that this occurs in several tests, and the MSVC tests have error-on-warning, this is a comment rather than a #warning
@bcoppens
Copy link
Contributor Author

bcoppens commented Jan 13, 2024

For the remaining failures:

  • on Linux, on my machine I can't reproduce the 'dereferencing type-punned pointer will break strict-aliasing rules', but probably I have an older gcc. However, that seems to be a different issue that's not caused by this patch / issue. Would (temporarily) adding a // gcc_extra_args: -Wno-error=strict-aliasing to the test be an acceptable workaround?
  • on Windows, the test_char_sized_ptr_math_decr crash, I don't understand what's happening there. I don't have a Windows system to test/debug it on, but looking at the generated code for that test case on Linux, these changes don't affect this test case?

@vtjnash
Copy link
Member

vtjnash commented Jan 13, 2024

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: #169

@vtjnash vtjnash enabled auto-merge (squash) January 14, 2024 18:55
@vtjnash vtjnash merged commit 2f72e15 into JuliaHubOSS:master Jan 15, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants