diff options
author | Mike Frysinger <vapier@gentoo.org> | 2023-12-24 05:13:42 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2024-01-06 23:30:43 -0500 |
commit | 012c1f072f7f1611c86a912f0964e45136ea38cc (patch) | |
tree | 0349c03edfa8d83fe31e8890e762d4d52aae28da /cpu | |
parent | 6541385ca26947a6a212e942ec2a87afaa7b9f5c (diff) | |
download | gdb-012c1f072f7f1611c86a912f0964e45136ea38cc.zip gdb-012c1f072f7f1611c86a912f0964e45136ea38cc.tar.gz gdb-012c1f072f7f1611c86a912f0964e45136ea38cc.tar.bz2 |
sim: cris: add error fallbacks when decoding condition & swap codes
The condition & swap code decoder only checks known bits and sets
based on that. If the variable is out of range, it ends up returning
uninitialized data. Turn that case into a hard error.
This fixes build warnings like:
sim/cris/semcrisv10f-switch.c:13115:11: error:
variable 'tmp_condres' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
Diffstat (limited to 'cpu')
-rw-r--r-- | cpu/cris.cpu | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cpu/cris.cpu b/cpu/cris.cpu index ba5ed18..32a1e2d 100644 --- a/cpu/cris.cpu +++ b/cpu/cris.cpu @@ -550,7 +550,8 @@ (condn condc) ((eq tmpcond condn) (set condres (.sym condc -condition)))) (.iota 16) - cris-condition-codes))) + cris-condition-codes)) + (else (error "Unknown condition code"))) condres) ) @@ -3710,7 +3711,8 @@ ((eq tmpcode x-swapcode) (set tmpres ((.sym swap- x-swap) tmpval)))) (.iota 16) - (.splice _ (.unsplice cris-swap-codes))))) + (.splice _ (.unsplice cris-swap-codes)))) + (else (error "Unknown swapcode"))) tmpres) ) |