summaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface/utils2.c')
-rw-r--r--gcc/ada/gcc-interface/utils2.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index c7db5a5f204..4c0853ea0ff 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -28,6 +28,7 @@
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
+#include "flags.h"
#include "ggc.h"
#include "output.h"
#include "tree-inline.h"
@@ -47,11 +48,6 @@
#include "ada-tree.h"
#include "gigi.h"
-static tree find_common_type (tree, tree);
-static tree compare_arrays (tree, tree, tree);
-static tree nonbinary_modular_operation (enum tree_code, tree, tree, tree);
-static tree build_simple_component_ref (tree, tree, tree, bool);
-
/* Return the base type of TYPE. */
tree
@@ -1024,6 +1020,11 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
gcc_assert (TREE_CODE (get_base_type (result_type)) == BOOLEAN_TYPE);
#endif
result = invert_truthvalue_loc (EXPR_LOCATION (operand), operand);
+ /* When not optimizing, fold the result as invert_truthvalue_loc
+ doesn't fold the result of comparisons. This is intended to undo
+ the trick used for boolean rvalues in gnat_to_gnu. */
+ if (!optimize)
+ result = fold (result);
break;
case ATTR_ADDR_EXPR: