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]

[Bug inline-asm/11925] segment violation due to incorrect operand constraints


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);
}


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