public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [FYI] map packed field type to unpacked for debug info
@ 2024-06-12  2:07 Alexandre Oliva
  2024-06-14  0:09 ` Alexandre Oliva
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Oliva @ 2024-06-12  2:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou


We create a distinct type for each field in a packed record with a
gnu_size, but there is no distinct debug information for them.  Use
the same unpacked type for debug information.

Regstrapped on x86_64-linux-gnu.  Pre-approved by Eric.  I'm checking it
in.


for  gcc/ada/ChangeLog

	* gcc-interface/decl.cc (gnat_to_gnu_field): Use unpacked type
	as the debug type for packed fields.

for  gcc/testsuite/ChangeLog

	* gnat.dg/bias1.adb: Count occurrences of -7.*DW_AT_GNU_bias.
---
 gcc/ada/gcc-interface/decl.cc   |    4 ++++
 gcc/testsuite/gnat.dg/bias1.adb |    3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 8b72c96c4396a..e97ff64a4805c 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -7786,6 +7786,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
   /* If a size is specified, adjust the field's type to it.  */
   if (gnu_size)
     {
+      tree debug_field_type = gnu_field_type;
       tree orig_field_type;
 
       /* If the field's type is justified modular, we would need to remove
@@ -7844,6 +7845,9 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
 	  && !DECL_P (TYPE_NAME (gnu_field_type)))
 	create_type_decl (TYPE_NAME (gnu_field_type), gnu_field_type, true,
 			  debug_info_p, gnat_field);
+
+      if (debug_info_p && gnu_field_type != debug_field_type)
+	SET_TYPE_DEBUG_TYPE (gnu_field_type, debug_field_type);
     }
 
   /* Otherwise (or if there was an error), don't specify a position.  */
diff --git a/gcc/testsuite/gnat.dg/bias1.adb b/gcc/testsuite/gnat.dg/bias1.adb
index 016a159b692da..d9a00a1aa4588 100644
--- a/gcc/testsuite/gnat.dg/bias1.adb
+++ b/gcc/testsuite/gnat.dg/bias1.adb
@@ -1,6 +1,7 @@
 --  { dg-do compile }
 --  { dg-options "-cargs -g -dA -gnatws -fgnat-encodings=gdb -margs" }
 --  { dg-final { scan-assembler "DW_AT_GNU_bias" } }
+--  { dg-final { scan-assembler-times "-7.*DW_AT_GNU_bias" 1 } }
 
 procedure Bias1 is
    type Small is range -7 .. -4;
@@ -31,4 +32,4 @@ procedure Bias1 is
 
 begin
    null;
-end Bias1;
\ No newline at end of file
+end Bias1;


-- 
Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
   Free Software Activist                   GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FYI] map packed field type to unpacked for debug info
  2024-06-12  2:07 [FYI] map packed field type to unpacked for debug info Alexandre Oliva
@ 2024-06-14  0:09 ` Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2024-06-14  0:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

On Jun 11, 2024, Alexandre Oliva <oliva@adacore.com> wrote:

> Regstrapped on x86_64-linux-gnu.  Pre-approved by Eric.  I'm checking it
> in.

... I've just reverted it.  It turned out to be too easy to be good :-(
There were various regressions, including infinite loops in the compiler
to GDB regressions yet to be investigated.  I'll be back with an
improved version.

-- 
Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
   Free Software Activist                   GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-14  0:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-12  2:07 [FYI] map packed field type to unpacked for debug info Alexandre Oliva
2024-06-14  0:09 ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).