[lkml]   [2010]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: gcc 4.5.1 / as miscompiling drivers/char/i8k.c ?
    On Mon, Nov 15, 2010 at 10:30 AM, Jim Bos <> wrote:
    > Attached version with plain 2.6.36 source and version with the committed
    > patch, i.e with the '"+m" (*regs)'

    Looks 100% identical in i8k_smm() itself, and I'm not seeing anything
    bad. The asm has certainly not been optimized away as implied in the
    archlinux thread.

    There are differences, but they are with code generation *elsewhere*.

    To me it is starting to look like the real problem is that gcc has
    decided that the "i8k_smm()" function is "__attribute__((const))".

    Which is clearly totally bogus. If a function has an inline asm that
    has a memory clobber, it is clearly *not* 'const'. But that does
    explain the bug, and does explain why "+m" makes a difference and why
    "noinline" does not.

    So what I _think_ happens is that

    - gcc logic for the automatic 'const' attribute for functions is
    broken, so it marks that function 'const'.

    - since the rule for a const function is that it only _looks_ at its
    attributes and has no side effects, now the callers will decide that
    'i8k_smm()' cannot change the passed-in structure, so they'll happily
    optimize away all the accesses to it.


     \ /
      Last update: 2010-11-15 19:59    [W:0.021 / U:16.168 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site