Skip to content

handle function alignment in miri #140072

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

Merged
merged 2 commits into from
Apr 23, 2025
Merged

Conversation

folkertdev
Copy link
Contributor

@folkertdev folkertdev commented Apr 20, 2025

tracking issue: #82232
Fixes rust-lang/miri#4282

The #[repr(align(N))] attribute on functions was ignored when using miri. For such a function, its address should be a multiple of N.

There is some further discussion in the thread #t-compiler/const-eval > function address alignment on how dyn Fn should be handled. The behavior there appears to be consistent between miri and nightly, though both may be incorrect. In any case, that can be resolved separately.

@rustbot
Copy link
Collaborator

rustbot commented Apr 20, 2025

r? @estebank

rustbot has assigned @estebank.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 20, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 20, 2025

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

The Miri subtree was changed

cc @rust-lang/miri

@RalfJung
Copy link
Member

r? @RalfJung

@rustbot rustbot assigned RalfJung and unassigned estebank Apr 20, 2025
Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks!

@RalfJung
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 22, 2025

📌 Commit 47a1278 has been approved by RalfJung

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 22, 2025
ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Apr 22, 2025
handle function alignment in miri

tracking issue: rust-lang#82232
Fixes rust-lang/miri#4282

The `#[repr(align(N))]` attribute on functions was ignored when using miri. For such a function, its address should be a multiple of `N`.

There is some further discussion in the thread [#t-compiler/const-eval > function address alignment](https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/function.20address.20alignment) on how `dyn Fn` should be handled. The behavior there appears to be consistent between miri and nightly, though both may be incorrect. In any case, that can be resolved separately.
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 22, 2025
…enton

Rollup of 8 pull requests

Successful merges:

 - rust-lang#139309 (make abi_unsupported_vector_types a hard error)
 - rust-lang#139617 (Use posix_spawn on cygwin)
 - rust-lang#140072 (handle function alignment in miri)
 - rust-lang#140104 (Fix auto diff failing on inherent impl blocks)
 - rust-lang#140124 (Update books)
 - rust-lang#140144 (Handle another negated literal in `eat_token_lit`.)
 - rust-lang#140146 (Update `compiler_builtins` to 0.1.156)
 - rust-lang#140149 (test_nan: ensure the NAN contant is quiet)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 22, 2025
…enton

Rollup of 8 pull requests

Successful merges:

 - rust-lang#139617 (Use posix_spawn on cygwin)
 - rust-lang#139921 (improve diagnostic for raw pointer field access with ->)
 - rust-lang#140031 (compiletest: Fix deadline bugs in new executor)
 - rust-lang#140072 (handle function alignment in miri)
 - rust-lang#140104 (Fix auto diff failing on inherent impl blocks)
 - rust-lang#140124 (Update books)
 - rust-lang#140144 (Handle another negated literal in `eat_token_lit`.)
 - rust-lang#140149 (test_nan: ensure the NAN contant is quiet)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 22, 2025
…enton

Rollup of 8 pull requests

Successful merges:

 - rust-lang#139617 (Use posix_spawn on cygwin)
 - rust-lang#139921 (improve diagnostic for raw pointer field access with ->)
 - rust-lang#140031 (compiletest: Fix deadline bugs in new executor)
 - rust-lang#140072 (handle function alignment in miri)
 - rust-lang#140104 (Fix auto diff failing on inherent impl blocks)
 - rust-lang#140124 (Update books)
 - rust-lang#140144 (Handle another negated literal in `eat_token_lit`.)
 - rust-lang#140149 (test_nan: ensure the NAN contant is quiet)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 107f04d into rust-lang:master Apr 23, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 23, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2025
Rollup merge of rust-lang#140072 - folkertdev:miri-fn-align, r=RalfJung

handle function alignment in miri

tracking issue: rust-lang#82232
Fixes rust-lang/miri#4282

The `#[repr(align(N))]` attribute on functions was ignored when using miri. For such a function, its address should be a multiple of `N`.

There is some further discussion in the thread [#t-compiler/const-eval > function address alignment](https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/function.20address.20alignment) on how `dyn Fn` should be handled. The behavior there appears to be consistent between miri and nightly, though both may be incorrect. In any case, that can be resolved separately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Respect repr(align) on functions
5 participants