lkml.org 
[lkml]   [2010]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: gcc 4.5.1 / as 2.20.51.0.11 miscompiling drivers/char/i8k.c ?
    On Sun, Nov 14, 2010 at 4:52 PM, James Cloos <cloos@jhcloos.com> wrote:
    > Gcc 4.5.1 running on an amd64 box "cross"-compiling for a P3 i8k fails
    > to compile the module since commit 6b4e81db2552bad04100e7d5ddeed7e848f53b48
    > with:
    >
    >  CC      drivers/char/i8k.o
    > drivers/char/i8k.c: In function ‘i8k_smm’:
    > drivers/char/i8k.c:149:2: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
    > drivers/char/i8k.c:149:2: error: ‘asm’ operand has impossible constraints

    At this point, I think this falls clearly under "unresolvable gcc bug".

    Quite frankly, I think gcc was buggy to begin with: since we had a
    memory clobber, the "+m" (*regs) should not have mattered. The fact
    that "*regs" may be some local variable doesn't make any difference
    what-so-ever, since we took the address of the variable. So the memory
    clobber _clearly_ can change that variable.

    So when Richard Gunther says "a memory clobber doesn't cover automatic
    storage", to me that very clearly spells "gcc is buggy as hell".
    Because automatic storage with its address taken _very_ much gets
    clobbered by things like memset etc. If the compiler doesn't
    understand that, the compiler is just broken.

    And now, if even the (superfluous) "+m" isn't working, it sounds like
    we have no sane options left. Except to say that gcc-4.5.1 is totally
    broken wrt asms.

    Can we just get gcc to realize that when you pass the address of
    automatic storage to an asm, that means that "memory" really does
    clobber it? Because clearly that is the case.

    Linus
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2010-11-15 04:25    [W:5.441 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site