This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/23422] New: Sign extension removed even when inline assembly uses variable
- From: "anton at samba dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Aug 2005 14:03:33 -0000
- Subject: [Bug c/23422] New: Sign extension removed even when inline assembly uses variable
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When using the recent debian 4.0 build (gcc version 4.0.2 20050806 (prerelease)
(Debian 4.0.1-4)) I had some problems with a 64bit kernel.
A cut down test case is:
#define BUG_ON(x) asm volatile("tdnei %0,0" : : "r" (x));
static inline int bar(int val)
{
return val + 1;
}
int foo;
void baz()
{
BUG_ON(bar(foo));
}
gcc 3.4 sign extends before passing it to the inline assembly:
.baz:
ld 11,.LC0@toc(2)
lwa 9,0(11)
addi 9,9,1
extsw 9,9
tdnei 9,0
But gcc 4.0 has removed the sign extension:
.baz:
ld 11,.LC0@toc(2)
lwz 9,0(11)
addi 9,9,1
tdnei 9,0
gcc 4.0 does get it right with -fno-inline.
--
Summary: Sign extension removed even when inline assembly uses
variable
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: anton at samba dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23422