Commit 0b9cb8c2 by Volker Reichelt Committed by Volker Reichelt

re PR c++/28112 (ICE with invalid argument in attribute)

	PR c++/28112
	* parser.c (cp_parser_attribute_list): Skip attributes with invalid
	arguments.  Fix comment.

	* g++.dg/ext/attrib23.C: New test.

From-SVN: r114941
parent e10e3ac8
2006-06-23 Volker Reichelt <reichelt@igpm.rwth-aachen.de> 2006-06-23 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/28112
* parser.c (cp_parser_attribute_list): Skip attributes with invalid
arguments. Fix comment.
PR c++/11468 PR c++/11468
* init.c (build_new_1): Handle error_mark_nodes returned by * init.c (build_new_1): Handle error_mark_nodes returned by
build_java_class_ref. build_java_class_ref.
......
...@@ -14614,6 +14614,8 @@ cp_parser_attribute_list (cp_parser* parser) ...@@ -14614,6 +14614,8 @@ cp_parser_attribute_list (cp_parser* parser)
if (token->type == CPP_NAME if (token->type == CPP_NAME
|| token->type == CPP_KEYWORD) || token->type == CPP_KEYWORD)
{ {
tree arguments = NULL_TREE;
/* Consume the token. */ /* Consume the token. */
token = cp_lexer_consume_token (parser->lexer); token = cp_lexer_consume_token (parser->lexer);
...@@ -14627,18 +14629,19 @@ cp_parser_attribute_list (cp_parser* parser) ...@@ -14627,18 +14629,19 @@ cp_parser_attribute_list (cp_parser* parser)
/* If it's an `(', then parse the attribute arguments. */ /* If it's an `(', then parse the attribute arguments. */
if (token->type == CPP_OPEN_PAREN) if (token->type == CPP_OPEN_PAREN)
{ {
tree arguments; arguments = cp_parser_parenthesized_expression_list
(parser, true, /*cast_p=*/false,
arguments = (cp_parser_parenthesized_expression_list /*non_constant_p=*/NULL);
(parser, true, /*cast_p=*/false, /* Save the arguments away. */
/*non_constant_p=*/NULL));
/* Save the identifier and arguments away. */
TREE_VALUE (attribute) = arguments; TREE_VALUE (attribute) = arguments;
} }
/* Add this attribute to the list. */ if (arguments != error_mark_node)
TREE_CHAIN (attribute) = attribute_list; {
attribute_list = attribute; /* Add this attribute to the list. */
TREE_CHAIN (attribute) = attribute_list;
attribute_list = attribute;
}
token = cp_lexer_peek_token (parser->lexer); token = cp_lexer_peek_token (parser->lexer);
} }
......
2006-06-23 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/28112
* g++.dg/ext/attrib23.C: New test.
2006-06-23 Olivier Hainque <hainque@adacore.com> 2006-06-23 Olivier Hainque <hainque@adacore.com>
* gnat.dg/varsize_temp.adb: New test. * gnat.dg/varsize_temp.adb: New test.
// PR c++/28112
// { dg-do compile }
int i __attribute__((init_priority(;))); // { dg-error "before" }
int j __attribute__((vector_size(;))); // { dg-error "before" }
int k __attribute__((visibility(;))); // { dg-error "before" }
struct A {} __attribute__((aligned(;))); // { dg-error "before" }
struct B {} __attribute__((mode(;))); // { dg-error "before" }
void foo() __attribute__((alias(;))); // { dg-error "before" }
void bar() __attribute__((nonnull(;))); // { dg-error "before" }
void baz() __attribute__((section(;))); // { dg-error "before" }
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