From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <> Received: from fx409.security-mail.net (smtpout140.security-mail.net [85.31.212.149]) by sourceware.org (Postfix) with ESMTPS id 2540A3870877 for ; Tue, 10 Aug 2021 14:15:24 +0000 (GMT) Authentication-Results: sourceware.org; dkim=permerror (bad message/signature format) Received: by fx409.security-mail.net (Postfix) id 1B75A3238AF; Tue, 10 Aug 2021 16:15:23 +0200 (CEST) Date: Tue, 10 Aug 2021 16:15:23 +0200 (CEST) From: MAILER-DAEMON (Mail Delivery System) Subject: Undelivered Mail Returned to Sender To: gcc-patches@gcc.gnu.org Auto-Submitted: auto-replied MIME-Version: 1.0 Content-Type: multipart/report; report-type=delivery-status; boundary="D14F23238CD.1628604923/fx409.security-mail.net" Message-Id: <20210810141523.1B75A3238AF@fx409.security-mail.net> X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HTML_MESSAGE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Aug 2021 14:15:34 -0000 This is a MIME-encapsulated message. --D14F23238CD.1628604923/fx409.security-mail.net Content-Description: Notification Content-Type: text/plain; charset=us-ascii This is the mail system at host fx409.security-mail.net. I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below. For further assistance, please send mail to postmaster. If you do so, please include this problem report. You can delete your own text from the attached returned message. The mail system : host zimbra2.kalray.eu[195.135.97.26] said: 550 5.1.1 : Recipient address rejected: User unknown in virtual mailbox table (in reply to RCPT TO command) --D14F23238CD.1628604923/fx409.security-mail.net Content-Description: Delivery report Content-Type: message/delivery-status Reporting-MTA: dns; fx409.security-mail.net X-Postfix-Queue-ID: D14F23238CD X-Postfix-Sender: rfc822; gcc-patches@gcc.gnu.org Arrival-Date: Tue, 10 Aug 2021 16:15:22 +0200 (CEST) Final-Recipient: rfc822; marc.poulhies@kalray.eu Original-Recipient: rfc822;marc.poulhies@kalray.eu Action: failed Status: 5.1.1 Remote-MTA: dns; zimbra2.kalray.eu Diagnostic-Code: smtp; 550 5.1.1 : Recipient address rejected: User unknown in virtual mailbox table --D14F23238CD.1628604923/fx409.security-mail.net Content-Description: Undelivered Message Content-Type: message/rfc822 Return-Path: Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) by fx409.security-mail.net (Postfix) with ESMTPS id 5DB4832382E for ; Tue, 10 Aug 2021 16:15:18 +0200 (CEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4BBFB395BC09 for ; Tue, 10 Aug 2021 14:15:16 +0000 (GMT) Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id D50723858C3A for ; Tue, 10 Aug 2021 14:14:27 +0000 (GMT) Received: by mail-ed1-x530.google.com with SMTP id d6so30428417edt.7 for ; Tue, 10 Aug 2021 07:14:27 -0700 (PDT) X-Quarantine-ID: X-Virus-Scanned: E-securemail, by Secumail X-Spam-Status: No, score=-1.328 tagged_above=-1000 required=7.5 tests=[AB_ENVFROM_LONG_40=0.5, AB_IN_REPLY_TO_EXISTS=-1, AB_LONG_SUBJ_30=0.001, DCC_REPUT_00_12=-0.002, DKIM_SIGNED=0.1, DKIM_VALID=-1, DKIM_VALID_AU=-0.1, FAKE_REPLY_SURE_A=1, FAKE_REPLY_SURE_B=1, FSL_RCVD_EX_3=0.01, FSL_RCVD_UT_3=0.01, HEAD_NEWS=-0.5, MISSING_MID=0.14, MM_ENVFROM_BOUNCE=1, RCVD_IN_DNSWL_MED=-1.3, RDNS_DYNAMIC=0.363, S_FROM_GREY_MINUS_2=-2, S_KW_BODY_PROMOTION=0.45] autolearn=disabled Authentication-Results: fx409.security-mail.net (amavisd-new); dkim=pass (1024-bit key) header.d=gcc.gnu.org Secumail-id: <14d8.611289f6.1f517.0> DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4BBFB395BC09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1628604916; bh=zBN9gAx1R8Z73e79tNLPqBBf/ZchbrUkY3Ipmy379CE=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=uu0YrHsaXwMuZ6X34cspsB1KjN51Z6sKrywUXfJAJ8zN5SKDNEAbiYo7gzalSGGMt e9D9e5sCIttiRB2P2V4RkjaxfMTMr5dvYY+AERXMsLX/9jBhrecZR0xdG7gxTKYkGK eDFPEnu28RNMSwBzNrr7A3eclUuWAGwuDuZc/o1Q= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D50723858C3A X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zBN9gAx1R8Z73e79tNLPqBBf/ZchbrUkY3Ipmy379CE=; b=h6I+yd+l0skxpNfOncH5Ok26yNZF75wEk3kXqWIChascuPbNOJAPTQDKFqUuXPDtKk g0WzUCn+nyKlWuN9yLGSIY0KcgDsSfs74gt+OPdhz4+pIArpnAx2r7RAHMpCnPcMy5Zr hcW5PkcmuTjkY4XQ7npYN90TXxVcT56M0s9c3vKvASCasnhtGko9jWuUFUsTGwSo+vWp cQojOmvtImt8nmTgKEX4JbxExwvVHqr3sK48yVwPeaGEMfNTq98FkamLLUAwfsnLCHCP nkPxLGjRDB/fznKwNm9L3wbu+2ChNDnAt5haYk1Oz/Fe7p2G2RG0f2PyDAXINpVvmnHB VE2Q== X-Gm-Message-State: AOAM530j4HDp1hXDP38b4kLwvTM8KvoMD/N3D1JmsmBrHkvtsXbKiXo3 LgzDJG3Pt8zqOjqe4vbBbc3Ds7lb757UGG+sCk8= X-Google-Smtp-Source: ABdhPJzylqA0e80ioNujwu+Ktuj0SWL1H3s/8Rtp+AJ6tOinirSVkBUNsQMB8wER5rFSTAvhymnqpzYTBJHwhFXVxQY= X-Received: by 2002:aa7:d54d:: with SMTP id u13mr5387075edr.138.1628604866807; Tue, 10 Aug 2021 07:14:26 -0700 (PDT) MIME-Version: 1.0 References: <49b8d18d-98fe-84de-6a00-34d08fc2cfc7@redhat.com> <448e095e-cce5-a29a-ce51-4053fda5e596@redhat.com> In-Reply-To: <448e095e-cce5-a29a-ce51-4053fda5e596@redhat.com> Date: Tue, 10 Aug 2021 16:14:15 +0200 Message-ID: Subject: Re: [COMMITTED] PR tree-optimization/101741 - Ensure toupper and tolower follow the expected pattern. To: Andrew MacLeod X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Richard Biener via Gcc-patches Reply-To: Richard Biener Cc: gcc-patches Errors-To: gcc-patches-bounces+marc.poulhies=kalray.eu@gcc.gnu.org Sender: Gcc-patches X-ALTERMIMEV2_in: done Content-Type: text/plain; charset=utf-8 On Tue, Aug 10, 2021 at 3:21 PM Andrew MacLeod wrote: > > On 8/10/21 3:45 AM, Richard Biener wrote: > > On Mon, Aug 9, 2021 at 10:31 PM Andrew MacLeod via Gcc-patches > > wrote: > >> The user has overridden the function name "toupper" . Its marked as a > >> builtin function, presumably because it matches the name. In range > >> folding, we were assuming the LHS and the parameter were compatible > >> types... but they are not in this case.. > >> > >> I don't know if we should be marking such a thing as a builtin function, > >> but regardless.. we shouldn't be trapping. If the type of the argument > >> is not compatible with the LHS, then we'll simply assume nothing about > >> the function. > >> > >> Bootstraps with no regression on x86_64-pc-linux-gnu. pushed. > > I wonder why the gimple_call_combined_fn verification > > using gimple_builtin_call_types_compatible_p isn't enough here? > > Yes, it's matching is a bit lazy, but only with respect to promotion > > of arguments to 'int'. > > > > Richard. > > > I set a breakpoint on the return type field for the builtin... A quick > check shows the return type of the builtin is being changed to "unsigned > int" here: OK, so gimple_builtin_call_types_compatible_p only checks that the call is consistent with the fndecl type - iff the declaration is incompatible with the declaration as specified by builtins.def then that's of course not detected by that check (this check is to catch cases where a formerly indirect call through an incompatible type is now known to be to a builtin). IIRC that is a recurring issue and indeed my opinion is that frontends should not mark function decls as BUILT_IN if the definition/declaration signature is not compatible. > #0 merge_decls (newdecl=0x7fffe9f67100, olddecl=0x7fffe9ed2100, > newtype=0x7fffe9e3ae70, oldtype=0x7fffe9e3ae70) at > /gcc/master/gcc/gcc/c/c-decl.c:2598 > #1 0x0000000000a0628d in duplicate_decls (newdecl=0x7fffe9f67100, > olddecl=0x7fffe9ed2100) at /gcc/master/gcc/gcc/c/c-decl.c:2963 > #2 0x0000000000a07464 in pushdecl (x=0x7fffe9f67100) at > /gcc/master/gcc/gcc/c/c-decl.c:3256 > #3 0x0000000000a1d113 in start_function (declspecs=0x37728b0, > declarator=0x3772ae0, attributes=0x0) at /gcc/master/gcc/gcc/c/c-decl.c:9644 > #4 0x0000000000a8667c in c_parser_declaration_or_fndef > (parser=0x7ffff7ff7ab0, fndef_ok=true, static_assert_ok=true, > empty_ok=true, nested=false, start_attr_ok=true, > objc_foreach_object_declaration=0x0, > omp_declare_simd_clauses=0x0, have_attrs=false, attrs=0x0, > oacc_routine_data=0x0, fallthru_attr_p=0x0) at > /gcc/master/gcc/gcc/c/c-parser.c:2444 > > > It would appear that merge_decls is merging the olddecl (the bultin) > with newdecl and results in changing the LHS to unsigned int, so now it > thinks the builtin matches. eeeks. > > I don't know what the correct thing to do is, but a quick hack to check > if old_decl is a builtin and return false from duplicate_decl also seems > to resolve the problem: Yeah, but that's of course too harsh - we do want correct user declarations of say 'malloc' to be classified as built-in. The odd thing is that we merge int foo() and unsigned foo () using composite_type. diagnose_mismatched_decls should be made more strict here although it explicitly mentions /* Accept "harmless" mismatches in function types such as missing qualifiers or int vs long when they're the same size. However, diagnose return and argument types that are incompatible according to language rules. */ whatever 'language rules' means here. Anyway, this function is where we should avoid making newdecl built-in (and we should of course not adjust olddecl either). Richard. > diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c > index 221a67fe57b..27ab6ac9f1a 100644 > --- a/gcc/c/c-decl.c > +++ b/gcc/c/c-decl.c > @@ -2960,6 +2960,9 @@ duplicate_decls (tree newdecl, tree olddecl) > return false; > } > > + if (DECL_BUILT_IN_CLASS (olddecl) != NOT_BUILT_IN) > + return false; > + > merge_decls (newdecl, olddecl, newtype, oldtype); > > /* The NEWDECL will no longer be needed. > > To declare a filtering error, please use the following link : https://www.security-mail.net/reporter.php?mid=14d8.611289f6.1f517.0&r=marc.poulhies%40kalray.eu&s=gcc-patches-bounces%2Bmarc.poulhies%3Dkalray.eu%40gcc.gnu.org&o=Re%3A+%5BCOMMITTED%5D+PR+tree-optimization%2F101741+-+Ensure+toupper+and+tolower+follow+the+expected+pattern.&verdict=C&c=3114d549f7a496e61d413636ba42fe6103f489ac --D14F23238CD.1628604923/fx409.security-mail.net--