------- Comment #5 from ubizjak at gmail dot com  2010-08-17 06:57 -------
(In reply to comment #3)

> 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?

The code does not do what you think should be doing:

x87_add:
.LFB0:
        .cfi_startproc
        flds    .LC0(%rip)
        flds    .LC0(%rip)
        faddp   %st, %st(1)
        flds    .LC0(%rip)
        fstp    %st(0)
        fstp    %st(0)
        ret

I'm testing following patch:

Index: reginfo.c
===================================================================
--- reginfo.c   (revision 163291)
+++ reginfo.c   (working copy)
@@ -798,6 +798,14 @@ fix_register (const char *name, int fixe
 void
 globalize_reg (int i)
 {
+#ifdef STACK_REGS
+  if (IN_RANGE (i, FIRST_STACK_REG, LAST_STACK_REG))
+    {
+      error ("stack register used for global register variable");
+      return;
+    }
+#endif
+
   if (fixed_regs[i] == 0 && no_global_reg_vars)
     error ("global register variable follows a function definition");



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45296

Reply via email to