gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

gccrs: Fix ICE in handle_inline_attribute_on_fndecl

Open varun-r-mallya opened this issue 8 months ago • 8 comments

I added a check to see if the attr_input_type was a TOKEN_TREE and added an error message if a LITERAL is passed to it.

Fixes #3658

gcc/rust/ChangeLog:

* backend/rust-compile-base.cc (HIRCompileBase::handle_inline_attribute_on_fndecl):
Handle LITERAL attribute input type.

gcc/testsuite/ChangeLog:

* rust/compile/issue-3658.rs: New test.

Thank you for making Rust GCC better!

If your PR fixes an issue, you can add "Fixes #issue_number" into this PR description and the git commit message. This way the issue will be automatically closed when your PR is merged. If your change addresses an issue but does not fully fix it please mark it as "Addresses #issue_number" in the git commit message.

Here is a checklist to help you with your PR.

  • [x] GCC development requires copyright assignment or the Developer's Certificate of Origin sign-off, see https://gcc.gnu.org/contribute.html or https://gcc.gnu.org/dco.html
  • [x] Read contributing guidlines
  • [x] make check-rust passes locally
  • [x] Run clang-format
  • [ ] Added any relevant test cases to gcc/testsuite/rust/

Note that you can skip the above if you are just opening a WIP PR in order to get feedback.

*Please write a comment explaining your change. This is the message that will be part of the merge commit.

varun-r-mallya avatar Apr 17 '25 18:04 varun-r-mallya

FTR, in the changelog, you're supposed to give extra info, not only the filename:

   * backend/rust-compile-base.cc (HIRCompileBase::handle_inline_attribute_on_fndecl): Handle LITERAL attribute input type.

dkm avatar Apr 17 '25 19:04 dkm

FTR, in the changelog, you're supposed to give extra info, not only the filename:

   * backend/rust-compile-base.cc (HIRCompileBase::handle_inline_attribute_on_fndecl): Handle LITERAL attribute input type.

Just made the requested change.

varun-r-mallya avatar Apr 17 '25 19:04 varun-r-mallya

You must also use full issue ref, not only #<number>. We need this because commits will be contributed to GCC, so a bare #3658 will be ambiguous and will probably cause issue with the various bug trackers involved.

Please use Rust-GCC/gccrs#3658 instead (will be rendered the same here : Rust-GCC/gccrs#3658)

dkm avatar Apr 18 '25 07:04 dkm

(obviously, https://github.com/Rust-GCC/gccrs/actions/runs/14523528568/job/40749776631?pr=3754 didn't work as expected...)

dkm avatar Apr 18 '25 07:04 dkm

(obviously, https://github.com/Rust-GCC/gccrs/actions/runs/14523528568/job/40749776631?pr=3754 didn't work as expected...)

would this be something I could fix in the CI so it fails properly ?

varun-r-mallya avatar Apr 18 '25 07:04 varun-r-mallya

https://github.com/Rust-GCC/gccrs/pull/3754#issuecomment-2814723242 fixed :)

varun-r-mallya avatar Apr 18 '25 07:04 varun-r-mallya

(obviously, https://github.com/Rust-GCC/gccrs/actions/runs/14523528568/job/40749776631?pr=3754 didn't work as expected...)

would this be something I could fix in the CI so it fails properly ?

probably yes :)

dkm avatar Apr 18 '25 07:04 dkm

https://github.com/Rust-GCC/gccrs/pull/3754#issuecomment-2814856629 I'll try to send in a PR soon!!

varun-r-mallya avatar Apr 18 '25 07:04 varun-r-mallya