This repository was archived by the owner on Jan 23, 2023. It is now read-only.
[release/3.1] Fix build with Clang 13 (#63314) #28232
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Port fix of build using Clang 13 to release/3.1. Backport of dotnet/runtime#63314
Customer Impact
The recently released Clang 13 has started to apply assumption that this pointer is always aligned to the natural alignment of the object. These break compilation of .NET Core 3.1 e.g. on Fedora 35 where Clang 13 is the one installed. This issue was reported by Red Hat developers.
Testing
Local builds of release and debug versions using clang 9 and clang 13
Risk
Low, there are no functional changes and the fix has been in main and release/6.0 branches for about 2 months.
Original commit message:
The clang 13 optimizer started to assume that "this" pointer is always
properly aligned. That lead to elimination of some code that was actually
needed.
It also takes pointer aliasing rules more strictly in one place in jit.
That caused the optimizer to falsely assume that a callee with an argument
passed by reference is not modifying that argument and used a stale
copy of the original value at the caller site.
This change fixes both of the issues. With this fix, runtime compiled
using clang 13 seems to be fully functional.
cc @janvorli