This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc va_arg processing bug on i686-cygwin
- From: "Sergey Okhapkin" <sos at sokhapkin dot dyndns dot org>
- To: "Christopher Faylor" <cgf at redhat dot com>,<gcc-bugs at gcc dot gnu dot org>
- Date: Thu, 26 Dec 2002 09:29:04 -0500
- Subject: gcc va_arg processing bug on i686-cygwin
- References: <004001c2ac8b$027bbad0$0201a8c0@sos> <20021226040301.GB6101@redhat.com>
Gcc generates incorrect assembly code while processing "va_arg(ap, char)". I
just built gcc from today's CVS snapshot and got the same error with
E:\obj\cygwin32\gcc>gcc -v
Reading specs from /bin/../lib/gcc-lib/i686-pc-cygwin/3.4/specs
Configured with:
/usr/src/cygnus/gcc/configure --enable-libgcj --enable-threads=
posix --with-system-zlib --enable-nls --without-included-gettext --enable-in
terp
reter --disable-sjlj-exceptions --disable-version-specific-runtime-libs --en
able
-shared --enable-haifa --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --
libd
ir=/usr/lib --includedir=/nonexistent/include --libexecdir=/usr/sbin -v :
(recon
figured)
/usr/src/cygnus/gcc/configure --with-gcc-version-trigger=/usr/src/cygnu
s/gcc/gcc/version.c --host=i686-pc-cygwin --enable-libgcj --enable-threads=p
osix
--with-system-zlib --enable-nls --without-included-gettext --enable-interpr
eter
--disable-sjlj-exceptions --disable-version-specific-runtime-libs --enable-
shar
ed --enable-haifa --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdi
r=/u
sr/lib --libexecdir=/usr/sbin -v : (reconfigured) : (reconfigured) :
(reconfig
ured)
Thread model: posix
gcc version 3.4 20021226 (experimental)
Sergey Okhapkin
Somerset, NJ
----- Original Message -----
From: "Christopher Faylor" <cgf@redhat.com>
To: "Sergey Okhapkin" <sos@sokhapkin.dyndns.org>
Sent: Wednesday, December 25, 2002 11:03 PM
Subject: Re: gcc bug?
> On Wed, Dec 25, 2002 at 10:00:55PM -0500, Sergey Okhapkin wrote:
> >gcc version 3.2 20020927 (prerelease)
> >
> >E:\usr\src\tests>cat va.c
> >#include <stdarg.h>
> >
> >static char c_saved;
> >static int i_saved;
> >
> >void sv_exp(char *format, ...)
> >{
> > va_list ap;
> >
> > va_start(ap, format);
> > c_saved = va_arg(ap, char);
> > va_end(ap);
> > va_start(ap, format);
> > i_saved = va_arg(ap, int);
> > va_end(ap);
> >
> > return;
> >}
> >
> >E:\usr\src\tests>gcc -S va.c
> >va.c: In function `sv_exp':
> >va.c:11: warning: `char' is promoted to `int' when passed through `...'
> >va.c:11: warning: (so you should pass `int' not `char' to `va_arg')
> >
> >E:\usr\src\tests>cat va.s
> > .file "va.c"
> > .text
> > .align 2
> >.globl _sv_exp
> > .def _sv_exp; .scl 2; .type 32; .endef
> >_sv_exp:
> > pushl %ebp
> > movl %esp, %ebp
> > subl $4, %esp
> > leal 12(%ebp), %eax
> > movl %eax, -4(%ebp)
> > int $5
> >.lcomm _c_saved,16
> >.lcomm _i_saved,16
> >
> >What is "int $5"???????????????????
>
> Good question! Looks like a pretty serious bug. Could you send it to
> gcc-bugs?
>
> cgf