From mboxrd@z Thu Jan 1 00:00:00 1970 From: sebor@roguewave.com To: gcc-gnats@gcc.gnu.org Subject: optimization/4371: gcc 3.0.1 optimization introduces an infinite loop Date: Thu, 20 Sep 2001 15:06:00 -0000 Message-id: <20010920220024.13036.qmail@sourceware.cygnus.com> X-SW-Source: 2001-09/msg00429.html List-Id: >Number: 4371 >Category: optimization >Synopsis: gcc 3.0.1 optimization introduces an infinite loop >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Sep 20 15:06:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: sebor@roguewave.com >Release: gcc 3.0.1 >Organization: >Environment: >Description: The 3.0.1 optimizer incorrectly assumes that (i - 1 < i) will always hold for all i's of type int (or any signed type for that matter). The code is derived from a test that computes the values of integral limits. The problem exists in prior versions of gcc as well. Regards Martin >How-To-Repeat: $ cat t.c ; gcc -O -S t.c && cat t.s int main () { int i = -2147483647; for (; i - 1 < i; i -= 1); } .file "t.c" .version "01.01" .text .align 4 .globl main .type main,@function main: pushl %ebp movl %esp, %ebp subl $8, %esp andl $-16, %esp .align 4 .L4: jmp .L4 .Lfe1: .size main,.Lfe1-main .ident "GCC: (GNU) 3.0.1" >Fix: >Release-Note: >Audit-Trail: >Unformatted: