From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id PxZYIrkVz2gDHAwAWB0awg (envelope-from ) for ; Sat, 20 Sep 2025 16:59:37 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=ZFrL6TD8; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 77CDD1E0BA; Sat, 20 Sep 2025 16:59:37 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 81AF21E04C for ; Sat, 20 Sep 2025 16:59:36 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E42F13858424 for ; Sat, 20 Sep 2025 20:59:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E42F13858424 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=ZFrL6TD8 Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 37BC1385841E for ; Sat, 20 Sep 2025 20:58:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 37BC1385841E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 37BC1385841E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758401913; cv=none; b=GpfF3Vnge68qRuR9oCdlSjdhKa+3o8hynkDreCMq4WxBdpsIGLVV4SKitGATmO9iMupeqbpNKXdlmWznQgWa2bnnBkPNJXhSPoqXjqce5HCLmTmwD7n5JAyRC418Wi5E9KeYGiDIYcbcpJHHqV4pKPioZKbCPK4pfXs4vPusivg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758401913; c=relaxed/simple; bh=RMCi6bB0GUISIyggdcUZvUzBenHeO7X5MQWMQJ2ycew=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=cTck63Zgvf7FICmJOPvaCt1UBFx4aj2GPiUU0MmMmhcMOdOzvo9hljjFuW5zyhrAxIvrF/Y5hvqkOjacPPaW0WxC1519xFcvHUUq8fC9lEZFG/NeHd8XIzfliz2+bTrRbi92aFpefTgH4OI5RdP2AfbOqM1MiSI3p14ce7rgtdc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 37BC1385841E Received: from eig-obgw-5001b.ext.cloudfilter.net ([10.0.29.181]) by cmsmtp with ESMTPS id 02oVvwUEbSkcf04fAvjcky; Sat, 20 Sep 2025 20:58:32 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 04fAvVZ0GmCqv04fAvZ0fl; Sat, 20 Sep 2025 20:58:32 +0000 X-Authority-Analysis: v=2.4 cv=W8Y4VQWk c=1 sm=1 tr=0 ts=68cf1578 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=yJojWOMRYYMA:10 a=ItBw4LHWJt0A:10 a=zstS-IiYAAAA:8 a=zBxmsR6E8-ps-bf1GNkA:9 a=4G6NA9xxw8l3yy4pmD5M:22 a=VS4QxaUSPT0UtbFnIvSC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Id2QEQXdUk4V500qv41GqANZhtSBqLVvr9C6DtLeZAU=; b=ZFrL6TD8hKNxIekQcgbvXB1qLd aEUqKHmEaAU7a+avZnTyPcg+ooyUBjXVyRpLzRKSIaY6qbFdsuzHkz9IcDEo6FbpufPVm6tpgsYho yl4rE1uA4D0IuW7Y9osxvTqB2; Received: from 97-122-110-68.hlrn.qwest.net ([97.122.110.68]:56044 helo=prentzel) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1v04f9-00000002Tjc-3UsZ; Sat, 20 Sep 2025 14:58:31 -0600 From: Tom Tromey To: Kevin Buettner Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] Fix crash in f-typeprint.c In-Reply-To: <20250915092635.0b406689@f41-zbm-amd> (Kevin Buettner's message of "Mon, 15 Sep 2025 09:26:35 -0700") References: <20250913194811.933550-1-tom@tromey.com> <20250913144716.5ecd1209@f41-zbm-amd> <87o6ref0kq.fsf@tromey.com> <20250915092635.0b406689@f41-zbm-amd> X-Attribution: Tom Date: Sat, 20 Sep 2025 14:58:31 -0600 Message-ID: <87y0q8et8o.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.110.68 X-Source-L: No X-Exim-ID: 1v04f9-00000002Tjc-3UsZ X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-110-68.hlrn.qwest.net (prentzel) [97.122.110.68]:56044 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfIH1seNWku75dtfWVHY98TTQPBlXazoqcdj90LOXkzhrzsKpLPEXpT9LPWydP2mFNYPi0hAh3pVayVVAbglX5Pj+q3t7N4xcld5WLojFWsuP/HnYob+Y UWfbru7wd+XQUd9pMojJcx+Vyr4AGp72tSz1cUMPQjKpcPaj0yNBvG3bXD/ZIm0sR9CsJdXQJ2FxsiZZAYYZqevm4t5M4yqNRZY= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org >> I don't know but this change does preserve what happened before the >> change to gdb_puts. Kevin> Since it fixes a crash and preserves the original behavior... Well, I took another look and I think that moving the space-printing into the same 'if' seems ok. It doesn't cause any test regressions either. Here's the updated version, let me know what you think. Tom commit 2c56513f148f24d9595a8bc95f15acd3e70353d3 Author: Tom Tromey Date: Sat Sep 13 13:44:10 2025 -0600 Fix crash in f-typeprint.c I noticed a crash in f-typeprint.c that was hidden by an xfail: XFAIL: gdb.fortran/vla-array.exp: print variable length string array type (GDB internal error) (PRMS gcc/101826) I think this was introduced by commit 6594ca4a ("do not handle a NULL linebuffer in pager_file::puts") but not detected due to the xfail. It seems bad for an xfail to cover up a crash but I haven't investigated that. Meanwhile, this patch fixes the crash by checking for a NULL pointer when calling gdb_puts. diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index e96d27c537e..04eca74fb2b 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -412,9 +412,11 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream, if (show > 0) f_type_print_derivation_info (type, stream); - gdb_puts (" ", stream); - - gdb_puts (type->name (), stream); + if (type->name () != nullptr) + { + gdb_puts (" ", stream); + gdb_puts (type->name (), stream); + } /* According to the definition, we only print structure elements in case show > 0. */ @@ -432,7 +434,8 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream, gdb_puts ("\n", stream); } gdb_printf (stream, "%*sEnd Type ", level, ""); - gdb_puts (type->name (), stream); + if (type->name () != nullptr) + gdb_puts (type->name (), stream); } break;