add_ssaaaa and C++
Gabriel Dos Reis
gdr at integrable-solutions.net
Mon May 23 00:44:15 CEST 2005
Emmanuel Thomé <Emmanuel.Thome at inria.fr> writes:
| On Sun, May 22, 2005 at 01:14:54PM +0200, Torbjorn Granlund wrote:
| >
| > I think this was made with the idea to make sure we'd get the
| > right instruction variants even it the macro is fed with smaller
| > types.
| >
| > But that reasoning really doesn't make sense. And we don't seem
| > to be casting lvalues in other places in longlong.h.
| > Furthermore, modern gcc pukes on code trying a non-noop lvalue
| > cast:
| >
| > /home/tege/addas.c: In function `foo':
| > /home/tege/addas.c:9: error: invalid lvalue in asm statement
| > /home/tege/addas.c:9: error: invalid lvalue in asm statement
|
| right. the nasty thing is that with g++, casting int& to long& in an asm
| output, even though these types have the same width on i386, gives no
| warning but produces rubbish code. Marvelous.
You can rant as you like but, the compiler is just doing its job of
following instructions. The cast is understood as
reinterpret_cas<long&>(lvalue_oftype_int) -- which in C speak would be
(long *) (expression with type int*).
Now, do you want the compiler warn that too?
-- Gaby
More information about the gmp-bugs
mailing list