[Bug c/47518] New: va_arg causes segmentation fault in case of variable length argument

2011-01-28 Thread jur.pauw at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47518

   Summary: va_arg causes segmentation fault in case of variable
length argument
   Product: gcc
   Version: 4.2.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jur.p...@gmail.com


To reproduce:
gcc -Wall -g aap.c
a.out

Output:
Segmentation fault (core dumped)

Valgrind output"
==4442== Memcheck, a memory error detector
==4442== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==4442== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==4442== Command: a.out
==4442== 
==4442== Invalid read of size 1
==4442==at 0x4C7E849: memcpy (mc_replace_strmem.c:482)
==4442==by 0x8048423: f (aap.c:19)
==4442==by 0x80484F4: main (aap.c:36)
==4442==  Address 0x1ff is not stack'd, malloc'd or (recently) free'd

Version information:
Reading specs from
/sysmnt/cadappl_linuxi386_nsvr1/gcc/4.2.2.1/bin/../lib/gcc/i686-pc-linux-gnu/4.2.2/specs
Target: i686-pc-linux-gnu
Configured with: /home/gcc/gcc/gcc-4.2.2.1/gcc-4.2.2.1/configure
--prefix=/cadappl/gcc/4.2.2.1 --with-as=/cadappl/gcc/4.2.2.1/bin/as
--with-ld=/cadappl/gcc/4.2.2.1/bin/ld --enable-__cxa_atexit
--enable-threads=posix --with-march=i686 --with-tune=pentium4
--enable-languages=c,c++,fortran --with-gmp=/cadappl/gcc/4.2.2.1
--with-mpfr=/cadappl/gcc/4.2.2.1
Thread model: posix
gcc version 4.2.2


[Bug c/47518] va_arg causes segmentation fault in case of variable length argument

2011-01-28 Thread jur.pauw at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47518

--- Comment #1 from jur.pauw at gmail dot com 2011-01-28 15:26:41 UTC ---
If gcc version 3.4.4 is used then the program executes correctly.

Version information:
Reading specs from
/sysmnt/cadappl_linuxi386_nsvr1/gcc/3.4.4/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/specs
Configured with: /home/gcc/gcc/gcc-3.4.4/gcc-3.4.4/configure
--prefix=/cadappl/gcc/3.4.4 --enable-shared --enable-threads=posix
--enable-__cxa_atexit --with-as=/cadappl/gcc/3.4.4/bin/as
--with-ld=/cadappl/gcc/3.4.4/bin/ld --enable-languages=c,c++,f77,java
Thread model: posix
gcc version 3.4.4


[Bug c/47518] va_arg causes segmentation fault in case of variable length argument

2011-01-28 Thread jur.pauw at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47518

--- Comment #4 from jur.pauw at gmail dot com 2011-01-28 15:54:10 UTC ---
Created attachment 23156
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23156
preprocessed output that triggers va_arg segmentation fault


[Bug c/47518] va_arg causes segmentation fault in case of variable length argument

2011-01-28 Thread jur.pauw at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47518

jur.pauw at gmail dot com changed:

   What|Removed |Added

Version|4.2.2   |4.4.5

--- Comment #5 from jur.pauw at gmail dot com 2011-01-28 15:55:25 UTC ---
Using built-in specs.
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.4.4-14ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.4 --enable-shared --enable-multiarch
--enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic
--enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu
--target=i686-linux-gnu
Thread model: posix
gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)