Commit b912f962 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/77626 (ICE with -Wall on x86_64-linux-gnu (internal compiler error:…

re PR c++/77626 (ICE with -Wall on x86_64-linux-gnu (internal compiler error: Segmentation fault, byte_from_pos, cxx_fold_indirect_ref))

	PR c++/77626
	* constexpr.c (cxx_fold_indirect_ref): Don't call byte_position on
	FIELD_DECLs with error_mark_node type.  Remove useless break; after
	return.

	* g++.dg/other/pr77626.C: New test.

From-SVN: r240267
parent eaf1ece1
2016-09-20 Jakub Jelinek <jakub@redhat.com> 2016-09-20 Jakub Jelinek <jakub@redhat.com>
PR c++/77626
* constexpr.c (cxx_fold_indirect_ref): Don't call byte_position on
FIELD_DECLs with error_mark_node type. Remove useless break; after
return.
PR c++/77638 PR c++/77638
* parser.c (cp_parser_template_declaration_after_parameter): For 2 * parser.c (cp_parser_template_declaration_after_parameter): For 2
argument operator"" template set ok to false for argument operator"" template set ok to false for
......
...@@ -2894,13 +2894,11 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base) ...@@ -2894,13 +2894,11 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base)
tree field = TYPE_FIELDS (optype); tree field = TYPE_FIELDS (optype);
for (; field; field = DECL_CHAIN (field)) for (; field; field = DECL_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL if (TREE_CODE (field) == FIELD_DECL
&& TREE_TYPE (field) != error_mark_node
&& integer_zerop (byte_position (field)) && integer_zerop (byte_position (field))
&& (same_type_ignoring_top_level_qualifiers_p && (same_type_ignoring_top_level_qualifiers_p
(TREE_TYPE (field), type))) (TREE_TYPE (field), type)))
{ return fold_build3 (COMPONENT_REF, type, op, field, NULL_TREE);
return fold_build3 (COMPONENT_REF, type, op, field, NULL_TREE);
break;
}
} }
} }
else if (TREE_CODE (sub) == POINTER_PLUS_EXPR else if (TREE_CODE (sub) == POINTER_PLUS_EXPR
...@@ -2972,14 +2970,12 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base) ...@@ -2972,14 +2970,12 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base)
tree field = TYPE_FIELDS (op00type); tree field = TYPE_FIELDS (op00type);
for (; field; field = DECL_CHAIN (field)) for (; field; field = DECL_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL if (TREE_CODE (field) == FIELD_DECL
&& TREE_TYPE (field) != error_mark_node
&& tree_int_cst_equal (byte_position (field), op01) && tree_int_cst_equal (byte_position (field), op01)
&& (same_type_ignoring_top_level_qualifiers_p && (same_type_ignoring_top_level_qualifiers_p
(TREE_TYPE (field), type))) (TREE_TYPE (field), type)))
{ return fold_build3 (COMPONENT_REF, type, op00,
return fold_build3 (COMPONENT_REF, type, op00, field, NULL_TREE);
field, NULL_TREE);
break;
}
} }
} }
} }
......
2016-09-20 Jakub Jelinek <jakub@redhat.com> 2016-09-20 Jakub Jelinek <jakub@redhat.com>
PR c++/77626
* g++.dg/other/pr77626.C: New test.
PR c++/77638 PR c++/77638
* g++.dg/cpp0x/udlit-tmpl-arg-neg2.C: New test. * g++.dg/cpp0x/udlit-tmpl-arg-neg2.C: New test.
......
// PR c++/77626
// { dg-do compile }
struct B; // { dg-message "forward declaration of" }
struct A { struct B b; }; // { dg-error "has incomplete type" }
void bar (int);
void
foo ()
{
A a;
bar ((int &) a);
}
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