From: Jason Merrill Date: Fri, 15 Jan 2016 15:57:17 +0000 (-0500) Subject: re PR c++/68847 (ICE in cxx_eval_constant_expression on __atomic_compare_exchange... X-Git-Tag: basepoints/gcc-7~1593 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5e3b6fc95b12720da53b81e047e77cfe63a2c3c;p=thirdparty%2Fgcc.git re PR c++/68847 (ICE in cxx_eval_constant_expression on __atomic_compare_exchange (constexpr.c:3719) in c++) PR c++/68847 * call.c (build_cxx_call): Use fold_non_dependent_expr. From-SVN: r232438 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fc846dc7e3a6..0ad384a74abe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-01-15 Jason Merrill + PR c++/68847 + * call.c (build_cxx_call): Use fold_non_dependent_expr. + * typeck2.c (cxx_incomplete_type_diagnostic): Use the location of value. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index c05170a05574..ce87be72c14f 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7755,7 +7755,7 @@ build_cxx_call (tree fn, int nargs, tree *argarray, /* We need to take care that values to BUILT_IN_NORMAL are reduced. */ for (i = 0; i < nargs; i++) - argarray[i] = maybe_constant_value (argarray[i]); + argarray[i] = fold_non_dependent_expr (argarray[i]); if (!check_builtin_function_arguments (fndecl, nargs, argarray)) return error_mark_node; diff --git a/gcc/testsuite/g++.dg/delayedfold/builtin1.C b/gcc/testsuite/g++.dg/delayedfold/builtin1.C new file mode 100644 index 000000000000..32f4435d152b --- /dev/null +++ b/gcc/testsuite/g++.dg/delayedfold/builtin1.C @@ -0,0 +1,11 @@ +// PR c++/68847 +// { dg-do compile { target cas_int } } + +class RegionLock { + template void m_fn1(); + int spinlock; +} acquire_zero; +int acquire_one; +template void RegionLock::m_fn1() { + __atomic_compare_exchange(&spinlock, &acquire_zero, &acquire_one, false, 2, 2); +}