Commit 2ff7172a by Jakub Jelinek Committed by Jakub Jelinek

re PR inline-asm/85172 (internal compiler error: unexpected expression…

re PR inline-asm/85172 (internal compiler error: unexpected expression '<statement>' of kind asm_expr)

	PR inline-asm/85172
	* constexpr.c (cxx_eval_builtin_function_call): For calls to
	builtin_valid_in_constant_expr_p functions, don't call
	cxx_eval_constant_expression if argument is not
	potential_constant_expression.

	* g++.dg/ext/builtin13.C: New test.
	* g++.dg/ext/atomic-4.C: New test.

From-SVN: r259104
parent 628a1534
2018-04-04 Jakub Jelinek <jakub@redhat.com> 2018-04-04 Jakub Jelinek <jakub@redhat.com>
PR inline-asm/85172
* constexpr.c (cxx_eval_builtin_function_call): For calls to
builtin_valid_in_constant_expr_p functions, don't call
cxx_eval_constant_expression if argument is not
potential_constant_expression.
PR c++/85146 PR c++/85146
* cp-tree.h (calculate_bases, calculate_direct_bases): Add complain * cp-tree.h (calculate_bases, calculate_direct_bases): Add complain
argument. argument.
......
...@@ -1189,8 +1189,14 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun, ...@@ -1189,8 +1189,14 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
bool dummy1 = false, dummy2 = false; bool dummy1 = false, dummy2 = false;
for (i = 0; i < nargs; ++i) for (i = 0; i < nargs; ++i)
{ {
args[i] = cxx_eval_constant_expression (&new_ctx, CALL_EXPR_ARG (t, i), args[i] = CALL_EXPR_ARG (t, i);
false, &dummy1, &dummy2); /* If builtin_valid_in_constant_expr_p is true,
potential_constant_expression_1 has not recursed into the arguments
of the builtin, verify it here. */
if (!builtin_valid_in_constant_expr_p (fun)
|| potential_constant_expression (args[i]))
args[i] = cxx_eval_constant_expression (&new_ctx, args[i], false,
&dummy1, &dummy2);
if (bi_const_p) if (bi_const_p)
/* For __built_in_constant_p, fold all expressions with constant values /* For __built_in_constant_p, fold all expressions with constant values
even if they aren't C++ constant-expressions. */ even if they aren't C++ constant-expressions. */
......
2018-04-04 Jakub Jelinek <jakub@redhat.com> 2018-04-04 Jakub Jelinek <jakub@redhat.com>
PR inline-asm/85172
* g++.dg/ext/builtin13.C: New test.
* g++.dg/ext/atomic-4.C: New test.
PR c++/85146 PR c++/85146
* g++.dg/ext/bases2.C: Expect extra error diagnostics. * g++.dg/ext/bases2.C: Expect extra error diagnostics.
* g++.dg/ext/bases3.C: New test. * g++.dg/ext/bases3.C: New test.
......
// PR inline-asm/85172
// { dg-do compile }
// { dg-options "" }
int
foo (int *p)
{
return !__atomic_always_lock_free (4, ({ __asm (""); p; }));
}
// PR inline-asm/85172
// { dg-do compile }
// { dg-options "" }
int
foo ()
{
return !__builtin_constant_p (({ __asm (""); 0; }));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment