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]
This commit is contained in:
Mike Frysinger
2023-12-24 05:13:42 -05:00
parent 6541385ca2
commit 012c1f072f
3 changed files with 28 additions and 2 deletions

View File

@@ -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)
)