[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#445536: marked as done ([fixed in 4.3] GCC generate wrong code for infinitely recursive functions)



Your message dated Sat, 2 Feb 2008 19:41:30 +0100
with message-id <18340.47450.986930.866986@gargle.gargle.HOWL>
and subject line GCC generate wrong code for infinitely recursive functions
has caused the attached Bug report 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 I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: gcc-4.2
Version: 4.2.1-5
Severity: normal

% cat > t.c << EOF
void foo()
{ foo(); }
EOF

% gcc -O -S -o - -fomit-frame-pointer -Wall t.c
        .file   "t.c"
        .text
.globl foo
        .type   foo, @function
foo:
        rep ; ret
        .size   foo, .-foo
        .ident  "GCC: (GNU) 4.2.1 (Debian 4.2.1-5)"
        .section        .note.GNU-stack,"",@progbits

As far as I know, there are two acceptable behaviours for function foo():
  - loop indefinitely (if tail recursion is used)
  - overflow the stack (if tail recursion is not used)

As soon as -O is used on x86-32, GCC generates code that just returns
("rep ; ret").

Note that the bug is also present with the following Ada program:

procedure U
begin
   U;
end U;

although the Ada front-end warns about a possibly infinite recursion. The
very same code gets generated.

This may be platform-specific and generates bogus code with any non-O0
optimization level.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-rc5
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gcc-4.2 depends on:
ii  binutils                      2.18-1     The GNU assembler, linker and bina
ii  cpp-4.2                       4.2.1-5    The GNU C preprocessor
ii  gcc-4.2-base                  4.2.1-5    The GNU Compiler Collection (base 
ii  libc6                         2.6.1-5    GNU C Library: Shared libraries
ii  libgcc1                       1:4.2.1-5  GCC support library
ii  libgomp1                      4.2.1-5    GCC OpenMP (GOMP) support library

Versions of packages gcc-4.2 recommends:
ii  libc6-dev                     2.6.1-5    GNU C Library: Development Librari
ii  libmudflap0-4.2-dev           4.2.1-5    GCC mudflap support libraries (dev

-- no debconf information



--- End Message ---
--- Begin Message ---
Version: 4.2.3-1


--- End Message ---

Reply to: