------- Comment #3 from adam at consulting dot net dot nz 2010-08-16 23:41 ------- Why is this invalid gnu99 code?
How does one reserve x87 stack values as global register variables so that one may use gnu99 operators such as + upon those global register variables instead of having to resort to inline assembly? Any function that does not contain an x87 operation should definitely compile. Any function with x87 operations that do not push additional stack values should definitely compile. Rejecting st means rejects the top of the x87 stack as a global register variable since st has a dual meaning [Unlike st(1), st(0) is an invalid register name]. You should look at why GCC cannot satisfy compiler constraints for a function that does not contain any x87 operations rather than throwing out the possibility of x87 global register variables. Here's another example of valid gnu99 code: register long double F80a __asm__("st"); register long double F80b __asm__("st(1)"); void x87_add() { F80a += F80b; } int main() { return 0; } This does not ICE at -O3. How does one construct this code if you reject st? Uros Bizjak: It is safe to designate a call-clobbered register as a global register variable so long as the variable is saved when calling (implicit or explicit) library functions ("The register will not be allocated for any other purpose in the functions in the current compilation.") -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45296