From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21290 invoked by alias); 1 Oct 2011 18:46:18 -0000 Received: (qmail 21281 invoked by uid 22791); 1 Oct 2011 18:46:17 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 01 Oct 2011 18:46:03 +0000 From: "joseph at codesourcery dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/50581] stdarg doesn't support array types Date: Sat, 01 Oct 2011 18:46:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: joseph at codesourcery dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg00024.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50581 --- Comment #5 from joseph at codesourcery dot com 2011-10-01 18:45:43 UTC --- On Sat, 1 Oct 2011, Wolfgang at Solfrank dot net wrote: > > Passing va_list as a function argument is generally hard, whether or not > > variadic, since you don't know whether it will be passed by reference or > > by value or what the type of the address of a va_list parameter will be. > > Portable code needs to pass a pointer to va_list or a structure containing > > va_list or use some other such means of avoiding dependence on whether > > va_list is an array. > > Huh? What about vprintf and friends? They are defined to take a va_list as > their last parameter. There are some things you can do - for example, calling those functions in accordance with the rules given in the C standard. There are various things that cause problems - for example, taking the address of a parameter declared as a va_list (because the parameter type may have been changed from va_list to pointer-to-element-of-va_list as part of the parameter type adjustment of parameters declared as arrays, so the type of ¶meter may not be va_list *).