c/4152: Incorrect code for va_arg(x,char) and va_arg(x,short) on SH
SchirmerH@innovative-systems.de
SchirmerH@innovative-systems.de
Mon Aug 27 23:46:00 GMT 2001
>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;
}
More information about the Gcc-prs
mailing list