linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
To: Jim Terman <terman@ddi.com>, linuxppc-dev@lists.linuxppc.org
Subject: Re: problem with short in va_arg list with 2.95.1 gcc
Date: Sat, 8 Jan 2000 03:27:25 +0100	[thread overview]
Message-ID: <00010803312300.31253@enzo.bigblue.local> (raw)
In-Reply-To: <200001072251.OAA13463@sade.ddi.com>


Am Fre, 07 Jan 2000 schrieb Jim Terman:
>I am having a problem with code that looks for type short in a va_arg list
>when optimization is turned on.  There is no problem with no optimization.
>It compiles fine but produces an undefined reference to `__va_arg_type_violation'
>which I assume is delibrate to flag an error.  Is there a workaround besides
>turning off optimizations?
>
>If I compile the following file:
>test.c
>------
>#include <stdarg.h>
>#include <stdio.h>
>
>void printout(short d, ...)
>{
>  va_list arglist;
>
>  printf("%d ", d);
>  d = va_arg (arglist, short);
>  while (d)
>    {
>      printf("%s ", d);
>      d = va_arg (arglist, short);
>    }
>}
>
>int main()
>{
>  printout(1, 2, 0);
>  printout(2, 3,  4, 0);
>  return 0;
>}

There's no such thing like va_arg(arglist, short) in standard C, you can only
use default promotion types and typedef's thereof. So you have to use (short)
va_arg(arglist, int) here.

Franz.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

      parent reply	other threads:[~2000-01-08  2:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-07 22:51 problem with short in va_arg list with 2.95.1 gcc Jim Terman
2000-01-08  2:19 ` Daniel Jacobowitz
2000-01-08  2:27 ` Franz Sirl [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00010803312300.31253@enzo.bigblue.local \
    --to=franz.sirl-kernel@lauterbach.com \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=terman@ddi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).