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

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



Your message dated Wed, 6 May 2009 21:45:57 +0200
with message-id <20090506194556.GB27881@minet.uni-jena.de>
and subject line Re: Bug#527313: gcc-4.3: Simple recursive function causes stack overflow. GCC puts increment in wrong spot.
has caused the Debian Bug report #527313,
regarding gcc-4.3: Simple recursive function causes stack overflow. GCC puts increment in wrong spot.
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 owner@bugs.debian.org
immediately.)


-- 
527313: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=527313
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
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



--- End Message ---
--- Begin Message ---
On Thu, May 07, 2009 at 05:07:55AM +1000, David Claridge wrote:
> 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.

The C language does not specify evaluation order of the arguments to a
a '+' expression. Your assumption that it would be left-to-right is
wrong. gcc is free to choose any order.

  Falk


--- End Message ---

Reply to: