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
>Closed-Date:
>Last-Modified:
>Originator:     sb@biallas.net
>Release:        gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3, propolice)
>Organization:
>Environment:
Gentoo Linux 1.4 x86
>Description:
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
>How-To-Repeat:
run 
gcc -S -o cuda.s cuda.i
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="cuda.i"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="cuda.i"

dHlwZWRlZiBfX2J1aWx0aW5fdmFfbGlzdCBfX2dudWNfdmFfbGlzdDsKdHlwZWRlZiBfX2dudWNf
dmFfbGlzdCB2YV9saXN0OwoKdm9pZCBpbnQ1KGludCBuYiwgLi4uKQp7CiAgICAgICAgdmFfbGlz
dCB2YTsKICAgICAgICBfX2J1aWx0aW5fc3RkYXJnX3N0YXJ0KCh2YSksbmIpOwogICAgICAgIGNo
YXIgYiA9IF9fYnVpbHRpbl92YV9hcmcodmEsIGNoYXIpOwogICAgICAgIF9fYnVpbHRpbl92YV9l
bmQodmEpOwp9Cg==



More information about the Gcc-bugs mailing list