-
Notifications
You must be signed in to change notification settings - Fork 179
gccrs: Fix ICE in handle_inline_attribute_on_fndecl #3754
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
base: master
Are you sure you want to change the base?
gccrs: Fix ICE in handle_inline_attribute_on_fndecl #3754
Conversation
d27811e
to
4b6b663
Compare
FTR, in the changelog, you're supposed to give extra info, not only the filename:
|
4b6b663
to
603be25
Compare
Just made the requested change. |
You must also use full issue ref, not only Please use |
(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 ? |
603be25
to
caecfd5
Compare
#3754 (comment) |
probably yes :) |
#3754 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add a test case to gcc/testsuite/rust/compile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there might be some issues with your clang-format setup and the file was formatted automatically? make sure you've copied <gccrs>/contrib/clang-format
to <gccrs>/.clang-format
(check the leading period is here) for your editor to pick it up automatically.
I think the changes themselves are good, well done :)
const std::string inline_option | ||
= meta_item->get_items ().at (0)->as_string (); | ||
const std::string inline_option | ||
= meta_item->get_items ().at (0)->as_string (); | ||
|
||
// we only care about NEVER and ALWAYS else its an error | ||
bool is_always = inline_option.compare ("always") == 0; | ||
bool is_never = inline_option.compare ("never") == 0; | ||
// we only care about NEVER and ALWAYS else its an error | ||
bool is_always = inline_option.compare ("always") == 0; | ||
bool is_never = inline_option.compare ("never") == 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g. this is what I mean with the formatting, it shouldn't have changed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this happened because I enclosed it in an if statement. I did try running clang-format with the file again, but it didn't really change anything. Please tell me why this is happening ? Also, it did pass the CI for clang-format so I am assuming this might be a CI bug as well if it is actually a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could reduce the nesting to avoid the extra changes by doing something like:
else if (input_type != AST::AttrInput::AttrInputType::TOKEN_TREE)
{
// emit error
}
Then carry on with logic, I think should do it
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 Rust-GCC#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. Signed-off-by: varun-r-mallya <[email protected]>
caecfd5
to
12d8a23
Compare
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:
gcc/testsuite/ChangeLog:
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.
make check-rust
passes locallyclang-format
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.