c/10719: invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);

sb@biallas.net sb@biallas.net
Fri May 9 21:33:00 GMT 2003

>Number:         10719
>Category:       c
>Synopsis:       invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 09 20:36:01 UTC 2003
>Originator:     sb@biallas.net
>Release:        gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3, propolice)
Gentoo Linux 1.4 x86
When using 

char b = __builtin_va_arg(va, char);

gcc incorrectly generates an "int $5" in assembly (x86).

(I know, that this is bad code and I should use "int" instead of "char)

Extract from disassembly:

pushl   %ebp
movl    %esp, %ebp
subl    $8, %esp
leal    12(%ebp), %eax
movl    %eax, -4(%ebp)
int     $5

This is obviously plain wrong.

This is reproduceable with versions 3.2.2 and 3.2.3 but not with 3.2.1
gcc -S -o cuda.s cuda.i

Content-Type: application/octet-stream; name="cuda.i"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="cuda.i"


More information about the Gcc-bugs mailing list