From aff220748ca669d4338c5ac6f0b210a29f90bbab Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 9 May 2020 22:38:29 +0200 Subject: [PATCH] Fix problematic cases of wrapping * gcc-interface/trans.c (gnat_to_gnu): Do not wrap boolean values if they appear in any kind of attribute references. --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/trans.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6aec0eeede1..814e5507e48 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2020-05-09 Eric Botcazou + + * gcc-interface/trans.c (gnat_to_gnu): Do not wrap boolean values if + they appear in any kind of attribute references. + 2020-05-09 Eric Botcazou * gcc-interface/trans.c (gnat_to_gnu) : Deal diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 5de04abb97f..44b156ac3d8 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -8695,8 +8695,9 @@ gnat_to_gnu (Node_Id gnat_node) || kind == N_Indexed_Component || kind == N_Selected_Component) && TREE_CODE (get_base_type (gnu_result_type)) == BOOLEAN_TYPE - && !lvalue_required_p (gnat_node, gnu_result_type, false, false) - && Nkind (Parent (gnat_node)) != N_Variant_Part) + && Nkind (Parent (gnat_node)) != N_Attribute_Reference + && Nkind (Parent (gnat_node)) != N_Variant_Part + && !lvalue_required_p (gnat_node, gnu_result_type, false, false)) { gnu_result = build_binary_op (NE_EXPR, gnu_result_type, -- 2.30.2