public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/36124]  New: conditional loop becomes infinite loop in -O2 (gcc 4.2 -> 4.3 regression)
@ 2008-05-04 16:26 cyprien+gccbug at cypou dot net
  2008-05-04 16:35 ` [Bug middle-end/36124] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: cyprien+gccbug at cypou dot net @ 2008-05-04 16:26 UTC (permalink / raw)
  To: gcc-bugs

Hi,

It seems to have some regression in gcc 4.3, visible on arm targets as well as
x86_64.
I originally already reported it to Debian bugtracking system
[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=472867]

I tested it against the latest gcc snapshot:
    gcc (GCC) 4.3.1 20080501 (prerelease)

gcc has been built with no option, only srcdir/configure && make.

preprocessed content:
# 1 "c.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "c.c"


extern void func(void*);

void test()
{
    register long *foo = (long*) 1024;
    register int index;
    for(index=0;index<1024;index++)
        func(foo--);
}


This is a simple loop indexed on an integer. It should be finite, but when
compiling with -O2 (and -O3) the compiler removes the end condition.

gcc -S -O2 extract:
.LCFI0: 
        movl    $1024, %edi
        .p2align 4,,10
        .p2align 3
.L2:
        leaq    -8(%rdi), %rbx
        call    func
        movq    %rbx, %rdi
        jmp     .L2


Note that when using char* or non-pointer type for foo variable, it compiles
successfully.


-- 
           Summary: conditional loop becomes infinite loop in -O2 (gcc 4.2 -
                    > 4.3 regression)
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cyprien+gccbug at cypou dot net
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36124


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

end of thread, other threads:[~2008-05-13 21:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-04 16:26 [Bug c/36124] New: conditional loop becomes infinite loop in -O2 (gcc 4.2 -> 4.3 regression) cyprien+gccbug at cypou dot net
2008-05-04 16:35 ` [Bug middle-end/36124] " pinskia at gcc dot gnu dot org
2008-05-04 16:42 ` cyprien+gccbug at cypou dot net
2008-05-04 16:45 ` pinskia at gcc dot gnu dot org
2008-05-04 17:02 ` kargl at gcc dot gnu dot org
2008-05-04 17:04 ` cyprien+gccbug at cypou dot net
2008-05-04 17:10 ` pinskia at gcc dot gnu dot org
2008-05-04 17:31 ` cyprien+gccbug at cypou dot net
2008-05-04 20:13 ` cyprien+gccbug at cypou dot net
2008-05-07 19:43 ` rguenth at gcc dot gnu dot org
2008-05-13 20:02 ` pinskia at gcc dot gnu dot org
2008-05-13 21:14 ` scottwood at freescale dot com

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).