Commit c19ff724 by Eric Botcazou Committed by Eric Botcazou

decl.c (annotate_value): Be prepared for discriminants inherited from parent record types.

	* gcc-interface/decl.c (annotate_value) <COMPONENT_REF>: Be prepared
	for discriminants inherited from parent record types.

From-SVN: r194939
parent 83787c0e
2013-01-06 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (annotate_value) <COMPONENT_REF>: Be prepared
for discriminants inherited from parent record types.
2013-01-04 Robert Dewar <dewar@adacore.com> 2013-01-04 Robert Dewar <dewar@adacore.com>
* warnsw.adb: Minor fixes to -gnatw.d handling. * warnsw.adb: Minor fixes to -gnatw.d handling.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Implementation File * * C Implementation File *
* * * *
* Copyright (C) 1992-2012, Free Software Foundation, Inc. * * Copyright (C) 1992-2013, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -4965,7 +4965,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -4965,7 +4965,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
} }
} }
/* If this is a record type or subtype, call elaborate_expression_1 on /* If this is a record type or subtype, call elaborate_expression_2 on
any field position. Do this for both global and local types. any field position. Do this for both global and local types.
Skip any fields that we haven't made trees for to avoid problems with Skip any fields that we haven't made trees for to avoid problems with
class wide types. */ class wide types. */
...@@ -7286,15 +7286,22 @@ annotate_value (tree gnu_size) ...@@ -7286,15 +7286,22 @@ annotate_value (tree gnu_size)
case COMPONENT_REF: case COMPONENT_REF:
/* The only case we handle here is a simple discriminant reference. */ /* The only case we handle here is a simple discriminant reference. */
if (TREE_CODE (TREE_OPERAND (gnu_size, 0)) == PLACEHOLDER_EXPR if (DECL_DISCRIMINANT_NUMBER (TREE_OPERAND (gnu_size, 1)))
&& TREE_CODE (TREE_OPERAND (gnu_size, 1)) == FIELD_DECL {
&& DECL_DISCRIMINANT_NUMBER (TREE_OPERAND (gnu_size, 1))) tree n = DECL_DISCRIMINANT_NUMBER (TREE_OPERAND (gnu_size, 1));
return Create_Node (Discrim_Val,
annotate_value (DECL_DISCRIMINANT_NUMBER /* Climb up the chain of successive extensions, if any. */
(TREE_OPERAND (gnu_size, 1))), while (TREE_CODE (TREE_OPERAND (gnu_size, 0)) == COMPONENT_REF
No_Uint, No_Uint); && DECL_NAME (TREE_OPERAND (TREE_OPERAND (gnu_size, 0), 1))
else == parent_name_id)
return No_Uint; gnu_size = TREE_OPERAND (gnu_size, 0);
if (TREE_CODE (TREE_OPERAND (gnu_size, 0)) == PLACEHOLDER_EXPR)
return
Create_Node (Discrim_Val, annotate_value (n), No_Uint, No_Uint);
}
return No_Uint;
CASE_CONVERT: case NON_LVALUE_EXPR: CASE_CONVERT: case NON_LVALUE_EXPR:
return annotate_value (TREE_OPERAND (gnu_size, 0)); return annotate_value (TREE_OPERAND (gnu_size, 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