Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Tankut Baris Aktemur <tankutbaris.aktemur@amd.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH v2 08/17] gdb: convert type instance flags to bitfields
Date: Fri, 24 Jul 2026 12:10:57 -0700	[thread overview]
Message-ID: <053e90c0-53f0-4748-9d27-0237b9f21221@redhat.com> (raw)
In-Reply-To: <20260722-users-aktemur-type-instance-flags-v2-8-d60dcbc2a76f@amd.com>

Hi,

I know Tom has already approved this, but I want to raise
awareness of a small problem introduced in this patch.

On 7/22/26 3:41 AM, Tankut Baris Aktemur wrote:
> diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
> index 1749c3ba741..11a08428baf 100644
> --- a/gdb/gdbtypes.h
> +++ b/gdb/gdbtypes.h
> @@ -99,51 +99,80 @@ enum harvard_address_space
[snip]
 >   > -/* Not textual.  By default, GDB treats all single byte integers as
> -   characters (or elements of strings) unless this flag is set.  */
> +  type_instance_flags &operator|= (const type_instance_flags &other)
> +  {
> +    is_const = is_const || other.is_const;
> +    is_volatile = is_volatile || other.is_volatile;
> +
> +    gdb_assert (harvard_aspace == 0);
> +    harvard_aspace = other.harvard_aspace;
>   
This assumes the left-hand side is empty, but check_typedef can call
|= when the accumulated (outer) flags already have a Harvard space or
address class set.

Here's a concrete demonstration of the problem:

typedef int myint;

(gdb) ptype (@code myint) 3
../../src/gdb/gdbtypes.h:127: internal-error: operator|=: Assertion 
`harvard_aspace == 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x5bb1d1 gdb_internal_backtrace_1
	../../src/gdb/bt-utils.c:122
0x5bb210 _Z22gdb_internal_backtracev
	../../src/gdb/bt-utils.c:173
0xdfbbaa internal_vproblem
	../../src/gdb/utils.c:434
0xdfbf45 _Z15internal_verrorPKciS0_P13__va_list_tag
	../../src/gdb/utils.c:514
0x162763f _Z18internal_error_locPKciS0_z
	../../src/gdbsupport/errors.cc:57
0x87e8e6 _ZN19type_instance_flagsoRERKS_
	../../src/gdb/gdbtypes.h:127
0x875d71 _Z13check_typedefP4type
	../../src/gdb/gdbtypes.c:3072
[snip]

The "outer" type (associated with "@code") has an address space
set. When check_typedef then attempts to merge the inner "myint"
definition, the assert triggers.

Keith


  reply	other threads:[~2026-07-24 19:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 10:41 [PATCH v2 00/17] Rewrite type instance flags as a struct with bitfields Tankut Baris Aktemur
2026-07-22 10:41 ` [PATCH v2 01/17] gdb: use type instance macros to query const, volatile, restrict Tankut Baris Aktemur
2026-07-22 10:41 ` [PATCH v2 02/17] gdb: convert address_class_type_flags_to_name to address_class_id_to_name Tankut Baris Aktemur
2026-07-22 10:41 ` [PATCH v2 03/17] gdb: convert address_class_name_to_type_flags to address_class_name_to_id Tankut Baris Aktemur
2026-07-22 10:41 ` [PATCH v2 04/17] gdb: convert address_class_type_flags to address_class_dwarf_to_id Tankut Baris Aktemur
2026-07-22 10:41 ` [PATCH v2 05/17] gdb: refactor type_stack::insert methods Tankut Baris Aktemur
2026-07-22 10:41 ` [PATCH v2 06/17] gdb: inline address_space_{name, type_instance_flags}_to_{type_instance_flags, name} Tankut Baris Aktemur
2026-07-22 10:41 ` [PATCH v2 07/17] gdb: split make_type_with_address_space Tankut Baris Aktemur
2026-07-22 10:41 ` [PATCH v2 08/17] gdb: convert type instance flags to bitfields Tankut Baris Aktemur
2026-07-24 19:10   ` Keith Seitz [this message]
2026-07-22 10:41 ` [PATCH v2 09/17] gdb: convert TYPE_NOTTEXT macro to type::is_nottext Tankut Baris Aktemur
2026-07-22 10:41 ` [PATCH v2 10/17] gdb: convert TYPE_CONST macro to type::is_const Tankut Baris Aktemur
2026-07-22 10:42 ` [PATCH v2 11/17] gdb: convert TYPE_VOLATILE macro to type::is_volatile Tankut Baris Aktemur
2026-07-22 10:42 ` [PATCH v2 12/17] gdb: convert TYPE_CODE_SPACE macro to type::is_code_space Tankut Baris Aktemur
2026-07-22 10:42 ` [PATCH v2 13/17] gdb: convert TYPE_DATA_SPACE macro to type::is_data_space Tankut Baris Aktemur
2026-07-22 10:42 ` [PATCH v2 14/17] gdb: convert TYPE_RESTRICT macro to type::is_restrict Tankut Baris Aktemur
2026-07-22 10:42 ` [PATCH v2 15/17] gdb: convert TYPE_ATOMIC macro to type::is_atomic Tankut Baris Aktemur
2026-07-22 10:42 ` [PATCH v2 16/17] gdb: convert TYPE_ADDRESS_CLASS macro to type::address_class Tankut Baris Aktemur
2026-07-22 10:42 ` [PATCH v2 17/17] gdb: remove unnecessary braces in recursive_dump_type Tankut Baris Aktemur
2026-07-22 15:42 ` [PATCH v2 00/17] Rewrite type instance flags as a struct with bitfields Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=053e90c0-53f0-4748-9d27-0237b9f21221@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tankutbaris.aktemur@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox