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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-23 
13:59:22 UTC ---
Created attachment 22496
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22496
reduced (but no longer executable) testcase

Reduced testcase.  Compiling it with -O2 on x86_64 linux shows (first rdtsc
insn):

#APP
# 151 "pr46598_0.i" 1
        rdtsc
# 0 "" 2
#NO_APP
        movslq  %eax, %rsi
        movl    %edx, %r11d
        movl    PT2(%rip), %r10d
        movl    havege_bigarray(,%rsi,4), %edx

indexing havege_bigarray by %eax as set from rdtsc.

And it all seems to come from

  __asm__ __volatile__("rdtsc":"=A"(havege_hardtick));

with havege_hardtick being 'int' and thus not match up with the register
pair ax/dx.  After regalloc we have

(insn 167 166 18672 20 pr46598_0.i:3512 (parallel [
            (set (reg:SI 1 dx)
                (asm_operands/v:SI ("rdtsc") ("=A") 0 []
                     []
                     [] pr46598_0.i:9761))
            (clobber (reg:QI 18 fpsr))
            (clobber (reg:QI 17 flags))
        ]) -1 (nil))

and nobody noticed we also clobber ax.  havege_hardtick isn't a proper
lvalue of a 64bit type either.

So - I think this PR is invalid.  Sort-of.

Reply via email to