Fix bootstrap failure in combine.c and i386.c due to -Wimplicit-fallthrough

Richard Biener richard.guenther@gmail.com
Tue Sep 27 08:13:00 GMT 2016


On Tue, Sep 27, 2016 at 10:01 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Sep 27, 2016 at 09:55:24AM +0200, Eric Botcazou wrote:
>> > Seconded.  The warning should take into account existing practices instead
>> > of forcing the user to make completely bogus changes to the code (and Ada
>> > should have been tested before the patch was approved).
>>
>> I have a bootstrap failure on x86-64/Linux:
>>
>> /home/eric/svn/gcc/gcc/combine.c: In function 'rtx_code
>> simplify_comparison(rtx_code, rtx_def**, rtx_def**)':
>> /home/eric/svn/gcc/gcc/combine.c:11928:11: error: this statement may fall
>> through [-Werror=implicit-fallthrough]
>>       break;
>>            ^
>> /home/eric/svn/gcc/gcc/combine.c:11932:2: note: here
>>   case ZERO_EXTEND:
>>   ^~~~
>> /home/eric/svn/gcc/gcc/combine.c:12340:6: error: this statement may fall
>> through [-Werror=implicit-fallthrough]
>>       }
>>       ^
>> /home/eric/svn/gcc/gcc/combine.c:12343:2: note: here
>>   case LSHIFTRT:
>>   ^~~~
>>
>>         /* ... fall through ...  */
>>
>>         /* ... fall through ...  */
>>
>
> Yeah, I ran into this and another issue in i386.c.  Fixed thusly,
> bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok.

Richard.

> 2016-09-26  Jakub Jelinek  <jakub@redhat.com>
>
>         * combine.c (simplify_comparison): Add canonical FALLTHROUGH comments.
>         * config/i386/i386.c (ix86_dep_by_shift_count_body): Add FALLTHROUGH
>         comments.  Remove break after return.
>         (ix86_fp_compare_code_to_integer, has_dispatch,
>         ix86_simd_clone_usable): Remove break after return.
>
> --- gcc/combine.c.jj    2016-09-19 16:33:57.000000000 +0200
> +++ gcc/combine.c       2016-09-26 22:15:39.553198973 +0200
> @@ -11923,11 +11923,11 @@ simplify_comparison (enum rtx_code code,
>              we can treat the SUBREG as if it were a ZERO_EXTEND.  */
>           if (subreg_lowpart_p (op0)
>               && GET_MODE_PRECISION (GET_MODE (SUBREG_REG (op0))) < mode_width)
> -           /* Fall through */ ;
> +           ;
>           else
>             break;
>
> -         /* ... fall through ...  */
> +         /* FALLTHROUGH */
>
>         case ZERO_EXTEND:
>           mode = GET_MODE (XEXP (op0, 0));
> @@ -12339,7 +12339,7 @@ simplify_comparison (enum rtx_code code,
>               continue;
>             }
>
> -         /* ... fall through ...  */
> +         /* FALLTHROUGH */
>         case LSHIFTRT:
>           /* If we have (compare (xshiftrt FOO N) (const_int C)) and
>              the low order N bits of FOO are known to be zero, we can do this
> --- gcc/config/i386/i386.c.jj   2016-09-26 20:22:23.000000000 +0200
> +++ gcc/config/i386/i386.c      2016-09-26 23:15:46.988142242 +0200
> @@ -21237,9 +21237,9 @@ ix86_dep_by_shift_count_body (const_rtx
>         if (ix86_dep_by_shift_count_body (XVECEXP (set_body, 0, i),
>                                           use_body))
>           return true;
> +      /* FALLTHROUGH */
>      default:
>        return false;
> -      break;
>      }
>
>    /* Retrieve shift count of USE_BODY.  */
> @@ -21253,9 +21253,9 @@ ix86_dep_by_shift_count_body (const_rtx
>         if (ix86_dep_by_shift_count_body (set_body,
>                                           XVECEXP (use_body, 0, i)))
>           return true;
> +      /* FALLTHROUGH */
>      default:
>        return false;
> -      break;
>      }
>
>    if (shift_rtx
> @@ -22369,19 +22369,14 @@ ix86_fp_compare_code_to_integer (enum rt
>      case ORDERED:
>      case UNORDERED:
>        return code;
> -      break;
>      case UNEQ:
>        return EQ;
> -      break;
>      case UNLT:
>        return LTU;
> -      break;
>      case UNLE:
>        return LEU;
> -      break;
>      case LTGT:
>        return NE;
> -      break;
>      default:
>        return UNKNOWN;
>      }
> @@ -49500,7 +49495,6 @@ has_dispatch (rtx_insn *insn, int action
>
>        case IS_DISPATCH_ON:
>         return true;
> -       break;
>
>        case IS_CMP:
>         return is_cmp (insn);
> @@ -49958,7 +49952,6 @@ ix86_simd_clone_usable (struct cgraph_no
>        if (!TARGET_AVX)
>         return -1;
>        return TARGET_AVX2 ? 1 : 0;
> -      break;
>      case 'd':
>        if (!TARGET_AVX2)
>         return -1;
>
>
>         Jakub



More information about the Gcc-patches mailing list