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

Bug#527313: gcc-4.3: Simple recursive function causes stack overflow. GCC puts increment in wrong spot.



Package: gcc-4.3
Version: 4.3.3-5
Severity: important


Works:

int n(char*l){return*l?!(*l-32)+n(++l):0;}

Fails:

int n(char*l){return*l?!(32-*l++)+n(l):0;}

Only difference is the post-increment at 1:35 is changed to a
pre-increment at 1:31

gcc assembly output (compiled with -O0 -S) incorrectly places
increment after recursive call, leading to stack overflow.


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

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

Versions of packages gcc-4.3 recommends:
ii  libc6-dev                     2.9-4      GNU C Library: Development Librari

Versions of packages gcc-4.3 suggests:
pn  gcc-4.3-doc                   <none>     (no description available)
pn  gcc-4.3-locales               <none>     (no description available)
pn  gcc-4.3-multilib              <none>     (no description available)
pn  libgcc1-dbg                   <none>     (no description available)
pn  libgomp1-dbg                  <none>     (no description available)
pn  libmudflap0-4.3-dev           <none>     (no description available)
pn  libmudflap0-dbg               <none>     (no description available)

-- no debconf information



Reply to: