summaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog33
-rw-r--r--gcc/ada/gcc-interface/Makefile.in41
-rw-r--r--gcc/ada/gcc-interface/decl.c13
-rw-r--r--gcc/ada/gcc-interface/utils2.c10
4 files changed, 76 insertions, 21 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index e37a0000fb8..937f9243e80 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,36 @@
+2016-11-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/Makefile.in: Replace s-interr-hwint.adb with
+ s-interr-vxworks.adb throughout.
+
+2016-11-13 Bob Duff <duff@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity): In assertion about known
+ Esize, protect with !is_type and change !Unknown_Esize to Known_Esize.
+
+2016-11-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Signed_Integer_Subtype>:
+ Look at the underlying type for the signedness of the type.
+
+2016-11-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (annotate_value) <INTEGER_CST>: Deal specially
+ with negative constants.
+
+2016-11-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/utils2.c (gnat_protect_expr): Also protect only the
+ address if the expression is the component of a dereference.
+ Do not use a reference type for the final temporary reference.
+
+2016-11-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/Makefile.in (NO_OMIT_ADAFLAGS): Define.
+ (a-except.o): Replace -fno-inline with NO_INLINE_ADAFLAGS.
+ (s-memory.o): New rule.
+ (tracebak.o): Replace -fno-omit-frame-pointer with NO_OMIT_ADAFLAGS.
+
2016-11-07 Tamar Christina <tamar.christina@arm.com>
* adaint.c: Added signal.h for Windows.
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index e22b4d20a00..ec8aa076cbb 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -107,6 +107,7 @@ ADA_CFLAGS =
ADAFLAGS = -W -Wall -gnatpg -gnata
FORCE_DEBUG_ADAFLAGS = -g
NO_INLINE_ADAFLAGS = -fno-inline
+NO_OMIT_ADAFLAGS = -fno-omit-frame-pointer
NO_SIBLING_ADAFLAGS = -fno-optimize-sibling-calls
NO_REORDER_ADAFLAGS = -fno-toplevel-reorder
GNATLIBFLAGS = -W -Wall -gnatpg -nostdinc
@@ -473,7 +474,7 @@ ifeq ($(strip $(filter-out m68k% wrs vx%,$(target_cpu) $(target_vendor) $(target
a-intnam.ads<a-intnam-vxworks.ads \
a-numaux.ads<a-numaux-vxworks.ads \
s-inmaop.adb<s-inmaop-vxworks.adb \
- s-interr.adb<s-interr-hwint.adb \
+ s-interr.adb<s-interr-vxworks.adb \
s-intman.ads<s-intman-vxworks.ads \
s-intman.adb<s-intman-vxworks.adb \
s-osinte.adb<s-osinte-vxworks.adb \
@@ -594,7 +595,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks vxworks7,$(target_cpu) $(target_
else
ifeq ($(strip $(filter-out kernel-smp,$(THREAD_KIND))),)
LIBGNAT_TARGET_PAIRS += \
- s-interr.adb<s-interr-hwint.adb \
+ s-interr.adb<s-interr-vxworks.adb \
s-mudido.adb<s-mudido-affinity.adb \
s-tpopsp.adb<s-tpopsp-vxworks-tls.adb \
s-vxwext.ads<s-vxwext-kernel.ads \
@@ -605,7 +606,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks vxworks7,$(target_cpu) $(target_
EXTRA_LIBGNAT_OBJS+=affinity.o
else
LIBGNAT_TARGET_PAIRS += \
- s-interr.adb<s-interr-hwint.adb \
+ s-interr.adb<s-interr-vxworks.adb \
s-tpopsp.adb<s-tpopsp-vxworks.adb
ifeq ($(strip $(filter-out kernel,$(THREAD_KIND))),)
@@ -650,7 +651,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworksae,$(target_cpu) $(target_vendor)
a-numaux.ads<a-numaux-vxworks.ads \
g-io.adb<g-io-vxworks-ppc-cert.adb \
s-inmaop.adb<s-inmaop-vxworks.adb \
- s-interr.adb<s-interr-hwint.adb \
+ s-interr.adb<s-interr-vxworks.adb \
s-intman.ads<s-intman-vxworks.ads \
s-intman.adb<s-intman-vxworks.adb \
s-osinte.adb<s-osinte-vxworks.adb \
@@ -716,7 +717,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworksmils,$(target_cpu) $(target_vendo
a-numaux.ads<a-numaux-vxworks.ads \
g-io.adb<g-io-vxworks-ppc-cert.adb \
s-inmaop.adb<s-inmaop-vxworks.adb \
- s-interr.adb<s-interr-hwint.adb \
+ s-interr.adb<s-interr-vxworks.adb \
s-intman.ads<s-intman-vxworks.ads \
s-intman.adb<s-intman-vxworks.adb \
s-osinte.adb<s-osinte-vxworks.adb \
@@ -771,7 +772,7 @@ ifeq ($(strip $(filter-out %86 wrs vxworksae,$(target_cpu) $(target_vendor) $(ta
a-numaux.ads<a-numaux-vxworks.ads \
g-io.adb<g-io-vxworks-ppc-cert.adb \
s-inmaop.adb<s-inmaop-vxworks.adb \
- s-interr.adb<s-interr-hwint.adb \
+ s-interr.adb<s-interr-vxworks.adb \
s-intman.ads<s-intman-vxworks.ads \
s-intman.adb<s-intman-vxworks.adb \
s-osinte.adb<s-osinte-vxworks.adb \
@@ -834,7 +835,7 @@ ifeq ($(strip $(filter-out sparc% wrs vx%,$(target_cpu) $(target_vendor) $(targe
a-intnam.ads<a-intnam-vxworks.ads \
a-numaux.ads<a-numaux-vxworks.ads \
s-inmaop.adb<s-inmaop-vxworks.adb \
- s-interr.adb<s-interr-hwint.adb \
+ s-interr.adb<s-interr-vxworks.adb \
s-intman.ads<s-intman-vxworks.ads \
s-intman.adb<s-intman-vxworks.adb \
s-osinte.adb<s-osinte-vxworks.adb \
@@ -993,7 +994,7 @@ ifeq ($(strip $(filter-out %86 x86_64 wrs vxworks vxworks7,$(target_cpu) $(targe
else
ifeq ($(strip $(filter-out kernel-smp, $(THREAD_KIND))),)
LIBGNAT_TARGET_PAIRS += \
- s-interr.adb<s-interr-hwint.adb \
+ s-interr.adb<s-interr-vxworks.adb \
s-mudido.adb<s-mudido-affinity.adb \
s-tpopsp.adb<s-tpopsp-vxworks-tls.adb \
s-vxwext.ads<s-vxwext-kernel.ads \
@@ -1003,7 +1004,7 @@ ifeq ($(strip $(filter-out %86 x86_64 wrs vxworks vxworks7,$(target_cpu) $(targe
EXTRA_LIBGNAT_OBJS+=affinity.o
else
LIBGNAT_TARGET_PAIRS += \
- s-interr.adb<s-interr-hwint.adb \
+ s-interr.adb<s-interr-vxworks.adb \
s-tpopsp.adb<s-tpopsp-vxworks.adb
ifeq ($(strip $(filter-out kernel,$(THREAD_KIND))),)
@@ -1059,7 +1060,7 @@ ifeq ($(strip $(filter-out arm% coff wrs vx%,$(target_cpu) $(target_vendor) $(ta
a-intnam.ads<a-intnam-vxworks.ads \
a-numaux.ads<a-numaux-vxworks.ads \
s-inmaop.adb<s-inmaop-vxworks.adb \
- s-interr.adb<s-interr-hwint.adb \
+ s-interr.adb<s-interr-vxworks.adb \
s-intman.ads<s-intman-vxworks.ads \
s-intman.adb<s-intman-vxworks.adb \
s-osinte.adb<s-osinte-vxworks.adb \
@@ -1143,7 +1144,7 @@ ifeq ($(strip $(filter-out mips% wrs vx%,$(target_cpu) $(target_vendor) $(target
a-intnam.ads<a-intnam-vxworks.ads \
a-numaux.ads<a-numaux-vxworks.ads \
s-inmaop.adb<s-inmaop-vxworks.adb \
- s-interr.adb<s-interr-hwint.adb \
+ s-interr.adb<s-interr-vxworks.adb \
s-intman.ads<s-intman-vxworks.ads \
s-intman.adb<s-intman-vxworks.adb \
s-osinte.adb<s-osinte-vxworks.adb \
@@ -1692,7 +1693,7 @@ ifeq ($(strip $(filter-out rtems%,$(target_os))),)
s-taspri.ads<s-taspri-posix.ads \
s-tpopsp.adb<s-tpopsp-rtems.adb \
s-stchop.adb<s-stchop-rtems.adb \
- s-interr.adb<s-interr-hwint.adb
+ s-interr.adb<s-interr-vxworks.adb
endif
# PikeOS
@@ -3016,8 +3017,8 @@ s-tasdeb.o : s-tasdeb.adb s-tasdeb.ads
# use -O1 otherwise gdb isn't able to get a full backtrace on mips targets.
a-except.o : a-except.adb a-except.ads
- $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O1 -fno-inline \
- $(NO_REORDER_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
+ $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(NO_INLINE_ADAFLAGS) \
+ $(NO_REORDER_ADAFLAGS) -O1 $(ADA_INCLUDES) $< $(OUTPUT_OPTION)
# compile s-excdeb.o without optimization and with debug info to let the
# debugger set breakpoints and inspect subprogram parameters on exception
@@ -3041,11 +3042,19 @@ a-tags.o : a-tags.adb a-tags.ads
$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
$< $(OUTPUT_OPTION)
-# need to keep the frame pointer in this file to pop the stack properly on
+# force no sibling call optimization on s-memory.o to avoid turning the
+# tail recursion in Alloc into a loop that confuses branch prediction.
+
+s-memory.o : s-memory.adb s-memory.ads
+ $(CC) -c $(ALL_ADAFLAGS) $(NO_SIBLING_ADAFLAGS) $(ADA_INCLUDES) \
+ $< $(OUTPUT_OPTION)
+
+# need to keep the frame pointer in tracebak.o to pop the stack properly on
# some targets.
+
tracebak.o : tracebak.c tb-gcc.c
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
- $(INCLUDES) -fno-omit-frame-pointer $< $(OUTPUT_OPTION)
+ $(INCLUDES) $(NO_OMIT_ADAFLAGS) $< $(OUTPUT_OPTION)
adadecode.o : adadecode.c adadecode.h
aux-io.o : aux-io.c
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 3aaaaca73ed..9de85ef8e4b 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -388,7 +388,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
must be specified unless it was specified by the programmer. Exceptions
are for access-to-protected-subprogram types and all access subtypes, as
another GNAT type is used to lay out the GCC type for them. */
- gcc_assert (!Unknown_Esize (gnat_entity)
+ gcc_assert (!is_type
+ || Known_Esize (gnat_entity)
|| Has_Size_Clause (gnat_entity)
|| (!IN (kind, Numeric_Kind)
&& !IN (kind, Enumeration_Kind)
@@ -1836,7 +1837,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
&& esize == CHAR_TYPE_SIZE
&& flag_signed_char)
gnu_type = make_signed_type (CHAR_TYPE_SIZE);
- else if (Is_Unsigned_Type (Etype (gnat_entity))
+ else if (Is_Unsigned_Type (Underlying_Type (Etype (gnat_entity)))
|| (Esize (Etype (gnat_entity)) != Esize (gnat_entity)
&& Is_Unsigned_Type (gnat_entity))
|| Has_Biased_Representation (gnat_entity))
@@ -8022,6 +8023,14 @@ annotate_value (tree gnu_size)
switch (TREE_CODE (gnu_size))
{
case INTEGER_CST:
+ /* For negative values, build NEGATE_EXPR of the opposite. Such values
+ can appear for discriminants in expressions for variants. */
+ if (tree_int_cst_sgn (gnu_size) < 0)
+ {
+ tree t = wide_int_to_tree (sizetype, wi::neg (gnu_size));
+ return annotate_value (build1 (NEGATE_EXPR, sizetype, t));
+ }
+
return TREE_OVERFLOW (gnu_size) ? No_Uint : UI_From_gnu (gnu_size);
case COMPONENT_REF:
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index c0d831fb1e5..fc6f1b86bdc 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -2586,6 +2586,12 @@ gnat_protect_expr (tree exp)
return t;
}
+ /* Likewise if we're indirectly referencing part of something. */
+ if (code == COMPONENT_REF
+ && TREE_CODE (TREE_OPERAND (exp, 0)) == INDIRECT_REF)
+ return build3 (code, type, gnat_protect_expr (TREE_OPERAND (exp, 0)),
+ TREE_OPERAND (exp, 1), NULL_TREE);
+
/* If this is a COMPONENT_REF of a fat pointer, save the entire fat pointer.
This may be more efficient, but will also allow us to more easily find
the match for the PLACEHOLDER_EXPR. */
@@ -2605,9 +2611,7 @@ gnat_protect_expr (tree exp)
/* Otherwise reference, protect the address and dereference. */
return
build_unary_op (INDIRECT_REF, type,
- save_expr (build_unary_op (ADDR_EXPR,
- build_reference_type (type),
- exp)));
+ save_expr (build_unary_op (ADDR_EXPR, NULL_TREE, exp)));
}
/* This is equivalent to stabilize_reference_1 in tree.c but we take an extra