From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129965 invoked by alias); 21 Aug 2015 11:17:27 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 129920 invoked by uid 48); 21 Aug 2015 11:17:23 -0000 From: "zeccav at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/61657] Undefined behavior in loop-iv.c Date: Fri, 21 Aug 2015 11:17:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zeccav at gmail dot com 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-08/txt/msg01485.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61657 --- Comment #6 from Vittorio Zecca --- A shorter source file displaying the same bug: // from pr42049.c // gcc -funroll-loops -O // ../../gcc-5.2.0/gcc/loop-iv.c:2670:14: runtime error: // signed integer overflow: 7 - -9223372036854775808 cannot be represented in type 'long int' // loop-iv.c source line "max = (uint64_t) (up - down) / inc + 1;" // Target: x86_64-unknown-linux-gnu // COLLECT_GCC_OPTIONS='-funroll-loops' '-O' '-mtune=generic' '-march=x86-64' void foo (void) { long int i; for (i = 1; i && i < 8; i++); }