Debian Bug report logs - #458745
arm-only miscompilation of alloca code

version graph

Package: gcc-4.2; Maintainer for gcc-4.2 is (unknown);

Reported by: Camm Maguire <camm@enhanced.com>

Date: Wed, 2 Jan 2008 15:12:02 UTC

Severity: important

Tags: fixed-upstream, upstream, wontfix

Found in version gcc-4.2/4.2.2-4

Done: "Manuel A. Fernandez Montecelo" <manuel.montezelo@gmail.com>

Bug is archived. No further changes may be made.

Forwarded to http://gcc.gnu.org/PR34652

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Wookey <wookey@wookware.org>, debian-arm@lists.debian.org, Stephen Gran <sgran@debian.org>, pb@debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Camm Maguire <camm@enhanced.com>:
New Bug report received and forwarded. Copy sent to Wookey <wookey@wookware.org>, debian-arm@lists.debian.org, Stephen Gran <sgran@debian.org>, pb@debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Camm Maguire <camm@enhanced.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: arm-only miscompilation of alloca code
Date: Wed, 02 Jan 2008 10:09:39 -0500
Package: gcc-4.2
Version: 4.2.2-4
Severity: important

/tmp/foo.c:
=============================================================================
#include <stdio.h>
#include <alloca.h>
#include <stdarg.h>
#define object void *

int VFUN_NARGS;
void *alloca_val;
struct cons {
  object c_cdr;
  object c_car;
};

#define Cnil 0

static void
foo(object first,...) {
  va_list ap;
  int narg = VFUN_NARGS;
  struct cons *V1128;
  object V1129;

  va_start(ap,first);
  V1129 = 
    !narg? Cnil : (alloca_val=alloca((narg)*sizeof(struct cons)+sizeof(object)),
		   ({object _b=(void *)alloca_val;if (((unsigned long)_b)&sizeof(_b)) _b++;
		   {register struct cons *_p=(void *)_b;
		   {struct cons *_e=_p+(narg-1);
		   for (;_p<_e;_p++) {_p->c_car=({object _t=first;first=va_arg(ap,object);_t;});_p->c_cdr=(object)(_p+1);}}
		   _p->c_car=first;_p->c_cdr=Cnil;}_b;}));
  va_end(ap);
  V1128= V1129;
  for (;V1128!=Cnil;V1128=V1128->c_cdr)
    printf("%p\n",V1128->c_car);

}

int
main(int argc,char * argv[]) {

  VFUN_NARGS=4;
  foo(&argc,1,2,3);
  return 0;

}
=============================================================================
i386 sid:
=============================================================================
cc -g /tmp/foo.c -o /tmp/foo
/tmp/foo
0xbf867bd0
0x1
0x2
0x3
=============================================================================
leisner dchroot sid:
=============================================================================
cc -g foo.c -o foo
./foo
0x18beed5d
Segmentation fault
=============================================================================

Take care,

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

Kernel: Linux 2.6.20-gen
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages gcc-4.2 depends on:
ii  binutils            2.18.1~cvs20071027-1 The GNU assembler, linker and bina
ii  cpp-4.2             4.2.2-4              The GNU C preprocessor
ii  gcc-4.2-base        4.2.2-4              The GNU Compiler Collection (base 
ii  libc6               2.7-2                GNU C Library: Shared libraries
ii  libgcc1             1:4.2.2-4            GCC support library
ii  libgomp1            4.2.2-4              GCC OpenMP (GOMP) support library

Versions of packages gcc-4.2 recommends:
ii  libc6-dev                     2.7-2      GNU C Library: Development Librari

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to "Martin Guy" <martinwguy@yahoo.it>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #10 received at 458745@bugs.debian.org (full text, mbox):

From: "Martin Guy" <martinwguy@yahoo.it>
To: "Camm Maguire" <camm@enhanced.com>, 458745@bugs.debian.org
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: Wed, 2 Jan 2008 17:31:10 +0000
I just tried foo.c on up-to-date arm-sid and armel-sid systems, both
under qemu and on real hardware and I cannot reproduce the problem;
all succeed the same way, for example:

martin@qemu-armel-sid:~$ /usr/bin/gcc-4.2 foo.c
martin@qemu-armel-sid:~$ ./a.out
0xbe92ec84
0x1
0x2
0x3
martin@qemu-armel-sid:~$ gcc --version
gcc (GCC) 4.2.3 20071123 (prerelease) (Debian 4.2.2-4)

So I can only suspect a leisner problem of some kind.

If you would like to try reproducing the problem here, please get in
touch and I'll arrange access.




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #15 received at 458745@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Camm Maguire <camm@enhanced.com>, 458745@bugs.debian.org
Cc: Herbert Valerio Riedel <hvr@gnu.org>
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: Wed, 2 Jan 2008 20:02:05 +0100
Herbert, do you think you could take a quick long at this bug report
before I forward it upstream to the GCC folks?


* Camm Maguire <camm@enhanced.com> [2008-01-02 10:09]:
> Package: gcc-4.2
> Version: 4.2.2-4
> Severity: important
> 
> /tmp/foo.c:
> =============================================================================
> #include <stdio.h>
> #include <alloca.h>
> #include <stdarg.h>
> #define object void *
> 
> int VFUN_NARGS;
> void *alloca_val;
> struct cons {
>   object c_cdr;
>   object c_car;
> };
> 
> #define Cnil 0
> 
> static void
> foo(object first,...) {
>   va_list ap;
>   int narg = VFUN_NARGS;
>   struct cons *V1128;
>   object V1129;
> 
>   va_start(ap,first);
>   V1129 = 
>     !narg? Cnil : (alloca_val=alloca((narg)*sizeof(struct cons)+sizeof(object)),
> 		   ({object _b=(void *)alloca_val;if (((unsigned long)_b)&sizeof(_b)) _b++;
> 		   {register struct cons *_p=(void *)_b;
> 		   {struct cons *_e=_p+(narg-1);
> 		   for (;_p<_e;_p++) {_p->c_car=({object _t=first;first=va_arg(ap,object);_t;});_p->c_cdr=(object)(_p+1);}}
> 		   _p->c_car=first;_p->c_cdr=Cnil;}_b;}));
>   va_end(ap);
>   V1128= V1129;
>   for (;V1128!=Cnil;V1128=V1128->c_cdr)
>     printf("%p\n",V1128->c_car);
> 
> }
> 
> int
> main(int argc,char * argv[]) {
> 
>   VFUN_NARGS=4;
>   foo(&argc,1,2,3);
>   return 0;
> 
> }
> =============================================================================
> i386 sid:
> =============================================================================
> cc -g /tmp/foo.c -o /tmp/foo
> /tmp/foo
> 0xbf867bd0
> 0x1
> 0x2
> 0x3
> =============================================================================
> leisner dchroot sid:
> =============================================================================
> cc -g foo.c -o foo
> ./foo
> 0x18beed5d
> Segmentation fault
> =============================================================================
> 
> Take care,
> 
> -- System Information:
> Debian Release: lenny/sid
>   APT prefers unstable
>   APT policy: (500, 'unstable')
> Architecture: i386 (i686)
> 
> Kernel: Linux 2.6.20-gen
> Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
> Shell: /bin/sh linked to /bin/bash
> 
> Versions of packages gcc-4.2 depends on:
> ii  binutils            2.18.1~cvs20071027-1 The GNU assembler, linker and bina
> ii  cpp-4.2             4.2.2-4              The GNU C preprocessor
> ii  gcc-4.2-base        4.2.2-4              The GNU Compiler Collection (base 
> ii  libc6               2.7-2                GNU C Library: Shared libraries
> ii  libgcc1             1:4.2.2-4            GCC support library
> ii  libgomp1            4.2.2-4              GCC OpenMP (GOMP) support library
> 
> Versions of packages gcc-4.2 recommends:
> ii  libc6-dev                     2.7-2      GNU C Library: Development Librari
> 
> -- no debconf information
> 

-- 
Martin Michlmayr
http://www.cyrius.com/




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Herbert Valerio Riedel <hvr@gnu.org>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #20 received at 458745@bugs.debian.org (full text, mbox):

From: Herbert Valerio Riedel <hvr@gnu.org>
To: Martin Michlmayr <tbm@cyrius.com>
Cc: Camm Maguire <camm@enhanced.com>, 458745@bugs.debian.org
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: Wed, 02 Jan 2008 22:13:37 +0100
On Wed, 2008-01-02 at 20:02 +0100, Martin Michlmayr wrote:
> Herbert, do you think you could take a quick long at this bug report
> before I forward it upstream to the GCC folks?

well, I couldn't reproduce that on a Debian EABI system with

ii  gcc                         4:4.2.2-1                   The GNU C compiler
ii  libc6                       2.7-5                       GNU C Library: Shared libraries

no segfaults here... :-/






Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Camm Maguire <camm@enhanced.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #25 received at 458745@bugs.debian.org (full text, mbox):

From: Camm Maguire <camm@enhanced.com>
To: Herbert Valerio Riedel <hvr@gnu.org>
Cc: Martin Michlmayr <tbm@cyrius.com>, 458745@bugs.debian.org,"Martin Guy" <martinwguy@yahoo.it>
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: 02 Jan 2008 16:55:33 -0500
Greetings!

May I add that eliminating this code resolved the issue present in

http://buildd.debian.org/fetch.cgi?&pkg=gclcvs&ver=2.7.0-82&arch=arm&stamp=1198067608&file=log

as shown in

http://buildd.debian.org/fetch.cgi?&pkg=gclcvs&ver=2.7.0-83&arch=arm&stamp=1199286999&file=log

Is EABI the old arm, or the new?  Couldn't this make a difference?

Take care,


Herbert Valerio Riedel <hvr@gnu.org> writes:

> On Wed, 2008-01-02 at 20:02 +0100, Martin Michlmayr wrote:
> > Herbert, do you think you could take a quick long at this bug report
> > before I forward it upstream to the GCC folks?
> 
> well, I couldn't reproduce that on a Debian EABI system with
> 
> ii  gcc                         4:4.2.2-1                   The GNU C compiler
> ii  libc6                       2.7-5                       GNU C Library: Shared libraries
> 
> no segfaults here... :-/
> 
> 
> 
> 
> 

-- 
Camm Maguire			     			camm@enhanced.com
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Camm Maguire <camm@enhanced.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #30 received at 458745@bugs.debian.org (full text, mbox):

From: Camm Maguire <camm@enhanced.com>
To: "Martin Guy" <martinwguy@yahoo.it>
Cc: 458745@bugs.debian.org
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: 02 Jan 2008 17:06:15 -0500
Greetings!

"Martin Guy" <martinwguy@yahoo.it> writes:

> I just tried foo.c on up-to-date arm-sid and armel-sid systems, both
> under qemu and on real hardware and I cannot reproduce the problem;
> all succeed the same way, for example:
> 
> martin@qemu-armel-sid:~$ /usr/bin/gcc-4.2 foo.c
> martin@qemu-armel-sid:~$ ./a.out
> 0xbe92ec84
> 0x1
> 0x2
> 0x3
> martin@qemu-armel-sid:~$ gcc --version
> gcc (GCC) 4.2.3 20071123 (prerelease) (Debian 4.2.2-4)
> 
> So I can only suspect a leisner problem of some kind.
> 
> If you would like to try reproducing the problem here, please get in
> touch and I'll arrange access.
> 

This would be very helpful, if convenient for you.  I'm confused about
the different versions of arm and Debian.

Take care,

> 
> 

-- 
Camm Maguire			     			camm@enhanced.com
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #35 received at 458745@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Herbert Valerio Riedel <hvr@gnu.org>
Cc: Camm Maguire <camm@enhanced.com>, 458745@bugs.debian.org, Martin Guy <martinwguy@yahoo.it>
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: Wed, 2 Jan 2008 23:27:31 +0100
* Herbert Valerio Riedel <hvr@gnu.org> [2008-01-02 22:13]:
> well, I couldn't reproduce that on a Debian EABI system with
> 
> ii  gcc                         4:4.2.2-1                   The GNU C compiler
> ii  libc6                       2.7-5                       GNU C Library: Shared libraries
> 
> no segfaults here... :-/

I get

./t(sid)tbm@thecus1:~$ ./t2
0x18be8ebb
(nil)

on a box with EABI kernel an old ABI chroot.  I see the segfault on
leisner (the box Camm probably used).
-- 
Martin Michlmayr
http://www.cyrius.com/




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #40 received at 458745@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Camm Maguire <camm@enhanced.com>
Cc: Herbert Valerio Riedel <hvr@gnu.org>, 458745@bugs.debian.org, Martin Guy <martinwguy@yahoo.it>
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: Wed, 2 Jan 2008 23:27:44 +0100
* Camm Maguire <camm@enhanced.com> [2008-01-02 16:55]:
> Is EABI the old arm, or the new?  Couldn't this make a difference?

EABI is the new ABI.
-- 
Martin Michlmayr
http://www.cyrius.com/




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #45 received at 458745@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Camm Maguire <camm@enhanced.com>
Cc: Herbert Valerio Riedel <hvr@gnu.org>, 458745@bugs.debian.org, Martin Guy <martinwguy@yahoo.it>
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: Thu, 3 Jan 2008 18:55:52 +0100
* Camm Maguire <camm@enhanced.com> [2008-01-02 16:55]:
> Is EABI the old arm, or the new?  Couldn't this make a difference?

I can reproduce the problem with the old ABI (i.e. the current port in
Debian).  I'll open a bug report with GCC.
-- 
Martin Michlmayr
http://www.cyrius.com/




Noted your statement that Bug has been forwarded to http://gcc.gnu.org/PR34652. Request was from Martin Michlmayr <tbm@cyrius.com> to control@bugs.debian.org. (Thu, 03 Jan 2008 18:30:04 GMT) Full text and rfc822 format available.

Tags added: upstream Request was from Martin Michlmayr <tbm@cyrius.com> to control@bugs.debian.org. (Thu, 03 Jan 2008 18:30:05 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Camm Maguire <camm@enhanced.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #54 received at 458745@bugs.debian.org (full text, mbox):

From: Camm Maguire <camm@enhanced.com>
To: Martin Michlmayr <tbm@cyrius.com>
Cc: Herbert Valerio Riedel <hvr@gnu.org>, 458745@bugs.debian.org, Martin Guy <martinwguy@yahoo.it>
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: 03 Jan 2008 17:44:12 -0500
Greetings!

Martin Michlmayr <tbm@cyrius.com> writes:

> * Camm Maguire <camm@enhanced.com> [2008-01-02 16:55]:
> > Is EABI the old arm, or the new?  Couldn't this make a difference?
> 
> I can reproduce the problem with the old ABI (i.e. the current port in
> Debian).  I'll open a bug report with GCC.

Thank you!

Are we going to have two arm ports, or is the old one going away for
lenny? 

Take care,

> -- 
> Martin Michlmayr
> http://www.cyrius.com/
> 
> 
> 

-- 
Camm Maguire			     			camm@enhanced.com
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Neil Williams <codehelp@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #59 received at 458745@bugs.debian.org (full text, mbox):

From: Neil Williams <codehelp@debian.org>
To: Camm Maguire <camm@enhanced.com>, 458745@bugs.debian.org
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: Fri, 04 Jan 2008 07:15:54 +0000
[Message part 1 (text/plain, inline)]
On Thu, 2008-01-03 at 17:44 -0500, Camm Maguire wrote:
> Greetings!
> 
> Martin Michlmayr <tbm@cyrius.com> writes:
> 
> > * Camm Maguire <camm@enhanced.com> [2008-01-02 16:55]:
> > > Is EABI the old arm, or the new?  Couldn't this make a difference?
> > 
> > I can reproduce the problem with the old ABI (i.e. the current port in
> > Debian).  I'll open a bug report with GCC.
> 
> Thank you!
> 
> Are we going to have two arm ports, or is the old one going away for
> lenny? 
> 

There are a lot of devices that need support from the existing Debian
arm port as well as newer devices that need the new ABI. There is a
possible method for combining the two but both will be needed - and
probably for some time after Lenny. Contact debian-arm for more info.

-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/


[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #64 received at 458745@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Camm Maguire <camm@enhanced.com>
Cc: Herbert Valerio Riedel <hvr@gnu.org>, 458745@bugs.debian.org, Martin Guy <martinwguy@yahoo.it>
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: Fri, 4 Jan 2008 08:25:50 +0100
* Camm Maguire <camm@enhanced.com> [2008-01-03 17:44]:
> Are we going to have two arm ports, or is the old one going away for
> lenny?

arm will be in lenny but it'll probably go away in the next release or
the one after the next.

armel will hopefully be in lenny, but it's not even part of unstable
yet (i.e. they have their own separate archive).
-- 
Martin Michlmayr
http://www.cyrius.com/




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Aurelien Jarno <aurelien@aurel32.net>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #69 received at 458745@bugs.debian.org (full text, mbox):

From: Aurelien Jarno <aurelien@aurel32.net>
To: Camm Maguire <camm@enhanced.com>
Cc: Martin Michlmayr <tbm@cyrius.com>, Herbert Valerio Riedel <hvr@gnu.org>, Martin Guy <martinwguy@yahoo.it>, 458745@bugs.debian.org
Subject: Re: arm-only miscompilation of alloca code
Date: Fri, 4 Jan 2008 13:35:04 +0100
On Wed, Jan 02, 2008 at 10:09:39AM -0500, Camm Maguire wrote:
> Package: gcc-4.2
> Version: 4.2.2-4
> Severity: important
> 
> /tmp/foo.c:
> =============================================================================
> #include <stdio.h>
> #include <alloca.h>
> #include <stdarg.h>
> #define object void *
> 
> int VFUN_NARGS;
> void *alloca_val;
> struct cons {
>   object c_cdr;
>   object c_car;
> };
> 
> #define Cnil 0
> 
> static void
> foo(object first,...) {
>   va_list ap;
>   int narg = VFUN_NARGS;
>   struct cons *V1128;
>   object V1129;
> 
>   va_start(ap,first);
>   V1129 = 
>     !narg? Cnil : (alloca_val=alloca((narg)*sizeof(struct cons)+sizeof(object)),
> 		   ({object _b=(void *)alloca_val;if (((unsigned long)_b)&sizeof(_b)) _b++;
> 		   {register struct cons *_p=(void *)_b;
> 		   {struct cons *_e=_p+(narg-1);
> 		   for (;_p<_e;_p++) {_p->c_car=({object _t=first;first=va_arg(ap,object);_t;});_p->c_cdr=(object)(_p+1);}}
> 		   _p->c_car=first;_p->c_cdr=Cnil;}_b;}));
>   va_end(ap);
>   V1128= V1129;
>   for (;V1128!=Cnil;V1128=V1128->c_cdr)
>     printf("%p\n",V1128->c_car);
> 
> }
> 
> int
> main(int argc,char * argv[]) {
> 
>   VFUN_NARGS=4;
>   foo(&argc,1,2,3);
>   return 0;
> 
> }
> =============================================================================
> i386 sid:
> =============================================================================
> cc -g /tmp/foo.c -o /tmp/foo
> /tmp/foo
> 0xbf867bd0
> 0x1
> 0x2
> 0x3
> =============================================================================
> leisner dchroot sid:
> =============================================================================
> cc -g foo.c -o foo
> ./foo
> 0x18beed5d

This address looks highly  suspicious as it is not aligned while the type
is a (void*).

On ARM unaligned access are not guaranteed to work and actually
depends on the CPU. On some of them it works as on i386, while usually
you get the aligned word, but rotated depending on the mis-alignement.

In short non-aligned accesses do not generate a SIGBUS, but rather
return "corrupted" data, so here a wrong address that could lead to a
segfault.

If you look at the bug log, all tests with aligned address work. The
others segfault or return (nil) as on tbm's machine.

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #74 received at 458745@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Aurelien Jarno <aurelien@aurel32.net>, 458745@bugs.debian.org
Cc: Camm Maguire <camm@enhanced.com>, Herbert Valerio Riedel <hvr@gnu.org>, Martin Guy <martinwguy@yahoo.it>
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: Mon, 21 Jan 2008 18:33:08 +0100
* Aurelien Jarno <aurelien@aurel32.net> [2008-01-04 13:35]:
> This address looks highly  suspicious as it is not aligned while the type
> is a (void*).
> 
> On ARM unaligned access are not guaranteed to work and actually
> depends on the CPU. On some of them it works as on i386, while usually
> you get the aligned word, but rotated depending on the mis-alignement.
> 
> In short non-aligned accesses do not generate a SIGBUS, but rather
> return "corrupted" data, so here a wrong address that could lead to a
> segfault.
> 
> If you look at the bug log, all tests with aligned address work. The
> others segfault or return (nil) as on tbm's machine.

Any comments, Camm?
-- 
Martin Michlmayr
http://www.cyrius.com/




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to Martin Michlmayr <tbm@cyrius.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #79 received at 458745@bugs.debian.org (full text, mbox):

From: Martin Michlmayr <tbm@cyrius.com>
To: Aurelien Jarno <aurelien@aurel32.net>, 458745@bugs.debian.org
Cc: Camm Maguire <camm@enhanced.com>
Subject: Re: Bug#458745: arm-only miscompilation of alloca code
Date: Sun, 16 Mar 2008 19:34:29 +0100
* Martin Michlmayr <tbm@cyrius.com> [2008-01-21 18:33]:
> > This address looks highly  suspicious as it is not aligned while the type
> > is a (void*).
> > 
> > On ARM unaligned access are not guaranteed to work and actually
> > depends on the CPU. On some of them it works as on i386, while usually
> > you get the aligned word, but rotated depending on the mis-alignement.
> > 
> > In short non-aligned accesses do not generate a SIGBUS, but rather
> > return "corrupted" data, so here a wrong address that could lead to a
> > segfault.
> > 
> > If you look at the bug log, all tests with aligned address work. The
> > others segfault or return (nil) as on tbm's machine.
> 
> Any comments, Camm?

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34652#c2 contains another
good describing why this is not a bug in gcc but the test case.
-- 
Martin Michlmayr
http://www.cyrius.com/




Tags added: fixed-upstream Request was from bts-link-upstream@lists.alioth.debian.org to control@bugs.debian.org. (Mon, 17 Mar 2008 01:21:04 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. Full text and rfc822 format available.

Acknowledgement sent to "Martin Guy" <martinwguy@yahoo.it>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #86 received at 458745@bugs.debian.org (full text, mbox):

From: "Martin Guy" <martinwguy@yahoo.it>
To: 458745@bugs.debian.org
Subject: misaligned access
Date: Sun, 3 Aug 2008 22:43:35 +0100
Confirmed - there is a misaligned word access in the test case

# echo 5 > /proc/cpu/alignnment
$ gcc foo.c
$ ./a.out
Bus error

reproducible in arm-sid using old-abi or eabi-oldabi-compat kernels.




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#458745; Package gcc-4.2. (Wed, 22 Oct 2008 11:51:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Riku Voipio <riku.voipio@iki.fi>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Wed, 22 Oct 2008 11:51:05 GMT) Full text and rfc822 format available.

Message #91 received at 458745@bugs.debian.org (full text, mbox):

From: Riku Voipio <riku.voipio@iki.fi>
To: 458745@bugs.debian.org
Cc: camm@enhanced.com, camm@debian.org
Subject: upstream says it's bogus
Date: Wed, 22 Oct 2008 14:47:57 +0300
Upstream declared the bug invalid:

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

Should this bug be closed in debian too?

-- 
"rm -rf" only sounds scary if you don't have backups




Added tag(s) wontfix. Request was from "Manuel A. Fernandez Montecelo" <manuel.montezelo@gmail.com> to control@bugs.debian.org. (Thu, 17 May 2012 10:42:16 GMT) Full text and rfc822 format available.

Reply sent to "Manuel A. Fernandez Montecelo" <manuel.montezelo@gmail.com>:
You have taken responsibility. (Thu, 17 May 2012 10:42:24 GMT) Full text and rfc822 format available.

Notification sent to Camm Maguire <camm@enhanced.com>:
Bug acknowledged by developer. (Thu, 17 May 2012 10:42:34 GMT) Full text and rfc822 format available.

Message #98 received at 458745-done@bugs.debian.org (full text, mbox):

From: "Manuel A. Fernandez Montecelo" <manuel.montezelo@gmail.com>
To: 458745-done@bugs.debian.org
Subject: Re: arm-only miscompilation of alloca code
Date: Thu, 17 May 2012 11:38:53 +0100
tags 458745 + wontfix
stop


Hello,

Thanks for the detailed bug report and your interest in improving
Debian.  I'm just doing some cleanup, I am not involved with the GCC
package.

This bug report is orphan, since it's assigned to a package not
present in any of the current Debian releases (gcc-4.2).

The bug was rejected upstream, who marked it as "invalid" a few years
ago, and gave reasons for it.  So I guess that the best course of
action is to close this bug report now.

Please reopen if you think that the resolution is not appropriate.

Regards.




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Fri, 15 Jun 2012 07:38:34 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Fri Apr 18 20:57:45 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.