aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/ada/gcc-interface
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/ada/gcc-interface')
-rw-r--r--gcc-4.9/gcc/ada/gcc-interface/Makefile.in9
-rw-r--r--gcc-4.9/gcc/ada/gcc-interface/decl.c37
-rw-r--r--gcc-4.9/gcc/ada/gcc-interface/trans.c6
-rw-r--r--gcc-4.9/gcc/ada/gcc-interface/utils.c3
-rw-r--r--gcc-4.9/gcc/ada/gcc-interface/utils2.c10
5 files changed, 40 insertions, 25 deletions
diff --git a/gcc-4.9/gcc/ada/gcc-interface/Makefile.in b/gcc-4.9/gcc/ada/gcc-interface/Makefile.in
index 5c36962ef..e2cc4a9e0 100644
--- a/gcc-4.9/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc-4.9/gcc/ada/gcc-interface/Makefile.in
@@ -2510,9 +2510,16 @@ GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(ADA_INCLUDES) $(LDFLAGS)
# Build directory for the tools. Let's copy the target-dependent
# sources using the same mechanism as for gnatlib. The other sources are
# accessed using the vpath directive below
-# Note: dummy target, stamp-tools is mainly handled by gnattools.
../stamp-tools:
+ -$(RM) tools/*
+ -$(RMDIR) tools
+ -$(MKDIR) tools
+ -(cd tools; $(LN_S) ../sdefault.adb ../snames.ads ../snames.adb .)
+ -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \
+ $(RM) tools/$(word 1,$(subst <, ,$(PAIR)));\
+ $(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \
+ tools/$(word 1,$(subst <, ,$(PAIR)));)
touch ../stamp-tools
# when compiling the tools, the runtime has to be first on the path so that
diff --git a/gcc-4.9/gcc/ada/gcc-interface/decl.c b/gcc-4.9/gcc/ada/gcc-interface/decl.c
index 52452ce79..95bc778b4 100644
--- a/gcc-4.9/gcc/ada/gcc-interface/decl.c
+++ b/gcc-4.9/gcc/ada/gcc-interface/decl.c
@@ -2200,11 +2200,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
tree gnu_max
= convert (sizetype, TYPE_MAX_VALUE (gnu_index_type));
tree gnu_this_max
- = size_binop (MAX_EXPR,
- size_binop (PLUS_EXPR, size_one_node,
- size_binop (MINUS_EXPR,
- gnu_max, gnu_min)),
- size_zero_node);
+ = size_binop (PLUS_EXPR, size_one_node,
+ size_binop (MINUS_EXPR, gnu_max, gnu_min));
if (TREE_CODE (gnu_this_max) == INTEGER_CST
&& TREE_OVERFLOW (gnu_this_max))
@@ -2525,20 +2522,26 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnu_max_size = NULL_TREE;
else
{
- tree gnu_this_max
- = size_binop (MAX_EXPR,
- size_binop (PLUS_EXPR, size_one_node,
- size_binop (MINUS_EXPR,
+ tree gnu_this_max;
+
+ /* Use int_const_binop if the bounds are constant to
+ avoid any unwanted overflow. */
+ if (TREE_CODE (gnu_base_min) == INTEGER_CST
+ && TREE_CODE (gnu_base_max) == INTEGER_CST)
+ gnu_this_max
+ = int_const_binop (PLUS_EXPR, size_one_node,
+ int_const_binop (MINUS_EXPR,
gnu_base_max,
- gnu_base_min)),
- size_zero_node);
-
- if (TREE_CODE (gnu_this_max) == INTEGER_CST
- && TREE_OVERFLOW (gnu_this_max))
- gnu_max_size = NULL_TREE;
+ gnu_base_min));
else
- gnu_max_size
- = size_binop (MULT_EXPR, gnu_max_size, gnu_this_max);
+ gnu_this_max
+ = size_binop (PLUS_EXPR, size_one_node,
+ size_binop (MINUS_EXPR,
+ gnu_base_max,
+ gnu_base_min));
+
+ gnu_max_size
+ = size_binop (MULT_EXPR, gnu_max_size, gnu_this_max);
}
}
diff --git a/gcc-4.9/gcc/ada/gcc-interface/trans.c b/gcc-4.9/gcc/ada/gcc-interface/trans.c
index 03bf098b0..30a166611 100644
--- a/gcc-4.9/gcc/ada/gcc-interface/trans.c
+++ b/gcc-4.9/gcc/ada/gcc-interface/trans.c
@@ -2424,9 +2424,6 @@ push_range_check_info (tree var)
struct loop_info_d *iter = NULL;
unsigned int i;
- if (vec_safe_is_empty (gnu_loop_stack))
- return NULL;
-
var = remove_conversions (var, false);
if (TREE_CODE (var) != VAR_DECL)
@@ -2435,6 +2432,8 @@ push_range_check_info (tree var)
if (decl_function_context (var) != current_function_decl)
return NULL;
+ gcc_assert (vec_safe_length (gnu_loop_stack) > 0);
+
for (i = vec_safe_length (gnu_loop_stack) - 1;
vec_safe_iterate (gnu_loop_stack, i, &iter);
i--)
@@ -5165,6 +5164,7 @@ Raise_Error_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
the original checks reinstated, and a run time selection.
The former loop will be suitable for vectorization. */
if (flag_unswitch_loops
+ && !vec_safe_is_empty (gnu_loop_stack)
&& (!gnu_low_bound
|| (gnu_low_bound = gnat_invariant_expr (gnu_low_bound)))
&& (!gnu_high_bound
diff --git a/gcc-4.9/gcc/ada/gcc-interface/utils.c b/gcc-4.9/gcc/ada/gcc-interface/utils.c
index 15b72366b..820d2cec9 100644
--- a/gcc-4.9/gcc/ada/gcc-interface/utils.c
+++ b/gcc-4.9/gcc/ada/gcc-interface/utils.c
@@ -4371,8 +4371,7 @@ convert_to_fat_pointer (tree type, tree expr)
{
/* The template type can still be dummy at this point so we build an
empty constructor. The middle-end will fill it in with zeros. */
- t = build_constructor (template_type,
- NULL);
+ t = build_constructor (template_type, NULL);
TREE_CONSTANT (t) = TREE_STATIC (t) = 1;
null_bounds = build_unary_op (ADDR_EXPR, NULL_TREE, t);
SET_TYPE_NULL_BOUNDS (ptr_template_type, null_bounds);
diff --git a/gcc-4.9/gcc/ada/gcc-interface/utils2.c b/gcc-4.9/gcc/ada/gcc-interface/utils2.c
index dd4151b5b..da52f4185 100644
--- a/gcc-4.9/gcc/ada/gcc-interface/utils2.c
+++ b/gcc-4.9/gcc/ada/gcc-interface/utils2.c
@@ -2784,7 +2784,13 @@ gnat_invariant_expr (tree expr)
|| (TREE_CODE (expr) == VAR_DECL && TREE_READONLY (expr)))
&& decl_function_context (expr) == current_function_decl
&& DECL_INITIAL (expr))
- expr = remove_conversions (DECL_INITIAL (expr), false);
+ {
+ expr = DECL_INITIAL (expr);
+ /* Look into CONSTRUCTORs built to initialize padded types. */
+ if (TYPE_IS_PADDING_P (TREE_TYPE (expr)))
+ expr = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (expr))), expr);
+ expr = remove_conversions (expr, false);
+ }
if (TREE_CONSTANT (expr))
return fold_convert (type, expr);
@@ -2840,7 +2846,7 @@ object:
if (!TREE_READONLY (t))
return NULL_TREE;
- if (TREE_CODE (t) == CONSTRUCTOR || TREE_CODE (t) == PARM_DECL)
+ if (TREE_CODE (t) == PARM_DECL)
return fold_convert (type, expr);
if (TREE_CODE (t) == VAR_DECL