* Fix PR debug/113519 and debug/113777
@ 2024-03-11 8:30 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2024-03-11 8:30 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 560 bytes --]
They both come from an oversight of mine in the placement of the DIE created
for an enumeration type with reverse scalar storage order.
Tested on x86-64/Linux, both GCC and GDB, applied on mainline as obvious.
2024-03-11 Eric Botcazou <ebotcazou@adacore.com>
PR debug/113519
PR debug/113777
* dwarf2out.cc (gen_enumeration_type_die): In the reverse case,
generate the DIE with the same parent as in the regular case.
2024-03-11 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/sso-20.c: New test.
* gcc.dg/sso-21.c: Likewise.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 981 bytes --]
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 03d73f9eecd..9b1548e4ae3 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -22868,18 +22868,19 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die, bool reverse)
if (type_die == NULL || reverse)
{
+ dw_die_ref scope_die = scope_die_for (type, context_die);
+
/* The DIE with DW_AT_endianity is placed right after the naked DIE. */
if (reverse)
{
gcc_assert (type_die);
dw_die_ref after_die = type_die;
type_die = new_die_raw (DW_TAG_enumeration_type);
- add_child_die_after (context_die, type_die, after_die);
+ add_child_die_after (scope_die, type_die, after_die);
}
else
{
- type_die = new_die (DW_TAG_enumeration_type,
- scope_die_for (type, context_die), type);
+ type_die = new_die (DW_TAG_enumeration_type, scope_die, type);
equate_type_number_to_die (type, type_die);
}
add_name_attribute (type_die, type_tag (type));
[-- Attachment #3: sso-20.c --]
[-- Type: text/x-csrc, Size: 379 bytes --]
/* PR debug/113519 */
/* Reported by Zdenek Sojka <zsojka@seznam.cz> */
/* { dg-do compile } */
/* { dg-options "-g -fdebug-types-section" } */
enum E { X };
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
struct __attribute__((scalar_storage_order("big-endian")))
{
enum E e;
} S;
#else
struct __attribute__((scalar_storage_order("little-endian")))
{
enum E e;
} S;
#endif
[-- Attachment #4: sso-21.c --]
[-- Type: text/x-csrc, Size: 398 bytes --]
/* PR debug/113777 */
/* Reported by Zdenek Sojka <zsojka@seznam.cz> */
/* { dg-do compile } */
/* { dg-options "-g" } */
typedef short __attribute__((__hardbool__)) hbool;
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
struct __attribute__((scalar_storage_order("big-endian")))
{
hbool a[2];
} S;
#else
struct __attribute__((scalar_storage_order("little-endian")))
{
hbool a[2];
} S;
#endif
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-03-11 8:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-11 8:30 Fix PR debug/113519 and debug/113777 Eric Botcazou
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).