On 10/22/2015 10:24 AM, Kyrill Tkachov wrote:
Hi all,

The ICE in this PR (reduced from LLVM) occurs because the atomic_load
builtin expansion ends up calling
expand_atomic_compare_and_swap without caring about the result. The
convention in the optabs/builtin machinery
is to use const0_rtx for the target destination when that is the case.

However, expand_atomic_compare_and_swap didn't check for that, only for
the case where the pointer to the target
is NULL. This patch fixes that by handling the case where the
ptarget_oval and ptarget_bool pointers are not-NULL
but contain const0_rtx.

N.B. This is one of the fallback paths for expanding atomic_load when
the target doesn't provide expanders for it,
like the arm target with -march=armv4t.

Bootstrapped and tested on arm-none-linux-gnueabihf, aarch64-linux-gnu,
x86_64-unknown-linux-gnu.

This ICE appears on the GCC 5 and GCC 4.9 branch.
I'll be bootstrapping and testing this patch on those branches.

Meanwhile, is this ok for trunk?

Thanks,
Kyrill

2015-10-22  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

     PR middle-end/67989
     * optabs.c (expand_atomic_compare_and_swap): Handle case when
     ptarget_oval or ptarget_bool are const0_rtx.

2015-10-22  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

     PR middle-end/67989
     * g++.dg/pr67989.C: New test.
OK.
jeff

Reply via email to