public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/27534]  New: Warning on passing pointer to va_list
@ 2006-05-10 15:43 gcc at flash-gordon dot me dot uk
  2006-05-10 15:47 ` [Bug c/27534] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: gcc at flash-gordon dot me dot uk @ 2006-05-10 15:43 UTC (permalink / raw)
  To: gcc-bugs

Attempting to pass a pointer to a va_list variable to a function expecting such
a pointer causes a warning about passing a pointer of incompatible type.

markg@home ~/work/ffdev $ gcc -v -save-temps -ansi -pedantic -Wall -W -O -c t.c
Reading specs from /usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/specs
Configured with: /var/tmp/portage/gcc-3.4.5-r1/work/gcc-3.4.5/configure
--prefix=/usr --bindir=/usr/powerpc-unknown-linux-gnu/gcc-bin/3.4.5
--includedir=/usr/lib/gcc/powerpc-unknown-linux
-gnu/3.4.5/include
--datadir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/3.4.5
--mandir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/3.4.5/man
--infodir=/usr/share/gcc-data/powerpc-unk
nown-linux-gnu/3.4.5/info
--with-gxx-include-dir=/usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/include/g++-v3
--host=powerpc-unknown-linux-gnu --build=powerpc-unknown-linux-gnu --disable-a
ltivec --enable-nls --without-included-gettext --with-system-zlib
--disable-checking --disable-werror --disable-libunwind-exceptions
--disable-multilib --enable-languages=c,c++,java,f77 -
-enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu
Thread model: posix
gcc version 3.4.5 (Gentoo 3.4.5-r1, ssp-3.4.5-1.0, pie-8.7.9)
 /usr/libexec/gcc/powerpc-unknown-linux-gnu/3.4.5/cc1 -E -quiet -v -D__unix__
-D__gnu_linux__ -D__linux__ -Asystem=linux -Asystem=unix -Asystem=posix t.c
-ansi -pedantic -Wall -W -O -o t.
i
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/../../../../powerpc-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/include
 /usr/include
End of search list.
 /usr/libexec/gcc/powerpc-unknown-linux-gnu/3.4.5/cc1 -fpreprocessed t.i -quiet
-dumpbase t.c -ansi -auxbase t -O -pedantic -Wall -W -ansi -version -o t.s
GNU C version 3.4.5 (Gentoo 3.4.5-r1, ssp-3.4.5-1.0, pie-8.7.9)
(powerpc-unknown-linux-gnu)
        compiled by GNU C version 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0,
pie-8.7.8).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64407
t.c:3: warning: unused parameter 'arg'
t.c: In function `bar':
t.c:9: warning: passing arg 1 of `foo' from incompatible pointer type

/usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/../../../../powerpc-unknown-linux-gnu/bin/as
-mppc -many -V -Qy -o t.o t.s
GNU assembler version 2.16.1 (powerpc-unknown-linux-gnu) using BFD version
2.16.1
markg@home ~/work/ffdev $ cat t.i
# 1 "t.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "t.c"
# 1 "/usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/include/stdarg.h" 1 3 4
# 43 "/usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 105 "/usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/include/stdarg.h" 3 4
typedef __gnuc_va_list va_list;
# 2 "t.c" 2

void foo(va_list *arg)
{
}

void bar(va_list arg)
{
  foo(&arg);
}
markg@home ~/work/ffdev $ gcc -v
Reading specs from /usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/specs
Configured with: /var/tmp/portage/gcc-3.4.5-r1/work/gcc-3.4.5/configure
--prefix=/usr --bindir=/usr/powerpc-unknown-linux-gnu/gcc-bin/3.4.5
--includedir=/usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/include
--datadir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/3.4.5
--mandir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/3.4.5/man
--infodir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/3.4.5/info
--with-gxx-include-dir=/usr/lib/gcc/powerpc-unknown-linux-gnu/3.4.5/include/g++-v3
--host=powerpc-unknown-linux-gnu --build=powerpc-unknown-linux-gnu
--disable-altivec --enable-nls --without-included-gettext --with-system-zlib
--disable-checking --disable-werror --disable-libunwind-exceptions
--disable-multilib --enable-languages=c,c++,java,f77 --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.5 (Gentoo 3.4.5-r1, ssp-3.4.5-1.0, pie-8.7.9)
markg@home ~/work/ffdev $

The warning about the unused variable is expected. The real code (much more
complex) from which this was cut down used the variable and still generated the
warning about incompatible pointer type.

The standard says that vl_list should be an object type, and others on the news
group comp.lang.c agree that my code is valid. See thread
http://groups.google.com/group/comp.lang.c/browse_frm/thread/e64d6ffd19ab7ae3/faf78d3f5fb3acfe?lnk=st&q=group%3Acomp.lang.c+insubject%3Ava_list&rnum=1&hl=en#faf78d3f5fb3acfe


-- 
           Summary: Warning on passing pointer to va_list
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc at flash-gordon dot me dot uk
 GCC build triplet: powerpc-unknown-linux-gnu
  GCC host triplet: powerpc-unknown-linux-gnu
GCC target triplet: powerpc-unknown-linux-gnu


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c/27534] Warning on passing pointer to va_list
  2006-05-10 15:43 [Bug c/27534] New: Warning on passing pointer to va_list gcc at flash-gordon dot me dot uk
@ 2006-05-10 15:47 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-10 15:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-05-10 15:46 -------
It is an object type.  An array is an object type.

*** This bug has been marked as a duplicate of 14557 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-05-10 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-10 15:43 [Bug c/27534] New: Warning on passing pointer to va_list gcc at flash-gordon dot me dot uk
2006-05-10 15:47 ` [Bug c/27534] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).