Mail Archives: djgpp/2003/04/19/18:03:49
Message-ID: | <0ab801c306bf$4dacb430$0600000a@broadpark.no>
|
From: | "Gisle Vanem" <giva AT bgnett DOT no>
|
To: | "djgpp" <djgpp AT delorie DOT com>
|
Subject: | __builtin_va_list bug?
|
Date: | Sun, 20 Apr 2003 00:02:00 +0200
|
MIME-Version: | 1.0
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Mailer: | Microsoft Outlook Express 6.00.2800.1123
|
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1123
|
Reply-To: | djgpp AT delorie DOT com
|
I'm porting some code from Watcom to gcc/djgpp and encountered
tons of warnings on illegal use of va_arg(). So I cooked up a little
test:
#include <stdarg.h>
char x;
void foo (va_list arg)
{
x = va_arg (arg, char);
}
This gives a warning "`char' is promoted to `int' when passed through `...'"
Fair enough, but when I produce an asm-listing, here's what I get:
.file "test.c"
.section .text
.globl _foo
_foo:
pushl %ebp
movl %esp, %ebp
int $5
.comm _x,16
.ident "GCC: (GNU) 3.2.2"
What's the "int $5" doing there?
Is this a gcc bug or feature? If so, is there a fix?
Using "va_arg (arg,int)" produces the correct code.
As you see, I'm using gcc 3.2.2.
--gv
- Raw text -