* dwarf2out.c (analyze_discr_in_predicate): Simplify.
(analyze_variants_discr): Deal with naked boolean discriminants.
ada/
* gcc-interface/decl.c (choices_to_gnu): Directly use a naked boolean
discriminant if the value is the boolean true.
From-SVN: r267130
+2018-12-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * dwarf2out.c (analyze_discr_in_predicate): Simplify.
+ (analyze_variants_discr): Deal with naked boolean discriminants.
+
2018-12-14 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.c (arc_restore_callee_milli) Don't clobber off
+2018-12-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (choices_to_gnu): Directly use a naked boolean
+ discriminant if the value is the boolean true.
+
2018-12-11 Eric Botcazou <ebotcazou@adacore.com>
PR ada/88429
retrieve directly its RM size.
(components_to_record): Minor tweak.
(set_rm_size): Remove useless test.
- * gcc-interface/trans.c (gnat_to_gnu): Do wrap the instance of a
- boolean discriminant attached to a variant part.
+ * gcc-interface/trans.c (gnat_to_gnu): Do not wrap the instance of
+ a boolean discriminant attached to a variant part.
2018-12-11 Ed Schonberg <schonberg@adacore.com>
* fe.h (Is_Atomic_Object): Declare.
(Is_Volatile_Object): Likewise.
- * gcc-interface/trans.c (atomic_or_volatile_copy_required_p):
- New.
+ * gcc-interface/trans.c (atomic_or_volatile_copy_required_p): New.
(Call_to_gnu): Generate a copy for an actual parameter passed by
reference if the conditions set forth by RM C.6(19) are met and
specificially deal with an atomic actual parameter.
build_binary_op (LE_EXPR, boolean_type_node,
gnu_operand, gnu_high, true),
true);
+ else if (gnu_low == boolean_true_node
+ && TREE_TYPE (gnu_operand) == boolean_type_node)
+ gnu_test = gnu_operand;
else if (gnu_low)
gnu_test
= build_binary_op (EQ_EXPR, boolean_type_node, gnu_operand, gnu_low,
/* Return whether DECL is a FIELD_DECL that represents the variant part of a
structure. */
+
static bool
is_variant_part (tree decl)
{
static tree
analyze_discr_in_predicate (tree operand, tree struct_type)
{
- bool continue_stripping = true;
- while (continue_stripping)
- switch (TREE_CODE (operand))
- {
- CASE_CONVERT:
- operand = TREE_OPERAND (operand, 0);
- break;
- default:
- continue_stripping = false;
- break;
- }
+ while (CONVERT_EXPR_P (operand))
+ operand = TREE_OPERAND (operand, 0);
/* Match field access to members of struct_type only. */
if (TREE_CODE (operand) == COMPONENT_REF
new_node->dw_discr_range = true;
}
+ else if ((candidate_discr
+ = analyze_discr_in_predicate (match_expr, struct_type))
+ && TREE_TYPE (candidate_discr) == boolean_type_node)
+ {
+ /* We are matching: <discr_field> for a boolean discriminant.
+ This sub-expression matches boolean_true_node. */
+ new_node = ggc_cleared_alloc<dw_discr_list_node> ();
+ if (!get_discr_value (boolean_true_node,
+ &new_node->dw_discr_lower_bound))
+ goto abort;
+ new_node->dw_discr_range = false;
+ }
+
else
/* Unsupported sub-expression: we cannot determine the set of
matching discriminant values. Abort everything. */