public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/10719: invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);
@ 2003-05-12 13:56 sbiallas
0 siblings, 0 replies; 5+ messages in thread
From: sbiallas @ 2003-05-12 13:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/10719; it has been noted by GNATS.
From: sbiallas@online-club.de
To: rth@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
nobody@gcc.gnu.org, sb@biallas.net, gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: c/10719: invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);
Date: Mon, 12 May 2003 15:46:55 +0200 (MEST)
>Not a bug. This is in fact a feature. As you
note, the code
>is bad and you should use "int". There is no
sensible code
>that could be generated.
I can't agree with this: gcc shouldn't generate
invalid code on purpose. It knows there is an
error and should generate an error and not a
warning. The warning is misleading (it sounds like
gcc found a problem and corrected it) and will
probably not recognized.
With the same attitude you could easily allow
instantiating a class with abstract functions and
segv when an abstract function is called.
Additionally "int $5" is a very bad way of
indicating bad code. This would for example
trigger a "print screen" on DOS or could even be a
syscall on other systems.
Regards,
Sebastian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: c/10719: invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);
@ 2003-05-12 14:46 Joseph S. Myers
0 siblings, 0 replies; 5+ messages in thread
From: Joseph S. Myers @ 2003-05-12 14:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/10719; it has been noted by GNATS.
From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: sbiallas@online-club.de
Cc: rth@gcc.gnu.org, gcc-bugs@gcc.gnu.org, sb@biallas.net,
gcc-gnats@gcc.gnu.org
Subject: Re: c/10719: invalid code generated (x86, "int $5") with
__builtin_va_arg(va, char);
Date: Mon, 12 May 2003 15:45:24 +0100 (BST)
On Mon, 12 May 2003 sbiallas@online-club.de wrote:
> I can't agree with this: gcc shouldn't generate
> invalid code on purpose. It knows there is an
> error and should generate an error and not a
> warning. The warning is misleading (it sounds like
> gcc found a problem and corrected it) and will
> probably not recognized.
Please read the response to Defect Report #109. This code only yields
undefined behavior if it is ever executed, and it might not be, so GCC
must not yield an error. To quote the response:
A conforming implementation must not fail to translate a strictly
conforming program simply because _some_ possible execution of that
program would result in undefined behavior.
http://std.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_109.html
--
Joseph S. Myers
jsm28@cam.ac.uk
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: c/10719: invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);
@ 2003-05-12 3:03 rth
0 siblings, 0 replies; 5+ messages in thread
From: rth @ 2003-05-12 3:03 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, sb
Synopsis: invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);
State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Mon May 12 03:03:24 2003
State-Changed-Why:
Not a bug. This is in fact a feature. As you note, the code
is bad and you should use "int". There is no sensible code
that could be generated.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10719
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: c/10719: invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);
@ 2003-05-09 20:46 Andrew Pinski
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Pinski @ 2003-05-09 20:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/10719; it has been noted by GNATS.
From: Andrew Pinski <pinskia@physics.uc.edu>
To: sb@biallas.net
Cc: Andrew Pinski <pinskia@physics.uc.edu>, gcc-gnats@gcc.gnu.org
Subject: Re: c/10719: invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);
Date: Fri, 9 May 2003 16:43:05 -0400
va_arg(va, char) is not valid code so it could produce anything, gcc
use `int $5' on x86 to make sure you know it is not valid.
So you said it is not valid, it gives you a warning also so that is the
correct behavior aka not a bug.
Can someone close this PR.
Thanks,
Andrew Pinski
^ permalink raw reply [flat|nested] 5+ messages in thread
* c/10719: invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);
@ 2003-05-09 20:36 sb
0 siblings, 0 replies; 5+ messages in thread
From: sb @ 2003-05-09 20:36 UTC (permalink / raw)
To: gcc-gnats
>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==
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-05-12 14:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-12 13:56 c/10719: invalid code generated (x86, "int $5") with __builtin_va_arg(va, char); sbiallas
-- strict thread matches above, loose matches on Subject: below --
2003-05-12 14:46 Joseph S. Myers
2003-05-12 3:03 rth
2003-05-09 20:46 Andrew Pinski
2003-05-09 20:36 sb
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).