From: Eric Botcazou Date: Fri, 11 Oct 2019 09:17:23 +0000 (+0000) Subject: decl.c (elaborate_reference_1): Specifically deal with pointer displacement. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b67e2ad80d3e080c5258ff64ddb6f40e8d783e0b;p=gcc.git decl.c (elaborate_reference_1): Specifically deal with pointer displacement. * gcc-interface/decl.c (elaborate_reference_1): Specifically deal with pointer displacement. * gcc-interface/decl.c (components_to_record): Use proper name. * gcc-interface/trans.c (Sloc_to_locus): Use standard types. From-SVN: r276874 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ae9fd4c2b6a..adbfa7027ce 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2019-10-11 Eric Botcazou + + * gcc-interface/decl.c (elaborate_reference_1): Specifically deal with + pointer displacement. + + * gcc-interface/decl.c (components_to_record): Use proper name. + + * gcc-interface/trans.c (Sloc_to_locus): Use standard types. + 2019-10-11 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_field): Adjust again the packing diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index b3f8d589682..29c5a8e7821 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -6782,6 +6782,15 @@ elaborate_reference_1 (tree ref, void *data) elaborate_reference_1 (TREE_OPERAND (ref, 0), data), TREE_OPERAND (ref, 1), NULL_TREE); + /* If this is the displacement of a pointer, elaborate the pointer and then + displace the result. The actual purpose here is to drop the location on + the expression, which may be problematic if replicated on references. */ + if (TREE_CODE (ref) == POINTER_PLUS_EXPR + && TREE_CODE (TREE_OPERAND (ref, 1)) == INTEGER_CST) + return build2 (POINTER_PLUS_EXPR, TREE_TYPE (ref), + elaborate_reference_1 (TREE_OPERAND (ref, 0), data), + TREE_OPERAND (ref, 1)); + sprintf (suffix, "EXP%d", ++er->n); return elaborate_expression_1 (ref, er->entity, suffix, er->definition, false); @@ -7923,7 +7932,7 @@ components_to_record (Node_Id gnat_component_list, Entity_Id gnat_record_type, && !(Is_Packed (gnat_record_type) ? has_non_packed_fixed_size_field : Optimize_Alignment_Space (gnat_record_type)) - && !debug__debug_flag_dot_r); + && !Debug_Flag_Dot_R); const bool w_reorder = (Convention (gnat_record_type) == Convention_Ada && Warn_On_Questionable_Layout diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 1ee9732cac6..61e05d52a54 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -10848,8 +10848,8 @@ Sloc_to_locus (Source_Ptr Sloc, location_t *locus, bool clear_column, } Source_File_Index file = Get_Source_File_Index (Sloc); - Logical_Line_Number line = Get_Logical_Line_Number (Sloc); - Column_Number column = (clear_column ? 0 : Get_Column_Number (Sloc)); + Line_Number_Type line = Get_Logical_Line_Number (Sloc); + Column_Number_Type column = (clear_column ? 0 : Get_Column_Number (Sloc)); line_map_ordinary *map = LINEMAPS_ORDINARY_MAP_AT (line_table, file - 1); /* We can have zero if pragma Source_Reference is in effect. */