[Bug c/106981] [10/11/12/13 Regression][OpenACC][OpenMP] ICE in decompose, at wide-int.h:984 with '#pragma omp/acc atomic capture'

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 23 09:15:56 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106981

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #6)
> (In reply to Jakub Jelinek from comment #5)
> 
> > The fix could be either partially backport what C++ FE did in
> > --- gcc/c/c-typeck.cc.jj	2022-09-23 09:02:56.525318361 +0200
> > +++ gcc/c/c-typeck.cc	2022-09-23 10:33:06.596467788 +0200
> 
> > +  if (CONSTANT_CLASS_P (t1) && !comptypes (TREE_TYPE (t1), TREE_TYPE (t2)))
> > +    return false;
> 
> Maybe. Though I think we still need something like my:
> 
> +	if (n > TREE_OPERAND_LENGTH (t2))
> +	  return false;
> 
> (With ">" not ">=" as I accidentally had.)
> Given that 
>  	  if (!c_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i)))
> does not make sense when exceeding the operand length!

I don't understand.
We have there:
        int i, n = TREE_OPERAND_LENGTH (t1);

        switch (code1)
          {
          case PREINCREMENT_EXPR:
          case PREDECREMENT_EXPR:
          case POSTINCREMENT_EXPR:
          case POSTDECREMENT_EXPR:
            n = 1;
            break;
          case ARRAY_REF:
            n = 2;
            break;
          default:
            break;
          }

        if (TREE_CODE_CLASS (code1) == tcc_vl_exp
            && n != TREE_OPERAND_LENGTH (t2))
          return false;
and know that code1 == code2.  So, except for tcc_vl_exp like CALL_EXPR,
TREE_OPERAND_LENGTH (t1) == TREE_OPERAND_LENGTH (t2) and n is in most
cases equal to that too, except for the pre/post in/decrements (which have
length 2) and ARRAY_REF which has length 4 and we use a smaller number.


More information about the Gcc-bugs mailing list