public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: SchirmerH@innovative-systems.de
To: gcc-gnats@gcc.gnu.org
Subject: c/4152: Incorrect code for va_arg(x,char) and va_arg(x,short) on SH
Date: Mon, 27 Aug 2001 23:46:00 -0000	[thread overview]
Message-ID: <20010828064325.15223.qmail@sourceware.cygnus.com> (raw)

>Number:         4152
>Category:       c
>Synopsis:       Incorrect code for va_arg(x,char) and va_arg(x,short) on SH
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 27 23:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     SchirmerH@innovative-systems.de
>Release:        unknown-1.0
>Organization:
>Environment:
Reading specs from /gcc-3.0.1-sh/lib/gcc-lib/sh-hitachi-coff/3.0.1/specs
Configured with: ../gcc-3.0.1/configure --verbose --target=sh-hitachi-coff --pre
fix=/gcc-3.0.1-sh --enable-haifa
Thread model: single
gcc version 3.0.1
>Description:
GCC 3.0.1 emmits a warning compiling the attached source.

To justify this warning it also produces incorrect code

_test_char_char:
	mov	#0,r1
	mov.b	@r1,r1
	exts.b	r6,r6
	cmp/eq	r6,r1
	rts	
	movt	r0
	.align 1
	.global	_test_char_short
_test_char_short:
	mov	#0,r1
	mov.w	@r1,r1
	exts.w	r6,r6
	cmp/eq	r6,r1
	rts	
	movt	r0
	.ident	"GCC: (GNU) 3.0.1"

a null pointer access is created.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="chk_stdarg2.c"
Content-Disposition: inline; filename="chk_stdarg2.c"

#include <stdarg.h>

int test_char_char(int a, int b, char ok, int what, ...)
{
    char value;
    va_list m;
    va_start(m,what);
    value = va_arg(m, char);
    va_end(m);
    return value == ok;
}

int test_char_short(int a, int b, short ok, int what, ...)
{
    short value;
    va_list m;
    va_start(m,what);
    value = va_arg(m, short);
    va_end(m);
    return value == ok;
}


             reply	other threads:[~2001-08-27 23:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-27 23:46 SchirmerH [this message]
2001-08-28  1:12 sirl

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=20010828064325.15223.qmail@sourceware.cygnus.com \
    --to=schirmerh@innovative-systems.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).