This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/23422] Sign extension removed even when inline assembly uses variable
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Aug 2005 14:16:24 -0000
- Subject: [Bug c/23422] Sign extension removed even when inline assembly uses variable
- References: <20050816140329.23422.anton@samba.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-16 14:16 -------
This is not a bug.
The code you gave is equivalant to as that is what inlining does (3.4 had a bug in that it had an extra
overhead as you noticed, which you thought was a feature):
#define BUG_ON(x) asm volatile("tdnei %0,0" : : "r" (x));
int foo;
void baz()
{
BUG_ON(foo+1);
}
So it will pick the SImode (32bit part) for the "r" selector. If you want the BUG_ON to take a signed
extended (DImode) for the "r", use something like the following:
#define BUG_ON(x) asm volatile("tdnei %0,0" : : "r" ((long long)x));
static inline int bar(int val)
{
return val + 1;
}
int foo;
void baz()
{
BUG_ON(bar(foo));
}
That will both work on 3.4 and 4.0.0 with no asm changes in both.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23422