diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2012-01-27 08:53:38 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2012-01-27 08:53:38 +0000 |
commit | 6b318bf2bfa83bd5bd814cb7bbc15ad282db9f28 (patch) | |
tree | b58c5fff78f5551c34d2620ef83fabfacbefdddd /gcc | |
parent | a76358008e043e0666940a98d1bcb1411bd4519a (diff) | |
download | gcc-6b318bf2bfa83bd5bd814cb7bbc15ad282db9f28.zip gcc-6b318bf2bfa83bd5bd814cb7bbc15ad282db9f28.tar.gz gcc-6b318bf2bfa83bd5bd814cb7bbc15ad282db9f28.tar.bz2 |
decl.c (gnat_to_gnu_entity): For an aliased object with an unconstrained nominal subtype and if...
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: For an aliased
object with an unconstrained nominal subtype and if optimization isn't
enabled, create a special VAR_DECL for debugging purposes.
From-SVN: r183605
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 44 |
2 files changed, 46 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c18fced..361a1fa 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2012-01-27 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_entity) <object>: For an aliased + object with an unconstrained nominal subtype and if optimization isn't + enabled, create a special VAR_DECL for debugging purposes. + 2012-01-23 Robert Dewar <dewar@adacore.com> * sem_prag.ads, sem_prag.adb: Minor reformatting. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 9d81ade..a373061 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2011, Free Software Foundation, Inc. * + * Copyright (C) 1992-2012, 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- * @@ -889,10 +889,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && Is_Array_Type (Etype (gnat_entity)) && !type_annotate_only) { - tree gnu_fat - = TREE_TYPE (gnat_to_gnu_type (Base_Type (Etype (gnat_entity)))); + tree gnu_array + = gnat_to_gnu_type (Base_Type (Etype (gnat_entity))); gnu_type - = build_unc_object_type_from_ptr (gnu_fat, gnu_type, + = build_unc_object_type_from_ptr (TREE_TYPE (gnu_array), + gnu_type, concat_name (gnu_entity_name, "UNC"), debug_info_p); @@ -1468,6 +1469,41 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) } } + /* If this is an aliased object with an unconstrained nominal subtype + and optimization isn't enabled, create a VAR_DECL for debugging + purposes whose type is a thin reference (the reference counterpart + of a thin pointer), so that it will be directly initialized to the + address of the array part. */ + else if (Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity)) + && Is_Array_Type (Etype (gnat_entity)) + && !type_annotate_only + && !optimize + && debug_info_p) + { + tree gnu_array + = gnat_to_gnu_type (Base_Type (Etype (gnat_entity))); + tree gnu_thin_type + = build_reference_type (TYPE_OBJECT_RECORD_TYPE (gnu_array)); + tree gnu_ref, gnu_debug_decl; + + /* In case the object with the template has already been indirectly + allocated, we have nothing to do here. */ + if (TYPE_IS_THIN_POINTER_P (gnu_type)) + gnu_ref = gnu_decl; + else + gnu_ref = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_decl); + gnu_ref = convert (gnu_thin_type, gnu_ref); + + gnu_debug_decl + = create_var_decl (gnu_entity_name, gnu_ext_name, + gnu_thin_type, NULL_TREE, const_flag, + Is_Public (gnat_entity), !definition, + static_p, attr_list, gnat_entity); + SET_DECL_VALUE_EXPR (gnu_debug_decl, gnu_ref); + DECL_HAS_VALUE_EXPR_P (gnu_debug_decl) = 1; + DECL_IGNORED_P (gnu_decl) = 1; + } + /* If this is a constant and we are defining it or it generates a real symbol at the object level and we are referencing it, we may want or need to have a true variable to represent it: |