Skip to content
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

gccrs: add checks for division by zero and left shift overflow #3279

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

philberty
Copy link
Member

These are ported from the c-family code c-warn.cc and c-typchk.cc

Fixes #2394

gcc/rust/ChangeLog:

* backend/rust-constexpr.cc (eval_store_expression): check for null
(eval_call_expression): formatting
(eval_loop_expr): formatting
* rust-gcc.cc (arithmetic_or_logical_expression): add warnings

gcc/testsuite/ChangeLog:

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

@philberty philberty added bug diagnostic diagnostic static analysis labels Dec 2, 2024
These are ported from the c-family code c-warn.cc and c/c-typchk.cc

Fixes #2394

gcc/rust/ChangeLog:

	* backend/rust-constexpr.cc (eval_store_expression): check for null
	(eval_call_expression): remove bad warning
	* rust-gcc.cc (arithmetic_or_logical_expression): add warnings

gcc/testsuite/ChangeLog:

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

Signed-off-by: Philip Herron <[email protected]>
@philberty philberty added this pull request to the merge queue Dec 2, 2024
Merged via the queue into master with commit 0d00f79 Dec 2, 2024
13 checks passed
@philberty philberty deleted the phil/warnings branch December 12, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug diagnostic diagnostic static analysis
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Failed to evaluate constant value
1 participant