[Bug target/14557] va_list is automatically taken address-of when passed as argument

jh at suse dot cz gcc-bugzilla@gcc.gnu.org
Sat Mar 13 13:13:00 GMT 2004


------- 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



More information about the Gcc-bugs mailing list