From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 340903858C33 for ; Wed, 22 Nov 2023 17:02:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 340903858C33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 340903858C33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:67c:2178:6::1c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700672573; cv=none; b=UqAMvmNASsZuTWrjZsZJ0nzGf7V06VQkft3OMHiLCKW2nJ8X765ji795lPC+ZWDervdvCEdo01qzzHN4tRmCWyitBBwUKNNUkGuojRKR3/e/8Gj7qzYZHB3YTlqJnuixTSKKxriE8mvoWqSIYlp5oWO7rHqPvSYIpl5aW7OsIH8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700672573; c=relaxed/simple; bh=aECaR0B+uaxPo/Me9JKzhsNhMOGbQh1Dpkl8VspCAaI=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=CyqkNlpe8ACAa5ZExNTTBM1d/Nuq8B22kVoyXjPPaY7fyrB/Rf3qoWdYoC8GkpVL9iUJdMsjidmmKBkskAZ7dSI0VL7vKHhIAfffP56ZcYxM/4NOLU649ZBov9iumItd01Cd2yswk9nay8KMFySCliKQryhXRKMSB4IroXT8Pkg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DA78421977; Wed, 22 Nov 2023 17:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1700672561; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZzgHG+1IbuwcBgR29jaZLR+3/mdDJrcBEs9jhrjYlE8=; b=wvWfdyb4TFKL82nvluBm4lDyfIMZjCtB+Mhp9+sc2+8mWTpO4uv2AtBsDXVA29ErjSQ6/4 oZQyRwnXzVQTt7dBNxzcXIO4NonF90SEyQyHBWpzMXpvn/WW5j5UIZyC3hnHubkwBYbDFx HTJxnT5zrSwJVuvudFNI6b1p3zAg5sg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1700672561; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZzgHG+1IbuwcBgR29jaZLR+3/mdDJrcBEs9jhrjYlE8=; b=lvIHMj9dnY+TW+VJM1Yg9G4wLHVbQzIHbLNFxsYf6jKXJPe5VTuzjqg8YjYLPd8JYxNtzw d9ws1djco2pdOuBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id BA33A13461; Wed, 22 Nov 2023 17:02:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ZCQwLDE0XmVETgAAMHmgww (envelope-from ); Wed, 22 Nov 2023 17:02:41 +0000 Message-ID: Date: Wed, 22 Nov 2023 18:04:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Fix build with GCC 7.5 Content-Language: en-US To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20231122140310.861086-1-tromey@adacore.com> <4d6a5f51-eb17-4de4-9c9f-df6a487ee9a1@suse.de> <871qchizqp.fsf@tromey.com> From: Tom de Vries In-Reply-To: <871qchizqp.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -4.29 X-Spamd-Result: default: False [-4.29 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_NUMSUBJECT,KAM_SHORT,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 11/22/23 16:17, Tom Tromey wrote: > Tom> This fixes one of the three warnings. > > Indeed, duh. Sorry about that. > > Here is v2. > With this patch I was able to finish the build using system gcc 7.5.0. Thanks, - Tom > Tom > > commit 0447f3d09267f6fb90237b42aa6e1ec137a09c87 > Author: Tom Tromey > Date: Wed Nov 22 06:54:40 2023 -0700 > > Fix build with GCC 7.5 > > A recent change to 'struct field' caused a build failure with GCC > 7.5.0, as reported by Tom de Vries: > > /data/vries/gdb/src/gdb/gdbtypes.h:721:51: error: > ‘field::m_accessibility’ is too small to hold all values of ‘enum > class accessibility’ [-Werror] > ENUM_BITFIELD (accessibility) m_accessibility : 2; > ^ > > Mark Wielaard pointed out that this was a GCC bug: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51242 > > This patch works around the bug by changing several members not to be > bitfields. It reduces the size of the enum's underlying type, > instead. > > I also changed m_bitsize to no longer be a bitfield -- that was done > for packing reasons in ancient times, but with m_accessibility not > being a bitfield, this no longer matters. > > I removed fn_field::dummy. In earlier times it was somewhat normal in > gdb to have these dummy fields to keep track of any available padding. > However, since the advent of "ptype/o", there doesn't seem to be any > need for this. > > This patch does not change the size of struct field, fn_field, or > decl_field on 64-bit hosts. > > diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h > index 34ca1ac99e5..eca92196364 100644 > --- a/gdb/gdbtypes.h > +++ b/gdb/gdbtypes.h > @@ -534,7 +534,7 @@ union field_location > }; > > /* Accessibility of a member. */ > -enum class accessibility : unsigned > +enum class accessibility : unsigned char > { > /* It's important that this be 0 so that fields default to > public. */ > @@ -717,8 +717,6 @@ struct field > > unsigned int m_artificial : 1; > > - /* Accessibility of the field. */ > - ENUM_BITFIELD (accessibility) m_accessibility : 2; > /* Whether the field is 'virtual'. */ > bool m_virtual : 1; > /* Whether the field is 'ignored'. */ > @@ -728,13 +726,16 @@ struct field > > ENUM_BITFIELD(field_loc_kind) m_loc_kind : 3; > > + /* Accessibility of the field. */ > + enum accessibility m_accessibility; > + > /* * Size of this field, in bits, or zero if not packed. > If non-zero in an array type, indicates the element size in > bits (used only in Ada at the moment). > For an unpacked field, the field's type's length > says how many bytes the field occupies. */ > > - unsigned int m_bitsize : 28; > + unsigned int m_bitsize; > > /* * In a struct or union type, type of this field. > - In a function or member type, type of this argument. > @@ -1611,8 +1612,6 @@ struct fn_field > > unsigned int is_const:1; > unsigned int is_volatile:1; > - /* Accessibility of the field. */ > - ENUM_BITFIELD (accessibility) accessibility : 2; > unsigned int is_artificial:1; > > /* * A stub method only has some fields valid (but they are enough > @@ -1633,9 +1632,8 @@ struct fn_field > > ENUM_BITFIELD (dwarf_defaulted_attribute) defaulted : 2; > > - /* * Unused. */ > - > - unsigned int dummy:6; > + /* Accessibility of the field. */ > + enum accessibility accessibility; > > /* * Index into that baseclass's virtual function table, minus 2; > else if static: VOFFSET_STATIC; else: 0. */ > @@ -1658,7 +1656,7 @@ struct decl_field > struct type *type; > > /* Accessibility of the field. */ > - ENUM_BITFIELD (accessibility) accessibility : 2; > + enum accessibility accessibility; > }; > > /* * C++ language-specific information for TYPE_CODE_STRUCT and