------- Comment #40 from ubizjak at gmail dot com  2009-09-30 08:12 -------
(In reply to comment #39)

> > static tree
> > build_function_type_list_1 (bool vaargs, tree return_type, va_list argp)
> 
> Passing va_list by value is non-portable.  One fix here is to pass argp
> by reference.  Dunno if that fixes this problem though, since the main
> problem for Alpha seems to be the stdarg thing.

Regarding non-portability of va-arg, I have found an interesting explanation at
[1] which I qoute here for reference:

<quote>
If you go on to more complex cases than asked and shown, one thing
that is *not* well defined is using the same va_list in the caller
after the callee returns. In particular, it is not specified by the
Standard whether va_list is an array type and hence passed "by
reference" (that is, by decayed pointer) and shared, or a type like a
pointer or struct that is passed by value and not shared. If this is
an issue, pass an explicit pointer (and dereference) to force sharing,
or in C99 only use va_copy and a second va_list, in either the caller
or callee, to prevent it.
</quote>

I don't think that sharing is the problem in this particular case, since we
just call va_end after va_list is passed to the function.

[1] http://www.velocityreviews.com/forums/t317863-valist-usage.html


-- 


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

Reply via email to