public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/4152: Incorrect code for va_arg(x,char) and va_arg(x,short) on SH
@ 2001-08-27 23:46 SchirmerH
  0 siblings, 0 replies; 2+ messages in thread
From: SchirmerH @ 2001-08-27 23:46 UTC (permalink / raw)
  To: gcc-gnats

>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;
}


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c/4152: Incorrect code for va_arg(x,char) and va_arg(x,short) on SH
@ 2001-08-28  1:12 sirl
  0 siblings, 0 replies; 2+ messages in thread
From: sirl @ 2001-08-28  1:12 UTC (permalink / raw)
  To: SchirmerH, gcc-bugs, gcc-prs, nobody

Synopsis: Incorrect code for va_arg(x,char) and va_arg(x,short) on SH

State-Changed-From-To: open->closed
State-Changed-By: sirl
State-Changed-When: Tue Aug 28 01:12:22 2001
State-Changed-Why:
    The C code is invalid (thus the warning), please resubmit (if the problem persists) with valid C, eg.
    
    value = (char) va_arg (m, int);
    

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4152&database=gcc


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-08-28  1:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-27 23:46 c/4152: Incorrect code for va_arg(x,char) and va_arg(x,short) on SH SchirmerH
2001-08-28  1:12 sirl

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).