From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 3BA6B39960F2 for ; Fri, 20 May 2022 02:14:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3BA6B39960F2 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-159-V5uFOBq4Ozu5bEAwZFx0Fg-1; Thu, 19 May 2022 22:14:54 -0400 X-MC-Unique: V5uFOBq4Ozu5bEAwZFx0Fg-1 Received: by mail-qk1-f198.google.com with SMTP id l20-20020a05620a211400b006a0d5b5e51dso5571636qkl.2 for ; Thu, 19 May 2022 19:14:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=PLykbzPtgHm5siFMbS0+ARGe+4N6IM5r2mSwYLKk55U=; b=nB0FkuB2XxVWlN5fdSVSVhDpikyrwhOSjwlvaITuS75xr1zI1j4n92ptfNynoL2Jpy lOm0aR4EiidKi1UTEdSkDCOGxFhTPCg5YgP7Hfu9lsdspbOw44W3ubYW78KIEiInDZnf uXzQ7U+dhxLT4XcuKZRVOB/i3gfRMcrSJ+c7kd7PEw+hOKRoqMdj9vGJ/J/ea43SH7x2 z0L4h15M+Jvi7Ne2tgcSh14qDvCSndxBHFYJSofcs4rNzyFSrE/SDKGFAATUbrO+4pPi lJiHb+pNHlrKzOfQ3N/jsNoraDBIIrDzAKlxwJKPhV3x0ss8HkqIH3y6ITEPUOj24SFa 3FDw== X-Gm-Message-State: AOAM533UHFeQzALKzdIr6YDnmDYhJlZ0o2aJX5ewLCUIY6SWBkd2CVAn izYVx0XZwMR1kwSlcWQBXMBV61y7rsgGoFoQNfso5rOcIFCyYY+1zIbIINh1NX6syE4pe7Rr7ph lThCCTTI4C2/0PWudnQ== X-Received: by 2002:a05:6214:2409:b0:432:bf34:362f with SMTP id fv9-20020a056214240900b00432bf34362fmr6460586qvb.66.1653012893891; Thu, 19 May 2022 19:14:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy01U+WvdqaAsPj1i9wv4FxfiKTP2dWmbUrR2cxbD7503tJeAMZXCeSBXhqdOrUdkUqZs0XkQ== X-Received: by 2002:a05:6214:2409:b0:432:bf34:362f with SMTP id fv9-20020a056214240900b00432bf34362fmr6460572qvb.66.1653012893676; Thu, 19 May 2022 19:14:53 -0700 (PDT) Received: from ?IPV6:2607:fea8:a261:5e00::7704? ([2607:fea8:a261:5e00::7704]) by smtp.gmail.com with ESMTPSA id k2-20020a378802000000b0069fc13ce1f9sm2260092qkd.42.2022.05.19.19.14.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 May 2022 19:14:52 -0700 (PDT) Message-ID: Date: Thu, 19 May 2022 22:14:50 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] Add divide by zero side effect. To: Segher Boessenkool Cc: gcc-patches References: <20220518181348.GC25951@gate.crashing.org> <20220518204054.GD25951@gate.crashing.org> <5b4856ba-513b-6299-d112-7a7e11ba4d1c@redhat.com> <20220519222309.GE25951@gate.crashing.org> From: Andrew MacLeod In-Reply-To: <20220519222309.GE25951@gate.crashing.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-CA Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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 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: Fri, 20 May 2022 02:14:58 -0000 On 5/19/22 18:23, Segher Boessenkool wrote: > On Thu, May 19, 2022 at 09:22:32AM -0400, Andrew MacLeod wrote: >> On 5/18/22 16:40, Segher Boessenkool wrote: >>> On Wed, May 18, 2022 at 04:24:06PM -0400, Andrew MacLeod wrote: >>>> On 5/18/22 14:13, Segher Boessenkool wrote: >>>>> "Side effect" already has a meaning, very commonly used in language >>>>> theory, and even in the C standard itself: a function has a side effect >>>>> if it does something more than just return a value: if it changes state. >>>>> This can be some I/O, or it can just be writing to some non-local data. >>>>> >>>>> Side effects are crucial to what a compiler does, and they are used all >>>>> over the place (the gcc/ dir has some thousand mentions of it for >>>>> example). >>>>> >>>>> Please don't make life hard for everyone by overloading this term. >>>>> >>>> I'm open to suggestions for a better term! >>> Glad to hear that, and this isn't set in stione yet! >>> >>>> Is there a commonly used alternate term to describe an observable effect >>>> on the value of an input operand? >>> I'd use something with "known" in the name. But: >>> >>> As far as I understand what you are doing this is not an effect on the >>> operand at all! It cannot be one even, the operand is an input only >>> after all. Instead, it changes what is known about the value of that >>> input: it cannot be 0 in this case, it is known to not be 0. >>> >>> This is similar to other known value things we have in GCC already. Can >>> you not just use one of those, even? What are the benefit to this new >>> abstraction? >> Well, This is a component of ranger tracking value ranges..  it is >> recording the "side-effect" of the stmt on the known range of an object. >> The file is called  "gimple-range-side-effect.h" > So the file name is confusingly wrong as well. > >> Its a generalization of how ranger tracks non-null pointer values, >> enabling it to track arbitrary observable ranges values. (The old >> mechanism also utilized immediate-use chains, which prevented it from >> being utilized in gimple-folding) >> >> WIth this change, we can also track things like a = b / c causing the >> effect that c is known non-zero after the statement if there were no >> traps, or https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31178 , which >> after 15 years, we can now simply indicate that for  a = b >> c , its >> only defined behaviour if c is in the range [0, PRECISION(b)] >> >> So its basically just a generalization of how we track known values >> within the range system. > Sure. Just the name is harmful :-( > Still waiting for a suggestion, since "side effect" is the description that made sense to me :-) Andrew