diff options
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 76 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/Make-lang.in | 10 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/Makefile.in | 23 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 22 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/misc.c | 4 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 87 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 2 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils2.c | 32 | ||||
-rw-r--r-- | gcc/ada/sigtramp-ppcvxw.c | 2 | ||||
-rw-r--r-- | gcc/ada/terminals.c | 2 |
10 files changed, 202 insertions, 58 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 4e0b0a8e349..61fd991bef2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,6 +1,80 @@ +2013-09-01 Eric Botcazou <ebotcazou@adacore.com> + Iain Sandoe <iain@codesourcery.com> + + PR ada/58239 + * gcc-interface/Makefile.in (GCC_LINK_FLAGS): Add -static-libstdc++. + (GCC_LINK): Use CXX instead of CC. + * gcc-interface/Make-lang.in (CXX_LFLAGS): New. + (ADA_TOOLS_FLAGS_TO_PASS): Pass CXX, and CXX_LFLAGS for native. + +2013-08-13 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_entity): Do not bother about alias + sets of derived types in ASIS mode. + +2013-08-13 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_entity): Replace True with true. + (is_cplusplus_method): Likewise, and False with false. + (components_need_strict_alignment): Likewise. + * gcc-interface/misc.c (gnat_init_gcc_fp): Likewise. + * gcc-interface/trans.c (Loop_Statement_to_gnu): Likewise. + (Handled_Sequence_Of_Statements_to_gnu): Likewise. + (add_cleanup): Likewise. + (Sloc_to_locus1): Likewise. + (Sloc_to_locus): Likewise. + (set_expr_location_from_node): Likewise. + * gcc-interface/utils.c (potential_alignment_gap): Likewise. + +2013-08-13 Thomas Quinot <quinot@adacore.com> + + * gcc-interface/trans.c (set_end_locus_from_node): Clear column info + for the end_locus of a block if it does not come from an End_Label. + +2013-08-13 Thomas Quinot <quinot@adacore.com> + + * gcc-interface/trans.c (Handled_Sequence_Of_Statements_to_gnu): If + there is no End_Label, attach cleanup actions to the sloc of the HSS + node instead. + (Exception_Handler_to_gnu_zcx): Associate cleanup actions with the sloc + of the handler itself. + (add_cleanup): Clear column information in sloc of cleanup actions. + (Sloc_to_locus1): New static function. + (Sloc_to_locus): Call it. + (set_expr_location_from_node1): New static function. + (set_expr_location_from_node): Call it. + +2013-08-13 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/trans.c (Call_to_gnu): Deal with specific conditional + expressions for misaligned actual parameters. + +2013-08-13 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/trans.c (can_equal_min_or_max_val_p): Be prepared for + values outside of the range of the type. + +2013-08-13 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/utils2.c (build_atomic_load): Do a mere view-conversion + to the original type before converting to the result type. + (build_atomic_store): First do a conversion to the original type before + view-converting to the effective type, but deal with a padded type + specially. + +2013-08-08 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/Makefile.in (TOOLS_LIBS): Pick C object files from the + compiler build and use standard library variables. + (../../vxaddr2line$(exeext): Do not depend on targext.o and adjust. + (gnatmake-re): Do not depend on targext.o. + (gnatlink-re): Do not depend on link.o and targext.o. + (../../gnatmake$(exeext): Likewise. + (../../gnatlink$(exeext): Likewise. + 2013-07-21 OndÅej BÃlka <neleai@seznam.cz> - * gcc-interface/gigi.h: Likewise. + * gcc-interface/gigi.h: Fix typos. * gcc-interface/trans.c: Likewise. * gcc-interface/utils2.c: Likewise. * gnat_rm.texi: Likewise. diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index 4fed34fc524..93250da561c 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -111,6 +111,12 @@ ada: gnat1$(exeext) gnatbind$(exeext) # Tell GNU Make to ignore these, if they exist. .PHONY: ada +CXX_LFLAGS = \ + -B../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ + -B../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs \ + -L../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ + -L../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs + # There are too many Ada sources to check against here. Let's # always force the recursive make. ifeq ($(build), $(host)) @@ -119,6 +125,7 @@ ifeq ($(build), $(host)) # tree. ADA_TOOLS_FLAGS_TO_PASS=\ CC="../../xgcc -B../../" \ + CXX="../../xg++ -B../../ $(CXX_LFLAGS)" \ $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \ ADA_INCLUDES="-I- -I../rts" \ GNATMAKE="../../gnatmake" \ @@ -136,6 +143,7 @@ ifeq ($(build), $(host)) ADA_TOOLS_FLAGS_TO_PASS=\ CC="$(CC)" \ + CXX="$(CXX)" \ $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \ ADA_INCLUDES="-I$(RTS_DIR)../adainclude -I$(RTS_DIR)" \ GNATMAKE="gnatmake" \ @@ -158,6 +166,7 @@ else # built runtime. ADA_TOOLS_FLAGS_TO_PASS=\ CC="$(CC)" \ + CXX="$(CXX)" \ $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \ ADA_INCLUDES="-I../rts" \ GNATMAKE="$(GNATMAKE_FOR_HOST)" \ @@ -172,6 +181,7 @@ else endif ADA_TOOLS_FLAGS_TO_PASS=\ CC="$(CC)" \ + CXX="$(CXX)" \ $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \ ADA_INCLUDES="-I$(RTS_DIR)../adainclude -I$(RTS_DIR)" \ GNATMAKE="$(GNATMAKE_FOR_HOST)" \ diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index 6aa93c4655a..0c4057c1019 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -198,7 +198,7 @@ RTSDIR = rts$(subst /,_,$(MULTISUBDIR)) # Link flags used to build gnat tools. By default we prefer to statically # link with libgcc to avoid a dependency on shared libgcc (which is tricky # to deal with as it may conflict with the libgcc provided by the system). -GCC_LINK_FLAGS=-static-libgcc +GCC_LINK_FLAGS=-static-libstdc++ -static-libgcc # End of variables for you to override. @@ -250,10 +250,9 @@ LIBS = $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) $(LIBIBERTY) $(SYSLIBS) LIBDEPS = $(LIBINTL_DEP) $(LIBICONV_DEP) $(LIBBACKTRACE) $(LIBIBERTY) # Default is no TGT_LIB; one might be passed down or something TGT_LIB = -TOOLS_LIBS = targext.o link.o ../../ggc-none.o ../../libcommon-target.a \ +TOOLS_LIBS = ../link.o ../targext.o ../../ggc-none.o ../../libcommon-target.a \ ../../libcommon.a ../../../libcpp/libcpp.a $(LIBGNAT) $(LIBINTL) $(LIBICONV) \ - ../../../libbacktrace/.libs/libbacktrace.a ../../../libiberty/libiberty.a \ - $(SYSLIBS) $(TGT_LIB) + ../$(LIBBACKTRACE) ../$(LIBIBERTY) $(SYSLIBS) $(TGT_LIB) # Convert the target variable into a space separated list of architecture, # manufacturer, and operating system and assign each of those to its own @@ -2276,7 +2275,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),) GMEM_LIB = gmemlib LIBRARY_VERSION := $(LIB_VERSION) soext = .dylib - GCC_LINK_FLAGS= + GCC_LINK_FLAGS=-static-libstdc++ endif # ARM Nucleus @@ -2398,7 +2397,7 @@ TOOLS_FLAGS_TO_PASS= \ "GNATLINK=$(GNATLINK)" \ "GNATBIND=$(GNATBIND)" -GCC_LINK=$(CC) $(GCC_LINK_FLAGS) $(ADA_INCLUDES) +GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(ADA_INCLUDES) # Build directory for the tools. Let's copy the target-dependent # sources using the same mechanism as for gnatlib. The other sources are @@ -2491,12 +2490,12 @@ common-tools: ../stamp-tools $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatdll $(GNATLINK) -v gnatdll -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS) -../../vxaddr2line$(exeext): ../stamp-tools targext.o +../../vxaddr2line$(exeext): ../stamp-tools $(GNATMAKE) -c $(ADA_INCLUDES) vxaddr2line --GCC="$(CC) $(ALL_ADAFLAGS)" $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vxaddr2line - $(GNATLINK) -v vxaddr2line -o $@ --GCC="$(GCC_LINK)" targext.o $(CLIB) + $(GNATLINK) -v vxaddr2line -o $@ --GCC="$(GCC_LINK)" ../targext.o $(CLIB) -gnatmake-re: ../stamp-tools link.o targext.o +gnatmake-re: ../stamp-tools $(GNATMAKE) -j0 $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(MOST_ADA_FLAGS)" $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)" $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake @@ -2507,7 +2506,7 @@ gnatmake-re: ../stamp-tools link.o targext.o # with the former version of gnatlink itself which cannot override itself. # gnatlink-re cannot be run at the same time as gnatmake-re, hence the # dependency -gnatlink-re: ../stamp-tools link.o targext.o gnatmake-re +gnatlink-re: ../stamp-tools gnatmake-re $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)" $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink $(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \ @@ -2519,11 +2518,11 @@ gnatlink-re: ../stamp-tools link.o targext.o gnatmake-re # stamp target in the parent directory whenever gnat1 is rebuilt # Likewise for the tools -../../gnatmake$(exeext): $(P) b_gnatm.o link.o targext.o $(GNATMAKE_OBJS) +../../gnatmake$(exeext): $(P) b_gnatm.o $(GNATMAKE_OBJS) +$(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) \ $(TOOLS_LIBS) -../../gnatlink$(exeext): $(P) b_gnatl.o link.o targext.o $(GNATLINK_OBJS) +../../gnatlink$(exeext): $(P) b_gnatl.o $(GNATLINK_OBJS) +$(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) \ $(TOOLS_LIBS) diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index f632a3164e7..26342e2a012 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -4830,7 +4830,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (is_type && (!gnu_decl || this_made_decl)) { /* Process the attributes, if not already done. Note that the type is - already defined so we cannot pass True for IN_PLACE here. */ + already defined so we cannot pass true for IN_PLACE here. */ process_attributes (&gnu_type, &attr_list, false, gnat_entity); /* Tell the middle-end that objects of tagged types are guaranteed to @@ -5153,7 +5153,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) to conflict with Comp2 and an alias set copy is required. The language rules ensure the parent type is already frozen here. */ - if (Is_Derived_Type (gnat_entity)) + if (Is_Derived_Type (gnat_entity) && !type_annotate_only) { tree gnu_parent_type = gnat_to_gnu_type (Etype (gnat_entity)); relate_alias_sets (gnu_type, gnu_parent_type, @@ -5449,26 +5449,26 @@ bool is_cplusplus_method (Entity_Id gnat_entity) { if (Convention (gnat_entity) != Convention_CPP) - return False; + return false; /* This is the main case: C++ method imported as a primitive operation. */ if (Is_Dispatching_Operation (gnat_entity)) - return True; + return true; /* A thunk needs to be handled like its associated primitive operation. */ if (Is_Subprogram (gnat_entity) && Is_Thunk (gnat_entity)) - return True; + return true; /* C++ classes with no virtual functions can be imported as limited record types, but we need to return true for the constructors. */ if (Is_Constructor (gnat_entity)) - return True; + return true; /* This is set on the E_Subprogram_Type built for a dispatching call. */ if (Is_Dispatch_Table_Entity (gnat_entity)) - return True; + return true; - return False; + return false; } /* Finalize the processing of From_With_Type incomplete types. */ @@ -6727,13 +6727,13 @@ components_need_strict_alignment (Node_Id component_list) Entity_Id gnat_field = Defining_Entity (component_decl); if (Is_Aliased (gnat_field)) - return True; + return true; if (Strict_Alignment (Etype (gnat_field))) - return True; + return true; } - return False; + return false; } /* Return true if TYPE is a type with variable size or a padding type with a diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c index 7b168df4e03..3abe57b6bd9 100644 --- a/gcc/ada/gcc-interface/misc.c +++ b/gcc/ada/gcc-interface/misc.c @@ -385,13 +385,13 @@ void gnat_init_gcc_fp (void) { /* Disable FP optimizations that ignore the signedness of zero if - S'Signed_Zeros is True, but don't override the user if not. */ + S'Signed_Zeros is true, but don't override the user if not. */ if (Signed_Zeros_On_Target) flag_signed_zeros = 1; else if (!global_options_set.x_flag_signed_zeros) flag_signed_zeros = 0; - /* Assume that FP operations can trap if S'Machine_Overflow is True, + /* Assume that FP operations can trap if S'Machine_Overflow is true, but don't override the user if not. ??? Alpha/VMS enables FP traps without declaring it. */ diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index f91f4b83a6e..4048e0aefe9 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -257,6 +257,8 @@ static tree pos_to_constructor (Node_Id, tree, Entity_Id); static void validate_unchecked_conversion (Node_Id); static tree maybe_implicit_deref (tree); static void set_expr_location_from_node (tree, Node_Id); +static void set_expr_location_from_node1 (tree, Node_Id, bool); +static bool Sloc_to_locus1 (Source_Ptr, location_t *, bool); static bool set_end_locus_from_node (tree, Node_Id); static void set_gnu_expr_location_from_node (tree, Node_Id); static int lvalue_required_p (Node_Id, tree, bool, bool, bool); @@ -2391,7 +2393,10 @@ can_equal_min_or_max_val_p (tree val, tree type, bool max) if (TREE_CODE (val) != INTEGER_CST) return true; - return tree_int_cst_equal (val, min_or_max_val) == 1; + if (max) + return tree_int_cst_lt (val, min_or_max_val) == 0; + else + return tree_int_cst_lt (min_or_max_val, val) == 0; } /* Return true if VAL (of type TYPE) can equal the minimum value of TYPE. @@ -2716,7 +2721,7 @@ Loop_Statement_to_gnu (Node_Id gnat_node) /* First, if we have computed a small number of invariant conditions for range checks applied to the iteration variable, then initialize these - conditions in front of the loop. Otherwise, leave them set to True. + conditions in front of the loop. Otherwise, leave them set to true. ??? The heuristics need to be improved, by taking into account the following datapoints: @@ -4019,9 +4024,19 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, /* Set up to move the copy back to the original if needed. */ if (!in_param) { - gnu_stmt = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_orig, - gnu_temp); + /* If the original is a COND_EXPR whose first arm isn't meant to + be further used, just deal with the second arm. This is very + likely the conditional expression built for a check. */ + if (TREE_CODE (gnu_orig) == COND_EXPR + && TREE_CODE (TREE_OPERAND (gnu_orig, 1)) == COMPOUND_EXPR + && integer_zerop + (TREE_OPERAND (TREE_OPERAND (gnu_orig, 1), 1))) + gnu_orig = TREE_OPERAND (gnu_orig, 2); + + gnu_stmt + = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_orig, gnu_temp); set_expr_location_from_node (gnu_stmt, gnat_node); + append_to_statement_list (gnu_stmt, &gnu_after_list); } } @@ -4458,6 +4473,10 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) tree gnu_result; tree gnu_expr; Node_Id gnat_temp; + /* Node providing the sloc for the cleanup actions. */ + Node_Id gnat_cleanup_loc_node = (Present (End_Label (gnat_node)) ? + End_Label (gnat_node) : + gnat_node); /* The GCC exception handling mechanism can handle both ZCX and SJLJ schemes and we have our own SJLJ mechanism. To call the GCC mechanism, we call @@ -4507,7 +4526,7 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) /* When we exit this block, restore the saved value. */ add_cleanup (build_call_n_expr (set_jmpbuf_decl, 1, gnu_jmpsave_decl), - End_Label (gnat_node)); + gnat_cleanup_loc_node); } /* If we are to call a function when exiting this block, add a cleanup @@ -4515,7 +4534,7 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) so we must register this cleanup after the EH cleanup just above. */ if (at_end) add_cleanup (build_call_n_expr (gnat_to_gnu (At_End_Proc (gnat_node)), 0), - End_Label (gnat_node)); + gnat_cleanup_loc_node); /* Now build the tree for the declarations and statements inside this block. If this is SJLJ, set our jmp_buf as the current buffer. */ @@ -4628,14 +4647,18 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) /* Now make the TRY_CATCH_EXPR for the block. */ gnu_result = build2 (TRY_CATCH_EXPR, void_type_node, gnu_inner_block, gnu_handlers); - /* Set a location. We need to find a uniq location for the dispatching + /* Set a location. We need to find a unique location for the dispatching code, otherwise we can get coverage or debugging issues. Try with the location of the end label. */ if (Present (End_Label (gnat_node)) && Sloc_to_locus (Sloc (End_Label (gnat_node)), &locus)) SET_EXPR_LOCATION (gnu_result, locus); else - set_expr_location_from_node (gnu_result, gnat_node); + /* Clear column information so that the exception handler of an + implicit transient block does not incorrectly inherit the slocs + of a decision, which would otherwise confuse control flow based + coverage analysis tools. */ + set_expr_location_from_node1 (gnu_result, gnat_node, true); } else gnu_result = gnu_inner_block; @@ -4830,9 +4853,10 @@ Exception_Handler_to_gnu_zcx (Node_Id gnat_node) add_stmt_with_node (build_call_n_expr (begin_handler_decl, 1, gnu_incoming_exc_ptr), gnat_node); - /* ??? We don't seem to have an End_Label at hand to set the location. */ + /* We don't have an End_Label at hand to set the location of the cleanup + actions, so we use that of the exception handler itself instead. */ add_cleanup (build_call_n_expr (end_handler_decl, 1, gnu_incoming_exc_ptr), - Empty); + gnat_node); add_stmt_list (Statements (gnat_node)); gnat_poplevel (); @@ -7384,13 +7408,15 @@ mark_visited (tree t) } /* Add GNU_CLEANUP, a cleanup action, to the current code group and - set its location to that of GNAT_NODE if present. */ + set its location to that of GNAT_NODE if present, but with column info + cleared so that conditional branches generated as part of the cleanup + code do not interfere with coverage analysis tools. */ static void add_cleanup (tree gnu_cleanup, Node_Id gnat_node) { if (Present (gnat_node)) - set_expr_location_from_node (gnu_cleanup, gnat_node); + set_expr_location_from_node1 (gnu_cleanup, gnat_node, true); append_to_statement_list (gnu_cleanup, ¤t_stmt_group->cleanups); } @@ -9005,10 +9031,11 @@ maybe_implicit_deref (tree exp) /* Convert SLOC into LOCUS. Return true if SLOC corresponds to a source code location and false if it doesn't. In the former case, set the Gigi global - variable REF_FILENAME to the simple debug file name as given by sinput. */ + variable REF_FILENAME to the simple debug file name as given by sinput. + If clear_column is true, set column information to 0. */ -bool -Sloc_to_locus (Source_Ptr Sloc, location_t *locus) +static bool +Sloc_to_locus1 (Source_Ptr Sloc, location_t *locus, bool clear_column) { if (Sloc == No_Location) return false; @@ -9022,7 +9049,7 @@ Sloc_to_locus (Source_Ptr Sloc, location_t *locus) { Source_File_Index file = Get_Source_File_Index (Sloc); Logical_Line_Number line = Get_Logical_Line_Number (Sloc); - Column_Number column = Get_Column_Number (Sloc); + Column_Number column = (clear_column ? 0 : Get_Column_Number (Sloc)); struct line_map *map = LINEMAPS_ORDINARY_MAP_AT (line_table, file - 1); /* We can have zero if pragma Source_Reference is in effect. */ @@ -9041,20 +9068,36 @@ Sloc_to_locus (Source_Ptr Sloc, location_t *locus) return true; } +/* Similar to the above, not clearing the column information. */ + +bool +Sloc_to_locus (Source_Ptr Sloc, location_t *locus) +{ + return Sloc_to_locus1 (Sloc, locus, false); +} + /* Similar to set_expr_location, but start with the Sloc of GNAT_NODE and don't do anything if it doesn't correspond to a source location. */ static void -set_expr_location_from_node (tree node, Node_Id gnat_node) +set_expr_location_from_node1 (tree node, Node_Id gnat_node, bool clear_column) { location_t locus; - if (!Sloc_to_locus (Sloc (gnat_node), &locus)) + if (!Sloc_to_locus1 (Sloc (gnat_node), &locus, clear_column)) return; SET_EXPR_LOCATION (node, locus); } +/* Similar to the above, not clearing the column information. */ + +static void +set_expr_location_from_node (tree node, Node_Id gnat_node) +{ + set_expr_location_from_node1 (node, gnat_node, false); +} + /* More elaborate version of set_expr_location_from_node to be used in more general contexts, for example the result of the translation of a generic GNAT node. */ @@ -9185,9 +9228,13 @@ set_end_locus_from_node (tree gnu_node, Node_Id gnat_node) gnat_node = Present (gnat_end_label) ? gnat_end_label : gnat_node; /* Some expanded subprograms have neither an End_Label nor a Sloc - attached. Notify that to callers. */ + attached. Notify that to callers. For a block statement with no + End_Label, clear column information, so that the tree for a + transient block does not receive the sloc of a source condition. */ - if (!Sloc_to_locus (Sloc (gnat_node), &end_locus)) + if (!Sloc_to_locus1 (Sloc (gnat_node), &end_locus, + No (gnat_end_label) && + (Nkind (gnat_node) == N_Block_Statement))) return false; switch (TREE_CODE (gnu_node)) diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 409c0dee94f..2c3e096f120 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -2573,7 +2573,7 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset) if (!prev_field) return false; - /* If the previous field is a union type, then return False: The only + /* If the previous field is a union type, then return false: The only time when such a field is not the last field of the record is when there are other components at fixed positions after it (meaning there was a rep clause for every field), in which case we don't want the diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index 7f7f6af034a..64f7564a75d 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -648,11 +648,11 @@ build_atomic_load (tree src) (build_qualified_type (void_type_node, TYPE_QUAL_VOLATILE)); tree mem_model = build_int_cst (integer_type_node, MEMMODEL_SEQ_CST); tree orig_src = src; - tree type = TREE_TYPE (src); - tree t, val; + tree t, addr, val; unsigned int size; int fncode; + /* Remove conversions to get the address of the underlying object. */ src = remove_conversions (src, false); size = resolve_atomic_size (TREE_TYPE (src)); if (size == 0) @@ -661,10 +661,13 @@ build_atomic_load (tree src) fncode = (int) BUILT_IN_ATOMIC_LOAD_N + exact_log2 (size) + 1; t = builtin_decl_implicit ((enum built_in_function) fncode); - src = build_unary_op (ADDR_EXPR, ptr_type, src); - val = build_call_expr (t, 2, src, mem_model); + addr = build_unary_op (ADDR_EXPR, ptr_type, src); + val = build_call_expr (t, 2, addr, mem_model); - return unchecked_convert (type, val, true); + /* First reinterpret the loaded bits in the original type of the load, + then convert to the expected result type. */ + t = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (src), val); + return convert (TREE_TYPE (orig_src), t); } /* Build an atomic store from SRC to the underlying atomic object in DEST. */ @@ -677,10 +680,11 @@ build_atomic_store (tree dest, tree src) (build_qualified_type (void_type_node, TYPE_QUAL_VOLATILE)); tree mem_model = build_int_cst (integer_type_node, MEMMODEL_SEQ_CST); tree orig_dest = dest; - tree t, int_type; + tree t, int_type, addr; unsigned int size; int fncode; + /* Remove conversions to get the address of the underlying object. */ dest = remove_conversions (dest, false); size = resolve_atomic_size (TREE_TYPE (dest)); if (size == 0) @@ -690,10 +694,20 @@ build_atomic_store (tree dest, tree src) t = builtin_decl_implicit ((enum built_in_function) fncode); int_type = gnat_type_for_size (BITS_PER_UNIT * size, 1); - dest = build_unary_op (ADDR_EXPR, ptr_type, dest); - src = unchecked_convert (int_type, src, true); + /* First convert the bits to be stored to the original type of the store, + then reinterpret them in the effective type. But if the original type + is a padded type with the same size, convert to the inner type instead, + as we don't want to artificially introduce a CONSTRUCTOR here. */ + if (TYPE_IS_PADDING_P (TREE_TYPE (dest)) + && TYPE_SIZE (TREE_TYPE (dest)) + == TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (dest))))) + src = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (dest))), src); + else + src = convert (TREE_TYPE (dest), src); + src = fold_build1 (VIEW_CONVERT_EXPR, int_type, src); + addr = build_unary_op (ADDR_EXPR, ptr_type, dest); - return build_call_expr (t, 3, dest, src, mem_model); + return build_call_expr (t, 3, addr, src, mem_model); } /* Make a binary operation of kind OP_CODE. RESULT_TYPE is the type diff --git a/gcc/ada/sigtramp-ppcvxw.c b/gcc/ada/sigtramp-ppcvxw.c index 69baa1420df..e7b318fa9bf 100644 --- a/gcc/ada/sigtramp-ppcvxw.c +++ b/gcc/ada/sigtramp-ppcvxw.c @@ -6,7 +6,7 @@ * * * Asm Implementation File * * * - * Copyright (C) 2011-2012, Free Software Foundation, Inc. * + * Copyright (C) 2011-2013, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c index dfadca8d6a9..8672ca372b6 100644 --- a/gcc/ada/terminals.c +++ b/gcc/ada/terminals.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 2008-2012, AdaCore * + * Copyright (C) 2008-2013, AdaCore * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * |