Your message dated Fri, 25 Jan 2013 09:31:44 -0800
with message-id
<CADf0C44QrD0UWx6LxdQzexjEmndj4m54TAhWAeZXUdM6r=v...@mail.gmail.com>
and subject line Isn't a bug to "miscompile" invalid code
has caused the Debian Bug report #698950,
regarding gcc-4.7: Miscompilation of simple loop depending on integer overflow
for termination
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)
--
698950: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698950
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: gcc-4.7
Version: 4.7.2-5
Severity: normal
With the following very simple test program:
extern int foo(int);
extern void bar();
void test_fn() {
int i;
for (i = 1; 0 < i; i *= 2)
foo(i);
bar();
}
and compiling with "gcc -S -O2 -Wall bugtest.c -o -" (on amd64) I get output:
.file "bugtest.c"
.text
.p2align 4,,15
.globl test_fn
.type test_fn, @function
test_fn:
.LFB0:
.cfi_startproc
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
movl $1, %ebx
.p2align 4,,10
.p2align 3
.L2:
movl %ebx, %edi
addl %ebx, %ebx
call foo
jmp .L2
.cfi_endproc
.LFE0:
.size test_fn, .-test_fn
.ident "GCC: (Debian 4.7.2-5) 4.7.2"
.section .note.GNU-stack,"",@progbits
So it misoptimized this into an infinite loop, and then also optimized
out the code after the loop. With -O1 it appears to produce a correct
loop executing the body 31 times. This bug also happens with 4.7.2-19
from experimental.
(I found this issue while tracking down why a "checking for working
mktime" autoconf check was timing out.)
--
Daniel Schepler
--- End Message ---
--- Begin Message ---
Sorry for the noise, it was just pointed out to me that the test
program depends on undefined behavior and is a known property of gcc
that can be worked around by passing -fwrapv. So packages with the
failing mktime test should upgrade their autoconf version to get a
proper implementation of AC_FUNC_MKTIME.
--
Daniel Schepler
--- End Message ---