From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by sourceware.org (Postfix) with ESMTPS id B0ED13858CD1 for ; Sat, 9 Dec 2023 10:03:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B0ED13858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B0ED13858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702116201; cv=none; b=dl3jcwcoVmvID3Sd8suFzaELu1KXbk50lNg4YmpYjAbLXorXFDbSNBpBB/0g38GitzavpJ0PYp6PBVN/0RSeqh6+ELfP5Ambbp3imriclw6GEdN8YzqYjgGvkNmCMhOdGmhVYRHupJrhinhsLsLWDsPwqeBl0HPjvr/+4JxAh6o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702116201; c=relaxed/simple; bh=Lp4pvTbdoi+VzI6FkyHLjU08YhFiGujnz+UYpN7Aly0=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=ga2R1iuYOotghARK9se3Vqyoig0SF0B37fhaWx4bhej4Ty27S+4G1xzY0H+HcxnoqzeLrDjwlK59G7BZMbq7hArhP1JkSB2SZkUTjH7vRTTxpYUYjiD+UgY0Zwz9YMOUoXtx7OkTdzKKV2SVMM8T+GWMCJTDpTH4WkAKB4X4YOc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-50be3611794so3358971e87.0 for ; Sat, 09 Dec 2023 02:03:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702116189; x=1702720989; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=STMQnl3TbhSTpk7hKqZOJlDPlo7CkUYDY8wv/c4t+eA=; b=aiBRJzcRu5KHxvfJyH9ym2T3f0k3yIOGk0O4utUrW01iEJ5HxHZC2sKDpJwtvTBHZk FZQ4PSRlkFFyopdto/+yRzDBnaydIIhXnE/5Cag0QSdBuZPFg0F40i752DM2LGrxzV2E oOwR+TtrebrDwNjQgQtGIKfRJWZxQ5THCaWm57HeX7HtZPAxbt9kWXNCwOjk/oBORP7j IFO4wNWm44O+kiuKPvZy0CvHaopPmE3TW3MHWbl+u/TxWq7VSxVrZLib3upkw3qSmT1c qiNPuRKyEnsQFusEiniMgBvcyxeAJ/56blIPt7sDaH4B4US3naMOqY3jyuJEc4a8UZJa E/Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702116189; x=1702720989; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=STMQnl3TbhSTpk7hKqZOJlDPlo7CkUYDY8wv/c4t+eA=; b=HOt9QFMckV+70Qwyi8noEq5g0cCP2negEcwGmevaEAjOG7HS9v2TfwUXE3c3e8kGhP 5t28p7r/6RYB1rgfWXUzw/9g0VvtZxWpCEE9XJwVgdpVqLNa+M1rjf/agpaYFwVK4R5o dfUOoP4zWDdsBGZ+6sjnrqvDcgd08RCotRm+n37IpD4hV/Gu8mRXD0OmhWL9Do31zMSR iE7HfOfGBr5Py4VBHvhqqCwQtteLB6VURKwdzfv1Z4zFGzOIXMoQiJJSV0nbVeD48TpV iZV0hnOWjG8/1G8j9mlTTZuR4Lgae3/d2AuL+7V9qb4k3ytjaEkSQ40JyFm2B9BcQY1d SE9Q== X-Gm-Message-State: AOJu0YzKYN/DZUCu9zkJRjZ/1LMqE8DCCpJbh2I0J6nmKNTz5hUzT5h4 hwxVWxRmRlqzcLGYuPSdGLV8836vW0BQCDwsWsY= X-Google-Smtp-Source: AGHT+IHsVYWlqCf9VEdA5bh+9xlvOLjyXm4s0BnZh8NZJ1S7p5NGZevjzXFwaOLuTr96kx/LvaOtsx0LC+D10yl36n8= X-Received: by 2002:a05:6512:3d1d:b0:50b:e229:23b0 with SMTP id d29-20020a0565123d1d00b0050be22923b0mr730845lfv.94.1702116188581; Sat, 09 Dec 2023 02:03:08 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Amol Surati Date: Sat, 9 Dec 2023 15:33:21 +0530 Message-ID: Subject: Re: GCC 12.3 ICE: format(printf...) failing in C++ with virtual inheritance To: psmith@gnu.org Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: On Sat, 9 Dec 2023 at 03:53, Paul Smith via Gcc wrote: > > I've tried this with both older versions as well as GCC 12.3 (latest I > have access to). This is on GNU/Linux on x86_64. > > > I have the following code: [...] > I'm assuming a bug should be filed for this ICE (can anyone repro it in > the current release?), but does anyone know if there's any way to make > it work in GCC 12.3? If it is suitable to modify the source code of the application, a workaround is to let the constructor take a ref/ptr to va_list instead, and wrap a call to it inside a variadic C-style function, or a variadic static member function, that creates and returns the Exception object. An example at [1]. ----- The ICE isn't a problem here, since the string-index and first-to-check attr-parameters of [2] should not consider any hidden func-parameters except the 'this' pointer. The values 2 and 3 resp. are therefore the correct arguments to pass to the attr-parameters for the given c++ code utilizing virtual inheritance. What is missing from 12.3.0 (and also from the latest on the releases/gcc-12 branch) is the adjustments, that the compiler must internally make, to the arguments passed to the attr-parameters, when virtual inheritance adds 1 or 2 additional hidden func-parameters to the constructor. The gcc-13 branch does contain those adjustments. See [3]. The last comment on it is: --------------- Marek Polacek 2022-05-07 14:59:02 UTC Fixed for GCC 13. I don't have plans to backport this. --------------- [1] https://godbolt.org/z/bh9df9xGP [2] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html [3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101833