This Space for Rent

Idle hands are the devil’s tools.

After going to the trouble of redoing a bunch of inline assembly (my implementation of string.h for Mastodon libc) from the gcc 2.7.x format (the last point where the spill field in asm() worked for register args?) to the gcc 2.>7 format, it's most annoying to try compiling this code on a Mac, only to have my attempt be rudely thwarted by gcc whining that it "can't find a register in class 'BREG' while reloading 'asm'" when it tries to compile something as trivial as

memccpy(void* dest,const void* src,int ch,size_t siz)
    register void *res;
    if ( /*dest && src &&*/ siz ) {
           " stosb\n"
           " cmpb %%al, %%bl\n"
           " je 2f\n"
           " dec %%ecx\n"
           " jne 1b\n"
            : "=D" (res), "=c" (siz)
            : "S" (src), "D" (dest), "b" (ch), "c" (siz) );
        if (siz) return res;
    return NULL;

It's not as if the FSF is fucking with the Standard™ again here; asm() is a member of the family of extensions that are not guaranteed to be compatable between point releases, let alone major version changes, but, um, How can you not find a register here? It's not as if someone has come in and taken %ebx, %ecx, %edi, or %esi off to the home for redundant data areas. Can't they just use the (ahem) stack, which is the traditional handy spot to stash copies of registers just in case useland messes with them?

Yes, I can (and I will) just write the offending modules as pure assembly, but it does spoil my half-baked attempt to include the testcases in the source module, and I can't help but think that the FSF would have been better off putting

|     ME?     |
|             |
|    %ebx     |
|             |
|GCC 3.4.  IF |
|GCC CORE     |
|TEAM.        | 
|             |

Onto cartons of milk in Silicon Valley and other places where compiler writers tend to congregate.