From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id AF53D3858C51 for ; Mon, 23 May 2022 16:47:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AF53D3858C51 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-YnPB35nEP6WV2bAaiNKQNA-1; Mon, 23 May 2022 12:47:50 -0400 X-MC-Unique: YnPB35nEP6WV2bAaiNKQNA-1 Received: by mail-qk1-f199.google.com with SMTP id c16-20020ae9e210000000b006a32c6a3830so9778143qkc.12 for ; Mon, 23 May 2022 09:47:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=N/NbZOfqsBRW/K1jn+RYnNaaJxPBCCgkD4EpaO800p4=; b=O9scc4VkVENMVjUv0MRov4XNRewE+uHeA+PT4TzO9GBg4UCB2qL1KL9+1vfD4mNNl3 xGQymn/EWvGvtODaHMiI+Gy/NwSCcb+Ss8C0ZmrSxX0j4MhoZ6rH9GzFl/JkjjPlnE9t cYHbeTFBVagGwYM7OeL+nlHghUYpTL7ZVwpgAgwFsklEQSb4uRZZcwEzgsNxG/p7Mud2 JSdGC+nO0W1dSEsTCPg7bJsmJkZfK5KoDKaOSxxC7NfojQWVcYPJzqALfDR13eePUjuP /BrlGR9tMo4Ffbr6NHExRn0tVwP6sXfdKd8chnGiCTg4YIx/KRXLb7zLiNczWQPMCry2 vTmA== X-Gm-Message-State: AOAM530uEirNIcqCzsaXcOQ/oq3zRI/Y7gZcb9+tnS6AhH9AEd9NRwR4 IPQrn7ONNshxkEdqp8PjdsejqkvBcT/060Vc0RC/z+FmgvyYe7qfxoo/VoCtsk7P9O2mgveR1qK NqpXaZh4= X-Received: by 2002:a05:6214:10c8:b0:461:c6aa:b0af with SMTP id r8-20020a05621410c800b00461c6aab0afmr17740635qvs.3.1653324469544; Mon, 23 May 2022 09:47:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqW6O8MVMvQSCRbFSV2zWISacEIZVyl/jDEqdgdXur+b44hjfYtpOFZgxI33PHgsyAfxwjng== X-Received: by 2002:a05:6214:10c8:b0:461:c6aa:b0af with SMTP id r8-20020a05621410c800b00461c6aab0afmr17740622qvs.3.1653324469356; Mon, 23 May 2022 09:47:49 -0700 (PDT) Received: from redhat.com ([2601:184:4780:4310::e811]) by smtp.gmail.com with ESMTPSA id m24-20020ac866d8000000b002f932d920ccsm3138812qtp.64.2022.05.23.09.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 09:47:48 -0700 (PDT) Date: Mon, 23 May 2022 12:47:47 -0400 From: Marek Polacek To: Andrea Monaco Cc: gcc@gcc.gnu.org Subject: Re: Buggy error message when dereferencing once a double pointer to struct Message-ID: References: <87tu9g6vxw.fsf@autistici.org> MIME-Version: 1.0 In-Reply-To: <87tu9g6vxw.fsf@autistici.org> User-Agent: Mutt/2.2.1 (2022-02-19) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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 X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2022 16:47:53 -0000 On Mon, May 23, 2022 at 06:43:55PM +0200, Andrea Monaco via Gcc wrote: > > This snippet that I wrote > > > struct > str > { > int val; > }; > > > void > main (int argc, char **argv) > { > struct str **p; > int i; > > i = p->val; > } > > > is obviously incorrect. But gcc 8.3.0 says > > pointer.c: In function ‘main’: > pointer.c:14:8: error: ‘*p’ is a pointer; did you mean to use ‘->’? > i = p->val; > ^~ > -> > > which seems a buggy error message to me: I wrote "p", not "*p"; also the > compiler suggests replacing "->" with itself. Yes, this is https://gcc.gnu.org/PR91134 Marek