From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 9DxkOEn/q2q6JxcAWB0awg (envelope-from ) for ; Thu, 17 Sep 2026 10:55:05 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P/3QOFJi; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id BCEF31E090; Thu, 17 Sep 2026 10:55:05 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,WEIRD_PORT autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (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 010BF1E01F for ; Thu, 17 Sep 2026 10:55:04 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 11A014BB1C02 for ; Thu, 17 Sep 2026 14:55:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 11A014BB1C02 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P/3QOFJi Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 5EDF54B99F42 for ; Thu, 17 Sep 2026 14:41:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5EDF54B99F42 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5EDF54B99F42 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789656087; cv=none; b=OaeRUofdgtJOqymIXCeC/oLf/B3qvvyuDOmfFoT56KpEB+DZTXPaio24WTf6qqCpZlah3dzHbDgrzN+Y5U4Uv8U9D4riy7xz3pE2xkiop0ZVDkDqNa6yRef0kmYr7CegmsnZOw/TU6kPYoFjKMwMv3rXZ7xjKFKuKjPmQou4Mjw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789656087; c=relaxed/simple; bh=ptJvtgJeIpx2dsjsZ2+q65GXbrNNvIaY+UleVU49SpE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=nevE4G/bXpjprj4WzORioktfY82a4dO3TyHHYSZgCJnZQELZuR0II2T2FkSOh6T4SZwFRjgH3dHGLPpWGg//gY4k/0k3y8dgkcB2FcoPLBmOfmmU7fefGzLIJ6rjbCz6aXSOL+FlvPziSwNgmZyXd+CFHG+Ut/3vqZgMzHqETKQ= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P/3QOFJi DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EDF54B99F42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789656082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6zrvsQVJ0wBW8i5PmrF7LURLq/6oRygCj9FAhyEU9VA=; b=P/3QOFJita9rXorXUNuyuFIxoQ4NdwYQj3tB1uYBNzUFQdaPiEczqhi5V2HR7Co9KzUQ4o 0/PQtKK0uf3WmQ2eSDIXmtnZhY0uAah4P8FqEPWS7RLz4RIwg1EVSDjQ2B35yfhsLkKvWP NSs3VinIk97NrrUcLZ57ZTEfRNaF7HU= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-329-5pq0pyyqOXyz10-Zd_arTA-1; Thu, 17 Sep 2026 10:41:20 -0400 X-MC-Unique: 5pq0pyyqOXyz10-Zd_arTA-1 X-Mimecast-MFC-AGG-ID: 5pq0pyyqOXyz10-Zd_arTA_1789656079 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-490a767b782so7939885e9.2 for ; Thu, 17 Sep 2026 07:41:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789656079; x=1790260879; h=content-type:mime-version:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=6zrvsQVJ0wBW8i5PmrF7LURLq/6oRygCj9FAhyEU9VA=; b=sqskBDBduArY7NLqSj6q4LsTixMFlfU77EdV4cyZT7Uqe2szoJmzAja7CH5sWzT1pk 9qQMLxx/Nq4ijUZbfvJ2BSyU60ElCYN6+KM00WgwQxjmg4Utah0AsbdndOdvndcxRj9B Y8sHrvq/vxXGwdqVpc/91tF22ysSNe/UYFVL7MOn001W7qODLQlB3UQZcLqarxms+f7I ULHD4dSn6SwYtm8Mwpa2glOyVNeAeBYtNqvVhojY0+d2AJBMxDcw5Fd82nzqTejfNnmu 944TuQQRihdkJ3UEdXNun7iEgLgseZqXZWRfY7vzcyjRW7EGK9PI6aA6XoQwqhNjAD0R pJtw== X-Gm-Message-State: AFuF++k/CobAippUuCqscGbbLJxo1HiPTgTfXut6rpdwp6J0q4WE1P8N +vesIoy8EvLno1jqt/Sa0DAg0qn5u7T8NBABSW4jbqQ0WVIA/BLMC3qIyzBo2Snj7fKNKIVQAHU rnPiK4vvoOluZhBVRx16Pj2Bm+wbkNXd0olK74d150BGtvNTLK7G5BLULLJtS1VM= X-Gm-Gg: AYBFou2OH/pwdAoFNi6+gROErNTz5KbLen4esqiPf8HLU7sL3Z/vC+9E2jMXEbovkVP L+nkHQhxmxRpLua/HjkPu2bHxlychl1sp3OaBmNLIsBkcgUorsi4SDG5KmWTjwP/usoL+jCt9hd X1Xs6DNAajSP8cmhMswpb44Ky5JiN6VYyE6qPdrQR+LHl1tcPZHOtZi2InP2BcOL0EqGGiyASNM vzKoDJOGhWVwAeaiynBphtrfZaMpzcPxS6EZBu46Sa4uDcGhGNPwc14zCvfXureMsfbZKVPAahF O+Q8p3GPOSTDoIDR3uwEcu3PPiFSRfLGyz0tYvpj3d89tPtGMi/GXdYBbcSrkh1WlgjpB/sx X-Received: by 2002:a05:600c:46cb:b0:49e:84bf:6110 with SMTP id 5b1f17b1804b1-49eac463727mr81878365e9.6.1789656079492; Thu, 17 Sep 2026 07:41:19 -0700 (PDT) X-Received: by 2002:a05:600c:46cb:b0:49e:84bf:6110 with SMTP id 5b1f17b1804b1-49eac463727mr81877995e9.6.1789656079076; Thu, 17 Sep 2026 07:41:19 -0700 (PDT) Received: from localhost ([83.216.138.214]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fbd24a6basm84669985e9.12.2026.09.17.07.41.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 07:41:18 -0700 (PDT) From: Andrew Burgess To: Keith Seitz , Kevin Buettner Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2] Add infcall support for C++ constructor-style expressions In-Reply-To: References: <20260626170308.69c33832@f44-mesa-1> Date: Thu, 17 Sep 2026 15:41:16 +0100 Message-ID: <87bj9waqk3.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: GQe5sTAJbFmnrjV6XaVqsvbsk92RgrKS4_xqkvfMCn8_1789656079 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Keith Seitz writes: > Hi, > > On 6/26/26 5:06 PM, Kevin Buettner wrote: >> >> Claude found this problem... >> > (gdb) file /tmp/test_c >> Reading symbols from /tmp/test_c... >> (gdb) start >> Temporary breakpoint 1 at 0x40044a: file /tmp/test_c.c, line 2. >> Starting program: /tmp/test_c >> >> [Thread debugging using libthread_db enabled] >> Using host libthread_db library "/lib64/libthread_db.so.1". >> >> Temporary breakpoint 1, main () at /tmp/test_c.c:2 >> 2 int main() { struct S s = {42}; return s.x; } >> (gdb) print typeof(struct S)(42) >> /home/kevinb-claude/binutils-gdb-patch-review/gdb/eval.c:1885: internal-error: evaluate_funcall: Assertion `exp->language_defn->la_language == language_cplus' failed. >> A problem internal to GDB has been detected, >> further debugging may prove unreliable. >> ----- Backtrace ----- >> 0x51e699 gdb_internal_backtrace_1 >> /home/kevinb-claude/binutils-gdb-patch-review/gdb/bt-utils.c:122 >> 0x51e699 _Z22gdb_internal_backtracev >> /home/kevinb-claude/binutils-gdb-patch-review/gdb/bt-utils.c:173 >> 0x9fb874 internal_vproblem >> /home/kevinb-claude/binutils-gdb-patch-review/gdb/utils.c:434 >> 0x9fbd38 _Z15internal_verrorPKciS0_P13__va_list_tag >> /home/kevinb-claude/binutils-gdb-patch-review/gdb/utils.c:514 >> 0xb6cea1 _Z18internal_error_locPKciS0_z >> /home/kevinb-claude/binutils-gdb-patch-review/gdbsupport/errors.cc:57 >> 0x67e31c _ZN4expr14type_operation16evaluate_funcallEP4typeP10expression6nosideRKSt6vectorISt10unique_ptrINS_9operationESt14default_deleteIS8_EESaISB_EE >> ... >> > > Thanks for the report. > > The root cause is that the C++-only gate lived only in the lexer, but > `typeof(T)` is a separate `type_exp` production. So in C, `typeof(struct > S)(42)` still matched the general `type_exp '(' arglist ')'` rules, > built a `funcall_operation`, and hit the `language_cplus` assert in > `type_operation::evaluate_funcall`. > > The fix is to mirror the lexer gate in those parser actions: if the > language is not C++, throw an error: > > (gdb) print typeof(struct S)(42) > Constructor-style casts are only valid in C++ > > I left the `type_exp`-based productions in place rather than splitting > out a dedicated ctor non-terminal; the language check closes the hole > Claude found without that larger grammar change. I'm happy to revisit > the shift/reduce side separately if consensus is reached. [This is the > direction a previous review steered me, and I am happy to revisit that > initial review recommendation.] If that was my review, then please do feel free to ignore it. My review comments are not always based on tested code, usually just my thoughts when looking through the patch, that doesn't always mean the thoughts are any good :) Thanks, Andrew