rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: Decklin Foster <decklin@red-bean.com>
To: rc@hawkwind.utcs.toronto.edu
Subject: va_arg and short
Date: Fri, 29 Dec 2000 22:47:05 -0500
Message-ID: <20001229214705.A13372@sanpietro.red-bean.com> (raw)

rc 1.6b2 fails to compile on linux/ppc/gcc2.95.2/glibc2.2. The problem
is in print.c line 107:

    n = va_arg(format->args, short);

This code is incorrect, because a short argument to a variadic
function will go through argument promotion and become an int. I am
told that GCC 3 will refuse to compile this on any architecture, not
just ppc.

The patch below removes the short case and adds an explanatory note.

--- print.c.orig        Fri Dec 29 22:34:45 2000
+++ print.c     Fri Dec 29 22:39:33 2000
@@ -103,9 +103,7 @@
        if (flags & FMT_long)
                n = va_arg(format->args, long);
-       else if (flags & FMT_short)
-               n = va_arg(format->args, short);
-       else
+       else /* short and int are both promoted to int */
                n = va_arg(format->args, int);
        pre = 0;

things change.

                 reply	other threads:[~2000-12-30  3:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

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

  git send-email \
    --in-reply-to=20001229214705.A13372@sanpietro.red-bean.com \
    --to=decklin@red-bean.com \
    --cc=rc@hawkwind.utcs.toronto.edu \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

rc-list - mailing list for the rc(1) shell

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/rc-list

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 rc-list rc-list/ https://inbox.vuxu.org/rc-list \
	public-inbox-index rc-list

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git