From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 219743857C71; Tue, 29 Dec 2020 22:27:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 219743857C71 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/98474] [8/9/10/11 Regression] incorrect results using __uint128_t Date: Tue, 29 Dec 2020 22:27:20 +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.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: short_desc cc component target_milestone 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: Tue, 29 Dec 2020 22:27:21 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98474 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|incorrect results using |[8/9/10/11 Regression] |__uint128_t |incorrect results using | |__uint128_t CC| |jakub at gcc dot gnu.org Component|c++ |tree-optimization Target Milestone|--- |8.5 --- Comment #2 from Jakub Jelinek --- Started with r5-424-g807e902eea17f3132488c256c963823976b2348c C testcase that just needs -O2: __attribute__ ((noipa)) void foo (__uint128_t *x) { asm volatile ("" : : "r" (x) : "memory"); } int main () { __uint128_t a =3D ((__uint128_t) 1) << 65; __uint128_t b =3D a; __uint128_t n; foo (&b); n =3D b; while (n >=3D a) n -=3D a; if ((int) (n >> 64) !=3D 0) __builtin_abort (); return 0; } Works fine with unsigned long long instead of __uint128_t and 33 instead of= 65 and 32 instead of 64, so either a wide-int bug or number of loop iterations bug. On the ullong testcase, e.g. profile_estimate prints: Analyzing # of iterations of loop 1 exit condition 8589934591 < [n_8, + , 18446744065119617024] bounds on difference of bases: -8589934591 ... 18446744065119617024 result: # of iterations n_8 / 8589934592, bounded by 2147483647 but on the uint128_t testcase it prints: Analyzing # of iterations of loop 1 exit condition 0x1ffffffffffffffff < [n_8, + , 0xfffffffffffffffe0000000000000000] bounds on difference of bases: -36893488147419103231 ... -18446744073709551616 result: # of iterations n_8 / 0x20000000000000000, bounded by 0=