On Tue, 28 Apr 2020, Jakub Jelinek wrote:

> Hi!
> 
> On the following testcase, match.pd during GENERIC folding
> changes the -1U / x < y into __imag__ .MUL_OVERFLOW (x, y),
> but unfortunately unlike for normal calls nothing sets TREE_SIDE_EFFECTS on
> the call.  There is the process_call_operands function that non-internal
> call creation calls and it is usable for internal calls too,
> e.g. TREE_SIDE_EFFECTS is derived from checking whether the
> call has side-effects (non-ECF_{CONST,PURE}; we have those for internal
> calls) and from whether any of the arguments has TREE_SIDE_EFFECTS.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?

OK.

Richard.

> 2020-04-28  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR tree-optimization/94809
>       * tree.c (build_call_expr_internal_loc_array): Call
>       process_call_operands.
> 
>       * gcc.c-torture/execute/pr94809.c: New test.
> 
> --- gcc/tree.c.jj     2020-04-27 14:31:09.260018763 +0200
> +++ gcc/tree.c        2020-04-28 00:22:07.537891047 +0200
> @@ -11523,6 +11523,7 @@ build_call_expr_internal_loc_array (loca
>      CALL_EXPR_ARG (t, i) = args[i];
>    SET_EXPR_LOCATION (t, loc);
>    CALL_EXPR_IFN (t) = ifn;
> +  process_call_operands (t);
>    return t;
>  }
>  
> --- gcc/testsuite/gcc.c-torture/execute/pr94809.c.jj  2020-04-28 
> 00:26:23.647107159 +0200
> +++ gcc/testsuite/gcc.c-torture/execute/pr94809.c     2020-04-28 
> 00:25:42.289718195 +0200
> @@ -0,0 +1,12 @@
> +/* PR tree-optimization/94809 */
> +
> +int
> +main ()
> +{
> +  int a = 0;
> +  unsigned long long one = 1;
> +  ((-1ULL / one) < a++, one);
> +  if (a != 1)
> +    __builtin_abort ();
> +  return 0;
> +}
> 
>       Jakub
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)

Reply via email to