Skip to content

Fix intrinsic error location#4502

Open
Jean-Christian-Cirstea wants to merge 1 commit intoRust-GCC:masterfrom
Jean-Christian-Cirstea:fix_bswap_intrinsic_parameter_location_error
Open

Fix intrinsic error location#4502
Jean-Christian-Cirstea wants to merge 1 commit intoRust-GCC:masterfrom
Jean-Christian-Cirstea:fix_bswap_intrinsic_parameter_location_error

Conversation

@Jean-Christian-Cirstea
Copy link
Copy Markdown

@Jean-Christian-Cirstea Jean-Christian-Cirstea commented Mar 25, 2026

When an intrisic is used with an incorrect type, prin the location of
the call site, not the declaration.

Fixes #4465.

gcc/rust/ChangeLog:

* backend/rust-intrinsic-handlers.cc: use call site error
location instead of the declaration location

gcc/testsuite/ChangeLog:

* rust/compile/bswap.rs: update error location
* rust/compile/ctlz.rs: update error location
* rust/compile/ctlz_nonzero.rs: update error location
* rust/compile/torture/intrinsics-5.rs: update error location
* rust/compile/torture/intrinsics-7.rs: update error location

Copy link
Copy Markdown
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

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

The changes look good to me but there are a couple issues with the testsuite where error locations haven't been updated, e.g. rust/compile/torture/intrinsics-5.rs and rust/compile/torture/intrinsics-7.rs. But overall I'm happy with this and once it's fixed I'd like to get it merged :) Thank you!

Comment thread gcc/testsuite/rust/compile/bswap.rs Outdated
@Jean-Christian-Cirstea Jean-Christian-Cirstea force-pushed the fix_bswap_intrinsic_parameter_location_error branch from 64f7a4a to 9c25095 Compare March 26, 2026 16:28
When an intrisic is used with an incorrect type, prin the location of
the call site, not the declaration.

Fixes Rust-GCC#4465.

gcc/rust/ChangeLog:

	* backend/rust-intrinsic-handlers.cc: use call site error
	location instead of the declaration location

gcc/testsuite/ChangeLog:

	* rust/compile/bswap.rs: update error location
	* rust/compile/ctlz.rs: update error location
	* rust/compile/ctlz_nonzero.rs: update error location
	* rust/compile/torture/intrinsics-5.rs: update error location
	* rust/compile/torture/intrinsics-7.rs: update error location

Signed-off-by: Jean-Christian CÎRSTEA <jean-christian.cirstea@tuta.com>
@Jean-Christian-Cirstea Jean-Christian-Cirstea force-pushed the fix_bswap_intrinsic_parameter_location_error branch from 9c25095 to d6a11ed Compare March 26, 2026 19:05
@Jean-Christian-Cirstea Jean-Christian-Cirstea changed the title Fix bswap intrinsic error location Fix intrinsic error location Mar 26, 2026
@dkm
Copy link
Copy Markdown
Member

dkm commented Mar 30, 2026

👋
small nit... But the changelog is not correct:

	* backend/rust-intrinsic-handlers.cc: use call site error
	location instead of the declaration location

It's supposed to be:

   * file (item, item, item): Bla.

you should have the list of all modified functions. The helper script should correctly provide you with a sensible skeleton.
Let us know if you have any issue with this :)

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.

Intrinsic parameter error location is incorrect

4 participants