public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/14557] va_list is automatically taken address-of when passed as argument
       [not found] <bug-14557-8126@http.gcc.gnu.org/bugzilla/>
@ 2005-12-07 17:12 ` pinskia at gcc dot gnu dot org
  2006-02-15  3:26 ` pinskia at gcc dot gnu dot org
  2006-05-10 15:47 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-07 17:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from pinskia at gcc dot gnu dot org  2005-12-07 17:12 -------
*** Bug 8262 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jkain at nvidia dot com


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
       [not found] <bug-14557-8126@http.gcc.gnu.org/bugzilla/>
  2005-12-07 17:12 ` [Bug target/14557] va_list is automatically taken address-of when passed as argument pinskia at gcc dot gnu dot org
@ 2006-02-15  3:26 ` pinskia at gcc dot gnu dot org
  2006-05-10 15:47 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-15  3:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from pinskia at gcc dot gnu dot org  2006-02-15 03:26 -------
*** Bug 26294 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian-gccbug at penguinhosting
                   |                            |dot net


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
       [not found] <bug-14557-8126@http.gcc.gnu.org/bugzilla/>
  2005-12-07 17:12 ` [Bug target/14557] va_list is automatically taken address-of when passed as argument pinskia at gcc dot gnu dot org
  2006-02-15  3:26 ` pinskia at gcc dot gnu dot org
@ 2006-05-10 15:47 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-10 15:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from pinskia at gcc dot gnu dot org  2006-05-10 15:46 -------
*** Bug 27534 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc at flash-gordon dot me
                   |                            |dot uk


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
                   ` (10 preceding siblings ...)
  2004-03-13 21:55 ` zack at codesourcery dot com
@ 2005-04-11 17:07 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-11 17:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-11 17:07 -------
*** Bug 20951 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sebor at roguewave dot com


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
                   ` (9 preceding siblings ...)
  2004-03-13 20:04 ` jsm at polyomino dot org dot uk
@ 2004-03-13 21:55 ` zack at codesourcery dot com
  2005-04-11 17:07 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 16+ messages in thread
From: zack at codesourcery dot com @ 2004-03-13 21:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at codesourcery dot com  2004-03-13 21:55 -------
Subject: Re:  va_list is automatically taken address-of
 when passed as argument

"jsm at polyomino dot org dot uk" <gcc-bugzilla@gcc.gnu.org> writes:
> The trouble is that in this example you're taking the address of a
> pointer to the first element of the array (namely, the parameter
> declared with the array type va_list which has pointer type because
> of the adjustment of parameter types).

Ah, so what's unportable is taking the address of a va_list which has
been passed to you as a value parameter?  This I can see.

zw


-- 


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
                   ` (8 preceding siblings ...)
  2004-03-13 19:50 ` zack at codesourcery dot com
@ 2004-03-13 20:04 ` jsm at polyomino dot org dot uk
  2004-03-13 21:55 ` zack at codesourcery dot com
  2005-04-11 17:07 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 16+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-03-13 20:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm at polyomino dot org dot uk  2004-03-13 20:04 -------
Subject: Re:  va_list is automatically taken address-of
 when passed as argument

On Sat, 13 Mar 2004, zack at codesourcery dot com wrote:

> &ap should always work; taking the address of an array produces a
> pointer to the array, which has a different type but the same value as
> the pointer to the first element that you get if you don't take the
> address.  You have to write *ap in the callee, is all.

The trouble is that in this example you're taking the address of a pointer
to the first element of the array (namely, the parameter declared with the
array type va_list which has pointer type because of the adjustment of
parameter types).



-- 


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


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

* Re: [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-13 13:28 ` hueffner at informatik dot uni-tuebingen dot de
@ 2004-03-13 19:50   ` Zack Weinberg
  0 siblings, 0 replies; 16+ messages in thread
From: Zack Weinberg @ 2004-03-13 19:50 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs


&ap should always work; taking the address of an array produces a
pointer to the array, which has a different type but the same value as
the pointer to the first element that you get if you don't take the
address.  You have to write *ap in the callee, is all.

As far as I can see the original example is strictly conforming and
the warning should not be issued.

zw


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
                   ` (7 preceding siblings ...)
  2004-03-13 13:28 ` hueffner at informatik dot uni-tuebingen dot de
@ 2004-03-13 19:50 ` zack at codesourcery dot com
  2004-03-13 20:04 ` jsm at polyomino dot org dot uk
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: zack at codesourcery dot com @ 2004-03-13 19:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at codesourcery dot com  2004-03-13 19:50 -------
Subject: Re:  va_list is automatically taken address-of
 when passed as argument


&ap should always work; taking the address of an array produces a
pointer to the array, which has a different type but the same value as
the pointer to the first element that you get if you don't take the
address.  You have to write *ap in the callee, is all.

As far as I can see the original example is strictly conforming and
the warning should not be issued.

zw


-- 


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
                   ` (6 preceding siblings ...)
  2004-03-13 13:22 ` jsm at polyomino dot org dot uk
@ 2004-03-13 13:28 ` hueffner at informatik dot uni-tuebingen dot de
  2004-03-13 19:50   ` Zack Weinberg
  2004-03-13 19:50 ` zack at codesourcery dot com
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 16+ messages in thread
From: hueffner at informatik dot uni-tuebingen dot de @ 2004-03-13 13:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hueffner at informatik dot uni-tuebingen dot de  2004-03-13 13:28 -------
Subject: Re:  va_list is automatically taken address-of
 when passed as argument

"jsm at polyomino dot org dot uk" <gcc-bugzilla@gcc.gnu.org> writes:

> ------- Additional Comments From jsm at polyomino dot org dot uk  2004-03-13 13:22 -------
> There's nothing wrong with using va_list *, the only problem is when
> taking the address of a parameter to do so.
>
> With a variable
>
> va_list ap;
>
> you use &ap to take the address.
>
> With a parameter (subject to array-to-pointer adjustment)
>
>   va_list ap
>
> you use &ap if va_list is not an array type, but ap if it is an
> array type.

Ah, I see. Thanks.



-- 


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
                   ` (5 preceding siblings ...)
  2004-03-13 13:20 ` hueffner at informatik dot uni-tuebingen dot de
@ 2004-03-13 13:22 ` jsm at polyomino dot org dot uk
  2004-03-13 13:28 ` hueffner at informatik dot uni-tuebingen dot de
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-03-13 13:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm at polyomino dot org dot uk  2004-03-13 13:22 -------
Subject: Re:  va_list is automatically taken address-of
 when passed as argument

On Sat, 13 Mar 2004, falk dot hueffner at student dot uni-tuebingen dot de wrote:

> I don't see anything wrong with using "va_list *". The standard even says:

There's nothing wrong with using va_list *, the only problem is when 
taking the address of a parameter to do so.

With a variable

va_list ap;

you use &ap to take the address.

With a parameter (subject to array-to-pointer adjustment)

  va_list ap

you use &ap if va_list is not an array type, but ap if it is an array
type.



-- 


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
                   ` (4 preceding siblings ...)
  2004-03-13 13:13 ` jh at suse dot cz
@ 2004-03-13 13:20 ` hueffner at informatik dot uni-tuebingen dot de
  2004-03-13 13:22 ` jsm at polyomino dot org dot uk
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: hueffner at informatik dot uni-tuebingen dot de @ 2004-03-13 13:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hueffner at informatik dot uni-tuebingen dot de  2004-03-13 13:20 -------
Subject: Re:  va_list is automatically taken address-of
 when passed as argument

"jh at suse dot cz" <gcc-bugzilla@gcc.gnu.org> writes:

> My recollection from last time we were discussing this is that text
> above is an footnote that is not normative and in conflict with rest of
> the standard, so it needs to be ignored.

Okay, let's say we ignore it. Which part of the standard is violated
then?



-- 


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
                   ` (3 preceding siblings ...)
  2004-03-13 12:16 ` falk dot hueffner at student dot uni-tuebingen dot de
@ 2004-03-13 13:13 ` jh at suse dot cz
  2004-03-13 13:20 ` hueffner at informatik dot uni-tuebingen dot de
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: jh at suse dot cz @ 2004-03-13 13:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jh at suse dot cz  2004-03-13 13:13 -------
Subject: Re:  va_list is automatically taken address-of when passed as argument

> 
> ------- Additional Comments From falk dot hueffner at student dot uni-tuebingen dot de  2004-03-13 12:15 -------
> Subject: Re:  va_list is automatically taken address-of
>  when passed as argument
> 
> "zlomek at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
> 
> > ------- Additional Comments From zlomek at gcc dot gnu dot org  2004-03-13 06:10 -------
> > AFAIK it is incorrect to use "va_list *" so the code is wrong.
> 
> I don't see anything wrong with using "va_list *". The standard even says:
> 
>      It is permitted to create a pointer to a va_list and pass that
>      pointer to another function, in which case the original function
>      may make further use of the original list after the other
>      function returns.
> 
> About passing by value it says:

My recollection from last time we were discussing this is that text
above is an footnote that is not normative and in conflict with rest of
the standard, so it needs to be ignored. While I agree that this
behaviour is very unfortuante side effect of va-arg implementation,
there are some other ABIS around (PPC SysV) doing the same so the only
choice now is probably to avoid this construct.

Honza
> 
>      The object ap may be passed as an argument to another function;
>      if that function invokes the va_arg macro with parameter ap, the
>      value of ap in the calling function is indeterminate and shall be
>      passed to the va_end macro prior to any further reference to ap.
> 
> Well, it doesn't invoke va_arg, so that should be fine, too.
> 
> 
> 
> -- 
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14557
> 
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.


-- 


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
                   ` (2 preceding siblings ...)
  2004-03-13  6:10 ` zlomek at gcc dot gnu dot org
@ 2004-03-13 12:16 ` falk dot hueffner at student dot uni-tuebingen dot de
  2004-03-13 13:13 ` jh at suse dot cz
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: falk dot hueffner at student dot uni-tuebingen dot de @ 2004-03-13 12:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From falk dot hueffner at student dot uni-tuebingen dot de  2004-03-13 12:15 -------
Subject: Re:  va_list is automatically taken address-of
 when passed as argument

"zlomek at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

> ------- Additional Comments From zlomek at gcc dot gnu dot org  2004-03-13 06:10 -------
> AFAIK it is incorrect to use "va_list *" so the code is wrong.

I don't see anything wrong with using "va_list *". The standard even says:

     It is permitted to create a pointer to a va_list and pass that
     pointer to another function, in which case the original function
     may make further use of the original list after the other
     function returns.

About passing by value it says:

     The object ap may be passed as an argument to another function;
     if that function invokes the va_arg macro with parameter ap, the
     value of ap in the calling function is indeterminate and shall be
     passed to the va_end macro prior to any further reference to ap.

Well, it doesn't invoke va_arg, so that should be fine, too.



-- 


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
  2004-03-12 16:50 ` [Bug target/14557] " pinskia at gcc dot gnu dot org
  2004-03-12 17:04 ` pinskia at gcc dot gnu dot org
@ 2004-03-13  6:10 ` zlomek at gcc dot gnu dot org
  2004-03-13 12:16 ` falk dot hueffner at student dot uni-tuebingen dot de
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: zlomek at gcc dot gnu dot org @ 2004-03-13  6:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zlomek at gcc dot gnu dot org  2004-03-13 06:10 -------
AFAIK it is incorrect to use "va_list *" so the code is wrong.
va_list is allowed to be something different that a pointer, for example
on ppc64 and x86-64 it is an one element array (builtin type).
Arrays are always passed as a pointer to the first element so there is no
performance penalty.
AFAIK using "&marker" where marker is va_list is wrong too.

See the discussion when we were fixing vasprintf.c from libiberty
http://gcc.gnu.org/ml/gcc-patches/2003-10/msg00219.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jh at suse dot cz
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
  2004-03-12 16:50 ` [Bug target/14557] " pinskia at gcc dot gnu dot org
@ 2004-03-12 17:04 ` pinskia at gcc dot gnu dot org
  2004-03-13  6:10 ` zlomek at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-12 17:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-12 17:04 -------
Andreas said he would take care of it next week.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |aj at suse dot de
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED


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


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

* [Bug target/14557] va_list is automatically taken address-of when passed as argument
  2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
@ 2004-03-12 16:50 ` pinskia at gcc dot gnu dot org
  2004-03-12 17:04 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-12 16:50 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target
           Keywords|                            |diagnostic, rejects-valid


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


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

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

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-14557-8126@http.gcc.gnu.org/bugzilla/>
2005-12-07 17:12 ` [Bug target/14557] va_list is automatically taken address-of when passed as argument pinskia at gcc dot gnu dot org
2006-02-15  3:26 ` pinskia at gcc dot gnu dot org
2006-05-10 15:47 ` pinskia at gcc dot gnu dot org
2004-03-12 16:17 [Bug c/14557] New: " olof dot lindholm at bea dot com
2004-03-12 16:50 ` [Bug target/14557] " pinskia at gcc dot gnu dot org
2004-03-12 17:04 ` pinskia at gcc dot gnu dot org
2004-03-13  6:10 ` zlomek at gcc dot gnu dot org
2004-03-13 12:16 ` falk dot hueffner at student dot uni-tuebingen dot de
2004-03-13 13:13 ` jh at suse dot cz
2004-03-13 13:20 ` hueffner at informatik dot uni-tuebingen dot de
2004-03-13 13:22 ` jsm at polyomino dot org dot uk
2004-03-13 13:28 ` hueffner at informatik dot uni-tuebingen dot de
2004-03-13 19:50   ` Zack Weinberg
2004-03-13 19:50 ` zack at codesourcery dot com
2004-03-13 20:04 ` jsm at polyomino dot org dot uk
2004-03-13 21:55 ` zack at codesourcery dot com
2005-04-11 17:07 ` 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).