Commit 5d1504d4 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/89585 (GCC 8.3: asm volatile no longer accepted at file scope)

	PR c++/89585
	* parser.c (cp_parser_asm_definition): Just warn instead of error
	on volatile qualifier outside of function body.

	* g++.dg/asm-qual-3.C: Adjust expected diagnostics for toplevel
	asm volatile.

From-SVN: r269483
parent ed3ea9f2
2019-03-08 Jakub Jelinek <jakub@redhat.com>
PR c++/89585
* parser.c (cp_parser_asm_definition): Just warn instead of error
on volatile qualifier outside of function body.
PR c++/89599
* constexpr.c (potential_constant_expression_1): Reject
REINTERPRET_CAST_P NOP_EXPRs.
......
......@@ -19782,9 +19782,12 @@ cp_parser_asm_definition (cp_parser* parser)
inform (volatile_loc, "first seen here");
}
else
volatile_loc = loc;
if (!first_loc)
first_loc = loc;
{
if (!parser->in_function_body)
warning_at (loc, 0, "asm qualifier %qT ignored outside of "
"function body", token->u.value);
volatile_loc = loc;
}
cp_lexer_consume_token (parser->lexer);
continue;
......@@ -19830,10 +19833,10 @@ cp_parser_asm_definition (cp_parser* parser)
bool inline_p = (inline_loc != UNKNOWN_LOCATION);
bool goto_p = (goto_loc != UNKNOWN_LOCATION);
if (!parser->in_function_body && (volatile_p || inline_p || goto_p))
if (!parser->in_function_body && (inline_p || goto_p))
{
error_at (first_loc, "asm qualifier outside of function body");
volatile_p = inline_p = goto_p = false;
inline_p = goto_p = false;
}
/* Look for the opening `('. */
2019-03-08 Jakub Jelinek <jakub@redhat.com>
PR c++/89585
* g++.dg/asm-qual-3.C: Adjust expected diagnostics for toplevel
asm volatile.
PR c++/89599
* g++.dg/ubsan/vptr-4.C: Adjust expected diagnostics.
* g++.dg/parse/array-size2.C: Likewise.
......
......@@ -3,7 +3,7 @@
// { dg-options "-std=gnu++98" }
asm const (""); // { dg-error {'const' is not an asm qualifier} }
asm volatile (""); // { dg-error {asm qualifier outside of function body} }
asm volatile (""); // { dg-warning {asm qualifier 'volatile' ignored outside of function body} }
asm restrict (""); // { dg-error {expected '\(' before 'restrict'} }
asm inline (""); // { dg-error {asm qualifier outside of function body} }
asm goto (""); // { dg-error {asm qualifier outside of function body} }
......
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