public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/4371: gcc 3.0.1 optimization introduces an infinite loop
@ 2001-09-20 15:06 sebor
  0 siblings, 0 replies; 2+ messages in thread
From: sebor @ 2001-09-20 15:06 UTC (permalink / raw)
  To: gcc-gnats

>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:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: optimization/4371: gcc 3.0.1 optimization introduces an infinite loop
@ 2001-09-20 15:19 jsm28
  0 siblings, 0 replies; 2+ messages in thread
From: jsm28 @ 2001-09-20 15:19 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jsm28, nobody, sebor

Synopsis: gcc 3.0.1 optimization introduces an infinite loop

State-Changed-From-To: open->closed
State-Changed-By: jsm28
State-Changed-When: Thu Sep 20 15:19:36 2001
State-Changed-Why:
    Signed integer overflow is undefined behavior in the C
    standard, so optimising on the presumption that signed
    integer overflow does not occur is valid.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4371&database=gcc


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-09-20 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-20 15:06 optimization/4371: gcc 3.0.1 optimization introduces an infinite loop sebor
2001-09-20 15:19 jsm28

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).