From patchwork Mon Aug 5 23:07:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 95341 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C7AB43858294 for ; Mon, 5 Aug 2024 23:08:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by sourceware.org (Postfix) with ESMTPS id DD270385840F for ; Mon, 5 Aug 2024 23:08:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DD270385840F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=golang.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=golang.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DD270385840F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722899286; cv=none; b=jkfZxqMybmkWY2bpBsdUzChryTDiDTepyH4qUk8WAsUAxLfxiTodMWe+13KKQEcCuBodRb0BEiC4Gu2nCG9gnsc7TH7gOTq4rnfYbQXQtJrgpCKvOs+kqsLGMwl9YM1fwWkxDDuR2x/HwLwPMg8OBIjwjpIQXXETh9nr9mPWyb0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722899286; c=relaxed/simple; bh=AfUIHMiqEGKeUb1XXwqbWfKQuCfghqszYwA8kQoiHuU=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=p6cwF4/O2mlrFw/8hx4rLdiYaBku5f5HFFwmbhaKdfi9Q5TuDcdCT43Y4XBl3PJ32WkvTZOoEXQ88PsXEhfneSd8rF1c2pb6cJkhWjIXMaZxXFawYlQwHbnr40Y9iBl1a+GxdGt16J/t+93Z/LT0SqtN8nY/LNqVv0S/iD8HM6w= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb35.google.com with SMTP id 3f1490d57ef6-e087641d2a2so44475276.0 for ; Mon, 05 Aug 2024 16:08:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20230601.gappssmtp.com; s=20230601; t=1722899284; x=1723504084; darn=gcc.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=5OuWbHcm44vusmOzTLMMuU6XZBN9Qc3c936G3XfOWkk=; b=krcGLQuRg2bHkbRSpLnIGMqa1YJwIyJvbr+80H4cPuOPT2chyHSZ684cYK/mpxfO8O YlkIg1zZ77GpnCaJvyPx3B+VnbUIuIsU08JS/qC5HCW3fT+ncuSzDvtwgvdqNha7XjmW Sr9MFSWSaHJDKitWO1NduES08XspJF7/JTJeKI3oG0SFDSbc/l4WGxI6tZpk2qllGkRz 3bybUScT3RS30JHpYdjHNe34jdTYaX+F7HChF4WPF61RzK4e6Pf0GLQlS4J6CrdZXzlJ bKyiGHYSw9jq52tzlmCtvfhPrd+0CVXOQYkIwbn7zNj/Sat5OEVuKVTqowuhY1+SAGwk Okpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722899284; x=1723504084; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5OuWbHcm44vusmOzTLMMuU6XZBN9Qc3c936G3XfOWkk=; b=qPIB7fUM8NQlzJJ4YTZRzJ6rOaCz8dzo0NmkPUic00F7sH8vvfbrgXbXEfZjipiTWe EnHBX08d3KnI2xua7rRhTTkZwI9EpI2YHQjGwtTErv4ma1oEZU9J3FhxInA4b0RiT+HS IfMMvrxsARZ9bVWBjEMn8ajaS0+QUbKyJfKJPkm0w6qPzxLqZll+cu17AhX/uzaWK+Tw 6Yn12xCl750+q5NU2Zxwd32L6Gqv18rOagfYWu8xszrITR3VRQZ86ofztZEfwBncdtIF E/9amnqBcUobhu+L0/PW604No1Rs1UcoSOPtoqMIYCyYud5b/gOjaY/a5EXhMyoYaRxj q2mA== X-Gm-Message-State: AOJu0Yxz2PO/pcLxBNLLQj1RrUNIvUbskdv5rgD/tUXqDoOj9NloD0if a66rMUp2tgCHiykbYpmZW9OvFhm5EUzuEZGvj7n4LASLETVoUN1otwpP8T5Md6azJUqXH7vPT+6 q6q7iCjukYi5vzJz58FVOh+6UDJlYBIkhA7AV5/qUv/XdS2dngY8= X-Google-Smtp-Source: AGHT+IFGqfxp5IB5dRayXlO76JZ/5PQxljx0GPAoEmTK8S2LEKvG1Jnk+fhs/AoxSb6dPYBhyljp/eZA3xEonJUlYog= X-Received: by 2002:a25:7b06:0:b0:e0b:456b:f0fb with SMTP id 3f1490d57ef6-e0bde3828dcmr14797426276.14.1722899283838; Mon, 05 Aug 2024 16:08:03 -0700 (PDT) MIME-Version: 1.0 From: Ian Lance Taylor Date: Mon, 5 Aug 2024 16:07:52 -0700 Message-ID: Subject: Go patch committed: Panic arguments have empty interface type To: gcc-patches , gofrontend-dev X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org This patch to the Go frontend determines that panic arguments are empty interfaces. After https://go.dev/cl//536643 passing NULL as the expected type permitted an untyped constant expression to remain untyped. This change will fix them to take on the empty interface type. The panic and print/println functions are the only builtin functions that turn an untyped constant expression into a regular function call, and we already handled print/println specially. This fixes https://go.dev/issue/68734. The test case is https://go.dev/cl/603096. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline and GCC 14 branch. Ian 6d1dc17a816ed557cf5eda13019d7d85053f39f2 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 9a4b402573a..e13dc5f58a3 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -60f985a7852632834936b4b859aa75d9df88f038 +5f6fae5ff33e996243acd098c71904695c414c53 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 238d5a56ca2..2b0e40fc6f8 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -11137,6 +11137,12 @@ Builtin_call_expression::do_determine_type(Gogo* gogo, is_print = false; break; + case BUILTIN_PANIC: + arg_type = + Type::make_empty_interface_type(Linemap::predeclared_location()); + is_print = false; + break; + case BUILTIN_PRINT: case BUILTIN_PRINTLN: // Do not force a large integer constant to "int".