From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by sourceware.org (Postfix) with ESMTPS id 9D96A384AB58 for ; Fri, 3 May 2024 16:04:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9D96A384AB58 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9D96A384AB58 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714752286; cv=none; b=FRqK6flJtMkxMCy9FjzsVEHPQI9LkQ84SoI+4FthnumDBm2mejIsH1MAGe4SUV4ooYUSv+1qmDsvVRZ21d+VsS7uthTJzrfAlLfCWbzy/NXV0OvwwkIqY1x59KFi0BKc5c2IS/A71fVG40sczpY4XtqSiQNVxf9rCsE2lF1NipM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714752286; c=relaxed/simple; bh=xPk6qKCY9B5Pj4AYygT27naTVLagFa+Lu8khALSeW3A=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=YHAN2ge+hCHCj1QacSGiSmRwvdP5B2Z8JYI1qKmQTAcXDoSanqNnAN1wWyW0mW/YTIzAN+CMlGfffdRLArUHsdQfIQYCwm4BlUVsCYnR3Za+i8gTlKnKZjTSwhs0IXpvI5mOiJtnf+XPA1d0xJNYu4g3BYh3wJ4jC2BzT1SduWU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-41b5e74fa2fso61653175e9.1 for ; Fri, 03 May 2024 09:04:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714752283; x=1715357083; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qrSQlVZGm58Hzqg7UE3fx3QmuXFeSt8i2s4ybg51I+U=; b=P7M4W3hQKgK95g10MdasAtpm2eBSp7ZKU5YwMCamPRLsRhK3nLvkuU0GyafbeiyzAz st2QVJ3yigRztHfnSa5QGShIfSzLbiZH6OYTBqwtcJOjF0JJ6VHDa8t9ryuPI/YFj22h HjT+VhlV1/o/05LKjkKOJbmDzosL5JA5U++QuQk18YtmSFSFN51LoETFO/YfS/TYVE8R NDmiqiePN9uLoJq6Hn+ZcKlKKFmVLY2B3SSstSQESP6qMIh62fWgPvTab47TDw4klq2+ 148MvXE+00clfDPm62OD3q/so2SvWAHroYdFk4cJn7Nh3eXI+OQiW8bAnvp2qRtgAkOW Gm1Q== X-Forwarded-Encrypted: i=1; AJvYcCW5iGdwVW3EamsBLhfOlYUo6CrD07NyXmS1wCc1nscJAltt4oi54X6lokIDSxQPZCNMqZ5FOU2hTWaMxZe28RyrQ58xu7xPgf8Q/Q== X-Gm-Message-State: AOJu0Yz0yUxMPsNnwIPk+qDKeAO2S+IE8HtERpXTfGZQhVhTChrxP3Q2 6mRlKF5aQ3SCXcP8CwkNO14121DZihaGOxONuaqpnqUoA26X3ykfObA3EA== X-Google-Smtp-Source: AGHT+IGrE1oGIrkdJLqJ6xEZr/5Zn3uYw8AUvWT0eeJE4aPnHb+7jpQ4dyPD3EyLXTXIp3G0VTXP9g== X-Received: by 2002:a05:600c:3b02:b0:418:f760:abfb with SMTP id m2-20020a05600c3b0200b00418f760abfbmr2316803wms.5.1714752283411; Fri, 03 May 2024 09:04:43 -0700 (PDT) Received: from ?IPV6:2001:8a0:f93d:b900:7cde:c2ed:ba96:7cc7? ([2001:8a0:f93d:b900:7cde:c2ed:ba96:7cc7]) by smtp.gmail.com with ESMTPSA id p12-20020a05600c1d8c00b0041bcb898984sm6054718wms.31.2024.05.03.09.04.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 May 2024 09:04:42 -0700 (PDT) Message-ID: <51de396e-67fc-4451-a13e-091178d188f7@palves.net> Date: Fri, 3 May 2024 17:04:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb/exp] Fix cast handling for indirection To: Tom Tromey , Kevin Buettner Cc: Tom de Vries , gdb-patches@sourceware.org References: <20240502154902.22575-1-tdevries@suse.de> <20240502193145.5da7327d@f39-zbm-amd> <8734qyex0l.fsf@tromey.com> From: Pedro Alves Content-Language: en-US In-Reply-To: <8734qyex0l.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no 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 2024-05-03 16:27, Tom Tromey wrote: > Here the function actually returns char*, it's just the debug info is > missing. > > Normally users should have written: > > print *(char *) a_loc() > > here, at least after the changes a while ago to require a cast of the > return type here. Longer ago, debuginfo-less functions did default to > int return in gdb, but Pedro (I think) changed this a while back. Yes. > > I was wondering if this patch causes gdb to accept some weird things > that might have been rejected in the past, by introducing a hidden cast. > Maybe print (char) *85732 does something surprising now. I'm not > entirely sure if that's bad. I am totally surprised that: +# Regression test for PR31693. +gdb_test "p (char)*a_loc ()" " = 97 'a'" this actually works, instead of telling the user: "'a_loc' has unknown return type; cast the call to its declared return type" It seems like a misfeature to me to assume that "char *" is the right type. Thus, I don't agree with the patch.