From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id BD5553858421 for ; Mon, 24 Oct 2022 15:23:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BD5553858421 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x636.google.com with SMTP id u6so8701258plq.12 for ; Mon, 24 Oct 2022 08:23:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=S1Y/fplk7LroCNAX3ytV0Zi2I0G40sVVXUzF7LraN3Q=; b=HOAt5iKI+PmxmwXJBK2bx7ej487WMGHsagO9fQcZ6rAL19Ucbe5U+UNVZLH/1XugJG oO6y9SzPbMbLqbKsCLgisDCorGQpVvW9ApSrWr8+ximAwDcR3tL4FkyEBDMe/3oUVt0t lSmlxaha8Wl5U6tt52kDsXpIwLpW1yDCz27Lck81GO6JlWaEPdG/vNEY9KkhjdImCZ86 UKTh4KHhv6MnoKilEZnMKk1M8L1xQ3UrA5ixupNGzAKRuhw+e1gFmn0MIe5LPmWv6D31 jqHLHGyyIoNXAfNN1v1GsP/DudIlcTK94d8PRb5qx4b0wylto6JTFJjbMzis+4B9RFgO mPWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=S1Y/fplk7LroCNAX3ytV0Zi2I0G40sVVXUzF7LraN3Q=; b=W1fT18k7aZlmu7VlDHebIsLOZotam88n+Gg0n4YrLRu/j7t9b3MDiv/DTU8zW/y8te 6k1JxoHCNsmQ8hi0Rq1zPgapzUQllDMmsMfasNS9fW4BKw8KCozsTWSEt8FHZYKOFYX7 mJw8psaCfSYCRxujfz3fodDRww3tYhHLfZkat6HG9R3RVXr5In5vhUDIVSW83wPSXARy NgU15n/2Q+A3X132jeQS1azCtHY/PGQnTM/WeCRxZP8NapfTrzQRZrAYRpVn3ajn0T7k +g5anJ3pN2aJidqiAYcP98bGQ7TQd3jzUA3ZVEkCzGtsgpQFELA1qDGm5gABljZN3Z0/ x3zw== X-Gm-Message-State: ACrzQf1TvobpkR+r0iLIhPTCn7jMLmfK3syZYlRxAzXzKJmPZ3RwBLVx lKNYc2IT4kmZn71ZqU7K7iqbZ7Awpcw= X-Google-Smtp-Source: AMsMyM6S2JZuWbGEXa2DcpL1zwtoMXHztsHWdZFOfVbxBeBRPVt6Ua6Tz20MvCcp4J+kRJ3Yj/feRw== X-Received: by 2002:a17:90b:1e46:b0:20a:f9d8:1ff7 with SMTP id pi6-20020a17090b1e4600b0020af9d81ff7mr76555418pjb.34.1666625025476; Mon, 24 Oct 2022 08:23:45 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id b12-20020a170903228c00b00186b04776b0sm1091891plh.118.2022.10.24.08.23.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Oct 2022 08:23:45 -0700 (PDT) Message-ID: <29e4fb33-2fd9-0e39-4a6e-64208adea45e@gmail.com> Date: Mon, 24 Oct 2022 09:23:43 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH] c, c++: Fix up excess precision handling of scalar_to_vector conversion [PR107358] Content-Language: en-US To: gcc-patches@gcc.gnu.org References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,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 List-Id: On 10/24/22 01:19, Jakub Jelinek via Gcc-patches wrote: > Hi! > > As mentioned earlier in the C++ excess precision support mail, the following > testcase is broken with excess precision both in C and C++ (though just in C++ > it was triggered in real-world code). > scalar_to_vector is called in both FEs after the excess precision promotions > (or stripping of EXCESS_PRECISION_EXPR), so we can then get invalid > diagnostics that say float vector + float involves truncation (on ia32 > from long double to float). > > The following patch fixes that by calling scalar_to_vector on the operands > before the excess precision promotions, let scalar_to_vector just do the > diagnostics (it does e.g. fold_for_warn so it will fold > EXCESS_PRECISION_EXPR around REAL_CST to constants etc.) but will then > do the actual conversions using the excess precision promoted operands > (so say if we have vector double + (float + float) we don't actually do > vector double + (float) ((long double) float + (long double) float) > but > vector double + (double) ((long double) float + (long double) float) > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2022-10-24 Jakub Jelinek > > PR c++/107358 > c/ > * c-typeck.cc (build_binary_op): Pass operands before excess precision > promotions to scalar_to_vector call. > cp/ > * typeck.cc (cp_build_binary_op): Pass operands before excess precision > promotions to scalar_to_vector call. > testsuite/ > * c-c++-common/pr107358.c: New test. > * g++.dg/cpp1y/pr68180.C: Remove -fexcess-precision=fast from > dg-options. OK jeff