diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2025-07-05 12:38:35 -0700 |
---|---|---|
committer | Andrew Pinski <quic_apinski@quicinc.com> | 2025-07-06 07:57:47 -0700 |
commit | 5c2dc85c1923af118a9ec9657dc969fd3d95498a (patch) | |
tree | 992224794e5fdeac1208e233fe1317015fc2ca0e /gcc/rust/hir/tree/rust-hir-pattern-abstract.h | |
parent | 5c0758c174c596215857427092e33353f4c1fa72 (diff) | |
download | gcc-5c2dc85c1923af118a9ec9657dc969fd3d95498a.zip gcc-5c2dc85c1923af118a9ec9657dc969fd3d95498a.tar.gz gcc-5c2dc85c1923af118a9ec9657dc969fd3d95498a.tar.bz2 |
tree-cfg: Reject constants and addr on lhs for assign single [PR120921]
For GIMPLE_SINGLE_RHS, we don't currently test LHS for some invalid cases.
In this case all constants and ADDR_EXPR should be invalid on the LHS.
Also for vector (non-empty) constructors, the LHS needs to be an is_gimple_reg.
This adds the checks.
Also this fixes the following gimple testcase so it no longer ICEs, all functions are correctly rejected:
```
typedef vector int vi;
void __GIMPLE b1(int t) {
1 = t;
}
void __GIMPLE b2() {
1 = 2;
}
void __GIMPLE b3(int t, int t1) {
&t1 = &t;
}
void __GIMPLE b4(vi t, vi t1) {
_Literal(vi){0} = _Literal(vi){1};
}
void __GIMPLE b5(vi t, vi t1) {
_Literal(vi){t} = _Literal(vi){t1};
}
```
Bootstrapped and tested on x86_64-linux-gnu.
PR middle-end/120921
gcc/ChangeLog:
* tree-cfg.cc (verify_gimple_assign_single): Reject constant and address expression LHS.
For non-empty vector constructors, make sure the LHS is an is_gimple_reg.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'gcc/rust/hir/tree/rust-hir-pattern-abstract.h')
0 files changed, 0 insertions, 0 deletions