GCC Error: extended registers have no high halves

354 views Asked by At

I am trying to compile a 64bit C library using gcc-4.9.1. While compiling with -O2, I am getting the following error at different places. -O0 compilation works fine.

Error:
error: extended registers have no high halves

Any idea why this error message is coming and how to fix it. The line number it points to is the end of the function.

The compiler options are :

 -march=x86-64 -fno-omit-frame-pointer -m64 -Wno-pointer-sign
 -Wno-error=address -ggdb -gdwarf-2 -g2 -feliminate-unused-debug-types 
1

There are 1 answers

2
perror On

It seems that this error has been added in this patch:

+   /* Irritantingly AMD extended registers use different naming convention
+      from the normal registers.  */
+   if (REX_INT_REG_P (x))
+   {
+       switch (code)
+     {
+     case 5:
+       error ("Extended registers have no high halves\n");
+       break;
+     case 1:
+       fprintf (file, "r%ib", REGNO (x) - FIRST_REX_INT_REG + 8);
+       break;
+     case 2:
+       fprintf (file, "r%iw", REGNO (x) - FIRST_REX_INT_REG + 8);
+       break;
+     case 4:
+       fprintf (file, "r%id", REGNO (x) - FIRST_REX_INT_REG + 8);
+       break;
+     case 8:
+       fprintf (file, "r%i", REGNO (x) - FIRST_REX_INT_REG + 8);
+       break;
+     default:
+       error ("Unsupported operand size for extended register.\n");
+       break;
+      }
+       return;
+   }

Try to recompile without the option -march=x86-64.