This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Bug c++/21699] New: asm and cast-to-reference -> bad code



On May 21, 2005, at 11:48 AM, thome at lix dot polytechnique dot fr wrote:


The code below is an attempt at having the macro add_ssaaaa from GNU
MP accepted by G++. I am casting the outputs of the asm statement to
unsigned int& (in GMP, USItype is unsigned int + attrib SI, which are the
same on i386).


First, I'd like to be told if this is not a reasonable thing to do. I
think it is, but I'm not too sure.

The problem is that g++ 3.4.x produces wrong code at -O2 level for this.
The asm produced has no trace of the two tests at the end (it must,
really). No warning is issued.

You are violating C++ aliasing rules. You are accessing a long variable as an int.

Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]