public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: sb@biallas.net
To: gcc-gnats@gcc.gnu.org
Subject: c/10719: invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);
Date: Fri, 09 May 2003 20:36:00 -0000	[thread overview]
Message-ID: <20030509203401.20482.qmail@sources.redhat.com> (raw)


>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==


             reply	other threads:[~2003-05-09 20:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-09 20:36 sb [this message]
2003-05-09 20:46 Andrew Pinski
2003-05-12  3:03 rth
2003-05-12 13:56 sbiallas
2003-05-12 14:46 Joseph S. Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030509203401.20482.qmail@sources.redhat.com \
    --to=sb@biallas.net \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).