Skip to content

Fix intrinsic error location#4502

Merged
P-E-P merged 1 commit into
Rust-GCC:masterfrom
Jean-Christian-Cirstea:fix_bswap_intrinsic_parameter_location_error
May 25, 2026
Merged

Fix intrinsic error location#4502
P-E-P merged 1 commit into
Rust-GCC:masterfrom
Jean-Christian-Cirstea:fix_bswap_intrinsic_parameter_location_error

Conversation

@Jean-Christian-Cirstea

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

Copy link
Copy Markdown
Contributor

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

@CohenArthur CohenArthur left a comment

Copy link
Copy Markdown
Member

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
@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

dkm commented Mar 30, 2026

Copy link
Copy Markdown
Member

👋
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 :)

@P-E-P P-E-P added this pull request to the merge queue May 6, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 6, 2026
@Jean-Christian-Cirstea Jean-Christian-Cirstea force-pushed the fix_bswap_intrinsic_parameter_location_error branch from d6a11ed to 1cd4629 Compare May 12, 2026 12:16
@Jean-Christian-Cirstea Jean-Christian-Cirstea force-pushed the fix_bswap_intrinsic_parameter_location_error branch from 1cd4629 to b89c63a Compare May 12, 2026 12:22
@Jean-Christian-Cirstea

Copy link
Copy Markdown
Contributor Author

@dkm Could you please check the commit changelog and tell me if there are any other issues with it?
@CohenArthur @P-E-P Could you take another look at the PR? I have included the cttz intrinsic that was added after the PR was originally created. Thank you!

@Jean-Christian-Cirstea Jean-Christian-Cirstea force-pushed the fix_bswap_intrinsic_parameter_location_error branch from b89c63a to 8ea2359 Compare May 12, 2026 13:31
@dkm

dkm commented May 22, 2026

Copy link
Copy Markdown
Member

@dkm Could you please check the commit changelog and tell me if there are any other issues with it? @CohenArthur @P-E-P Could you take another look at the PR? I have included the cttz intrinsic that was added after the PR was originally created. Thank you!

Yes, looks better thanks! Small comments though...

You can group things like:

   * file.c (bla1, bla2, bla3)
   (bla4, bla5) : Toto.
   * file2.cc (foo): Likewise.

And the idiomatic way of not copy/pasting the same text is to use Likewise..

And last one, you should end entries with a . :)

Thanks!

@Jean-Christian-Cirstea Jean-Christian-Cirstea force-pushed the fix_bswap_intrinsic_parameter_location_error branch from 8ea2359 to 3c44150 Compare May 22, 2026 17:16
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
	(check_for_basic_integer_type): Fixed typo.
	(build_atomic_builtin_name): Update message.
	(unchecked_op, atomic_store, ctlz_handler)
	(cttz_handler, bswap_handler): Use call location.

gcc/testsuite/ChangeLog:

	* rust/compile/bswap.rs: Update error location.
	* rust/compile/ctlz.rs: Likewise.
	* rust/compile/ctlz_nonzero.rs: Likewise.
	* rust/compile/cttz.rs: Likewise.
	* rust/compile/cttz_nonzero.rs: Likewise.
	* rust/compile/torture/intrinsics-5.rs: Likewise.
	* rust/compile/torture/intrinsics-7.rs: Likewise.

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 3c44150 to cbf980f Compare May 22, 2026 17:16
@Jean-Christian-Cirstea

Copy link
Copy Markdown
Contributor Author

@dkm Updated the commit message.

@P-E-P P-E-P added this pull request to the merge queue May 25, 2026
@P-E-P

P-E-P commented May 25, 2026

Copy link
Copy Markdown
Member

It looks great! Thank you!

Merged via the queue into Rust-GCC:master with commit 98d729a May 25, 2026
12 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.

Intrinsic parameter error location is incorrect

4 participants