target/i386: Correct misplaced break statement in gen_shiftd_rm_T1()
RFC 1/1 target/i386: Correct misplaced break statement in gen_shiftd_rm_T1()
Reported by GCC9 when building with CFLAG -Wimplicit-fallthrough=2:
CC target/i386/translate.o
target/i386/translate.c: In function ‘gen_shiftd_rm_T1’:
target/i386/translate.c:1785:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
1785 | if (is_right) {
| ^
target/i386/translate.c:1810:5: note: here
1810 | default:
| ^~~~~~~cc1: all warnings being treated as errors
--- target/i386/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/translate.c +1 -1
@@ -1805,8 +1805,8 @@ static void gen_shiftd_rm_T1(DisasContext *s, TCGMemOp ot, int op1,tcg_gen_shri_i64 (s->tmp0, s->tmp0,32 ); tcg_gen_shri_i64(s->T0, s->T0, 32); } -break ;#endif +break ;default :tcg_gen_subi_tl (s->tmp0, count,1 );if (is_right) {
Signature · 1 line
2.20.1
Quoted 24 lines · Philippe Mathieu-Daudé
Reported by GCC9 when building with CFLAG -Wimplicit-fallthrough=2:
CC
target/i386/translate.o
target/i386/translate.c: In function ‘gen_shiftd_rm_T1’:
target/i386/translate.c:1785:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
1785 | if (is_right) {
| ^
target/i386/translate.c:1810:5: note: here1810 | default: | ^~~~~~~cc1: all warnings being treated as errors
Fixes f437d0a3c24Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/i386/translate.c +0
-0
target/i386/translate.c static void gen_shiftd_rm_T1(DisasContext *s, TCGMemOp ot, int op1, · line 1812
Quoted 9 lines
target/i386/translate.c +1
-1@@ -1805,8 +1805,8 @@ static void gen_shiftd_rm_T1(DisasContext *s, TCGMemOp ot, int op1,tcg_gen_shri_i64 (s->tmp0, s->tmp0,32 ); tcg_gen_shri_i64(s->T0, s->T0, 32); } -break ;#endif +break ;default :tcg_gen_subi_tl (s->tmp0, count,1 );if (is_right) {
I haven't looked closely at the code but I would guess that the fallthrough is intended, because the default label has an "ot == MO_16" condition.
It certainly needs more comments... :(
Paolo
Quoted 31 lines · Paolo Bonzini
Quoted 29 lines · Philippe Mathieu-Daudé
Reported by GCC9 when building with CFLAG -Wimplicit-fallthrough=2:
CC
target/i386/translate.o
target/i386/translate.c: In function ‘gen_shiftd_rm_T1’:
target/i386/translate.c:1785:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
1785 | if (is_right) {
| ^
target/i386/translate.c:1810:5: note: here1810 | default: | ^~~~~~~cc1: all warnings being treated as errors
Fixes f437d0a3c24Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/i386/translate.c +1
-1@@ -1805,8 +1805,8 @@ static void gen_shiftd_rm_T1(DisasContext *s, TCGMemOp ot, int op1,tcg_gen_shri_i64 (s->tmp0, s->tmp0,32 ); tcg_gen_shri_i64(s->T0, s->T0, 32); } -break ;#endif +break ;
Quoted 8 lines
target/i386/translate.c static void gen_shiftd_rm_T1(DisasContext *s, TCGMemOp ot, int op1, · line 1812
Quoted 4 lines
target/i386/translate.c +0
-0default :tcg_gen_subi_tl (s->tmp0, count,1 );if (is_right) {I haven't looked closely at the code but I would guess that the fallthrough is intended, because the default label has an "ot ==
MO_16" condition.
Yeah, this code is really weird -- if TARGET_X86_64 then MO_16 falls through into MO_32, but if only i386 then MO_16 falls through into the default case ?!?
thanks
-- PMM
Quoted 6 lines · Peter Maydell
Quoted 3 lines
I haven't looked closely at the code but I would guess that the fallthrough is intended, because the default label has an "ot ==
MO_16" condition.Yeah, this code is really weird -- if
TARGET_X86_64thenMO_16falls through intoMO_32, but if only i386 thenMO_16falls through into the default case ?!?
Yes, and in either case MO_16 falls through into the 32-bit code. However, the i386 32-bit version and the x86-64 64-bit version are unified into a single piece of code for TARGET_LONG_BITS-bit operands.
Almost, because you still need that ugly special case for MO_16 in the default label.
Paolo