ow...@gcc.gnu.org] On Behalf Of Kyrylo Tkachov
> Sent: 07 August 2013 14:22
> To: gcc-patches
> Cc: 'Richard Biener'; pola...@redhat.com
> Subject: [PATCH][tree-optimization] Fix PR58088
>
> Hi all,
>
> In PR58088 the constant folder goes into an infinite
> Also, the ChangeLog entries should be:
>
> 2013-08-08 Kyrylo Tkachov
>
> PR tree-optimization/58088
> * gcc/fold-const.c (mask_with_trailing_zeros): New function.
> (fold_binary_loc): Make sure we don't recurse infinitely
> when the X in (X & C1) | C2 is a tree of the
> Ok for trunk?
>
> Bootstrapped on x86_64-linux-gnu and tested arm-none-eabi on qemu.
>
>
> Thanks,
> Kyrill
> * gcc.c-torture/compile/pr58088.c: New test.
Also, the ChangeLog entries should be:
2013-08-08 Kyrylo Tkachov
PR tree-optimization/58088
* gcc/fold-const.c
> This issue is present in 4.8.1 as well as trunk. However, I think 4.8
> uses a different API for double_int, so this patch will need to be reworked
for
> 4.8.
Actually, I was confused. This patch applies to 4.8.1 as well and fixes the
issue. Passes bootstrap on x86_64-linux-gnu and testing arm-n
Hi all,
In PR58088 the constant folder goes into an infinite recursion and runs out of
stack space because of two conflicting optimisations:
(X * C1) & C2 plays dirty when nested inside an IOR expression like so: ((X *
C1) & C2) | C4. One can undo the other leading to an infinite recursion.
Thank