From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id 23E123858D1E for ; Wed, 20 Mar 2024 17:05:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 23E123858D1E 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 23E123858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710954359; cv=none; b=TzoxTunuw9xS79xnT87wfyYPOpXbgtUfvRvNK0WJFzHDigSJ+wYnTfWH4Fj6NZVtfmGu9rscrEG2Owczd/LHzR7UcnZNSA3PQSHSlqBrO3fbDHDzZhbGJw0lxeEkdKKIZAWZxf4MD6etJcCS9OTrVmnKlrWiwNI300anmQ9bWZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710954359; c=relaxed/simple; bh=bslft1eCo8U3t11mmmfl1Jb1+QgXR4AP7RMT1jQAzC0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qVZ+GhGS9N+HldrbM5zf0ZPDyfxnWUy14h8apGIwBrVDpF52paoNccf1Gn7ujh/Jl3ERTgwMO4T4DBGsPZ/M8w0OphaeA7NbUIFq50IdzxDyh2rXQnlJl5sTodQXV+gT1fjGQBfmdcjvI+latHldvLqgwbA6GmU6/k1Gi2zVPjU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6001a.ext.cloudfilter.net ([10.0.30.140]) by cmsmtp with ESMTPS id myjdrrM1EPM1hmzNrripS6; Wed, 20 Mar 2024 17:05:47 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id mzNrrFDuy9zHMmzNrrwePs; Wed, 20 Mar 2024 17:05:47 +0000 X-Authority-Analysis: v=2.4 cv=fo4XZ04f c=1 sm=1 tr=0 ts=65fb176b a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=K6JAEmCyrfEA:10 a=Qbun_eYptAEA:10 a=zstS-IiYAAAA:8 a=HtVnO50VS5RnqZUgudUA:9 a=4G6NA9xxw8l3yy4pmD5M: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:In-Reply-To:Date:References :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=ViI17sTKQjMIDGJZGgjt6mRPabesdGMvKYoacsBw4nQ=; b=BUyAfKY8pMhGq9LXcBwpn3HSoX 1woKuydiu6tMhLo3CyPTzWojVMxp4RkcNDkraNuaVUGmUdjamE1B8gDzWaT+jq+yWcyEFLkuuxGpf x5rm1yUhBBNwaNrsndWueHIQ7; Received: from 97-122-82-115.hlrn.qwest.net ([97.122.82.115]:58572 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rmzNq-0018tc-2O; Wed, 20 Mar 2024 11:05:46 -0600 From: Tom Tromey To: Hannes Domani Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix casting in-memory values of primitive types to const reference References: <20240320160844.106-1-ssbssa.ref@yahoo.de> <20240320160844.106-1-ssbssa@yahoo.de> X-Attribution: Tom Date: Wed, 20 Mar 2024 11:05:45 -0600 In-Reply-To: <20240320160844.106-1-ssbssa@yahoo.de> (Hannes Domani's message of "Wed, 20 Mar 2024 17:08:44 +0100") Message-ID: <87msqsg7fa.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) 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.82.115 X-Source-L: No X-Exim-ID: 1rmzNq-0018tc-2O X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-82-115.hlrn.qwest.net (murgatroyd) [97.122.82.115]:58572 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfCWsFDtdJgI7kyQpQPpGsUpEkDD+Gm4Bo6J7JP8ke21LIKnxXGSMK4ZLwZWoLaFv6VLBtK1lbAbqiNKuWhO26NqyfBkbE5/ZIAyyfW2ergn7dcMFl5f1 mOchhnnrpT81O0SLDvf9h5a8rCjPzOjRZsGtQ7osPcxlVmGKu16o+3fIwyuIdgGSaT6/hlwEc5KIMZZreTyzGuiYZwOIw0xhsgI= X-Spam-Status: No, score=-3015.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: >>>>> "Hannes" == Hannes Domani writes: Hannes> It's currently not possible to cast an in-memory value of a primitive Hannes> type to const reference: Thank you for the patch. I think it is ok. However I suspect there may be other bugs here. Approved-By: Tom Tromey Hannes> Fixed by ignoring const/volatile/restrict qualifications in Hannes> value_cast when comparing cast type to original type, so the new Hannes> value will point to the same location as the original value: Hannes> - if (types_deeply_equal (arg2->type (), type)) Hannes> + if (types_deeply_equal (make_unqualified_type (arg2->type ()), Hannes> + make_unqualified_type (type))) This code seems slightly weird in that it isn't calling check_typedef. So, I wonder what happens if typedefs are involved, for example if you did: typedef const int ci; (gdb) print (ci&) Q.id thanks, Tom