This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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: unassigned@gcc.gnu.org
        ReportedBy: jur.pauw@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]