On Tue, Mar 08, 2022 at 11:33:59AM -0500, Marek Polacek wrote:
>       PR rtl-optimization/104777
> 
> gcc/ChangeLog:
> 
>       * rtl.cc (classify_insn): For ASM_OPERANDS, return JUMP_INSN only if
>       ASM_OPERANDS_LABEL_VEC has at least one element.
> 
> gcc/testsuite/ChangeLog:
> 
>       * gcc.dg/torture/tls/pr104777.c: New test.
> ---
>  gcc/rtl.cc                                  |  4 +--
>  gcc/testsuite/gcc.dg/torture/tls/pr104777.c | 30 +++++++++++++++++++++
>  2 files changed, 32 insertions(+), 2 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.dg/torture/tls/pr104777.c
> 
> diff --git a/gcc/rtl.cc b/gcc/rtl.cc
> index f17474bfee1..d383ae9c099 100644
> --- a/gcc/rtl.cc
> +++ b/gcc/rtl.cc
> @@ -765,7 +765,7 @@ classify_insn (rtx x)
>      return CALL_INSN;
>    if (ANY_RETURN_P (x))
>      return JUMP_INSN;
> -  if (GET_CODE (x) == ASM_OPERANDS && ASM_OPERANDS_LABEL_VEC (x))
> +  if (GET_CODE (x) == ASM_OPERANDS && ASM_OPERANDS_LABEL_LENGTH (x) > 0)
>      return JUMP_INSN;
>    if (GET_CODE (x) == SET)
>      {
> @@ -794,7 +794,7 @@ classify_insn (rtx x)
>        if (has_return_p)
>       return JUMP_INSN;
>        if (GET_CODE (XVECEXP (x, 0, 0)) == ASM_OPERANDS
> -       && ASM_OPERANDS_LABEL_VEC (XVECEXP (x, 0, 0)))
> +       && ASM_OPERANDS_LABEL_LENGTH (XVECEXP (x, 0, 0)) > 0)

I think the > 0 in there is unnecessary, negative XVECLEN would be invalid
RTL.
Ok for trunk either way if it passes testing.

        Jakub

Reply via email to