[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] posible issue on ia64 with va_args.

From: Andrew Suffield
Subject: Re: [Gnu-arch-users] posible issue on ia64 with va_args.
Date: Wed, 10 Mar 2004 10:28:48 +0000
User-agent: Mutt/

On Sat, Mar 06, 2004 at 06:35:43PM +1100, Robert Collins wrote:
> I've found a problem with gcc 3.0.4 (and possibly newer versions)with
> the use of '0' to terminate the arch_call_cmd var_args.
> the problem is with promotion:
> u_char * is not promoted at all according to my va_arg info pages. But
> '0' is being promoted incorrectly, and when accessed by va_arg(ap, char
> *) results in a 0x60000000000 value. (I think I have the right number of
> 0's there) :}.
> Passing 0L as the terminator, or (t_uchar *)0, or NULL works.

Passing an integer in a stdarg list that will be extracted as a
pointer? Yeah, that's wrong, use NULL, that's what it's for. At call
time the compiler doesn't know that it's necessary to promote the
integer to a pointer - there's no signature.

With the notable exception of printf/scanf/strftime (which are
special-cased in any decent compiler), type matching in stdargs lists
is the problem of the programmer and must be handled carefully. That's
why stdarg isn't very useful.

  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' : |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]