From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1FD513898534; Fri, 1 May 2020 08:47:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1FD513898534 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588322867; bh=CA42AQP35bSaekyjh6YEDNAocBwh4QqSRNQ7XYAJiDw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=msETy01bhd2wna32LkUapcoQS90CSqcbYKttPkziwZqLXDI+W0XKPlIm2N80iYWOn hnt3NsX691NfCOauMrnXsqkWgbopmc7crWrbocZHnc1Du6cd/JhhDAyOo7fc6eDwXZ 3IoIHytjfSdmQkzGwvRM+D8zmFsBbc21V5S1Vjd8= From: "rsandifo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94899] Failure to optimize out add before compare with INT_MIN Date: Fri, 01 May 2020 08:47:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: easyhack, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rsandifo at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords bug_status cf_reconfirmed_on cc resolution everconfirmed Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 08:47:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94899 rsandifo at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |easyhack Status|RESOLVED |NEW Last reconfirmed| |2020-05-01 CC| |rsandifo at gcc dot gnu.org Resolution|INVALID |--- Ever confirmed|0 |1 --- Comment #4 from rsandifo at gcc dot gnu.org --- Reopening because... (In reply to Andrew Pinski from comment #2) > This is invalid as 0x80000000 is unsigned (C90/C++03) or long (C99/C++11)= in > type. > Which means then overflow is not undefined but rather wrapping. It's unsigned int for C99/C++11 too (see the different handling of decimal-literals and other integer-literals in [lex.icon.type]). This means that the result of the addition is also unsigned, For the specific value of 0x80000000, the transformation is monotonic, so the optimisation is valid and well-defined.=