[Bug inline-asm/11925] segment violation due to incorrect operand constraints
jbeulich at novell dot com
gcc-bugzilla@gcc.gnu.org
Mon Aug 18 06:37:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11925
------- Additional Comments From jbeulich at novell dot com 2003-08-18 06:37 -------
Compiled with -O2, the following code results in an instruction "xchgb %sil,%ax"
to be emitted with 3.3.1. The SEGV has been masked by a re-arrangement of
hi_reg_name to follow qi_high_reg_name between 3.2.2 and 3.3.1. Still, a proper
error message would be the real solution of the problem (under the assumption
that the re-arrangement was done to mask this problem).
static inline unsigned wswap(unsigned x) {
__asm__("xchgb %b0,%h0" : "+r" (x));
return x;
}
unsigned test(unsigned n) {
unsigned i, s = 0;
for(i = 0; i < n; ++i)
s += wswap(s) + wswap(i);
return s + wswap(n);
}
More information about the Gcc-bugs
mailing list