[GHC] #14677: Code generator does not correctly tag a pointer

GHC ghc-devs at haskell.org
Wed Jan 17 20:36:23 UTC 2018


#14677: Code generator does not correctly tag a pointer
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:  14626
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by heisenbug):

 Replying to [comment:6 alexbiehl]:
 > Gabor, I am on OSX. Can you tell me where your code lives and what your
 build settings are? I will try to reproduce.

 Looks like it is a CAF in OS X:
 {{{
 Watchpoint 1 hit:
 old value: 4420539208
 new value: 4420538632
 Process 92235 stopped
 * thread #1: tid = 0xc753fd, 0x00000001077b525e libHSrts_thr-
 ghc8.5.20180103.dylib`newCAF(reg=<unavailable>, caf=0x00000001037286b8) +
 142 at Storage.c:429, queue = 'com.apple.main-thread', stop reason =
 watchpoint 1
     frame #0: 0x00000001077b525e libHSrts_thr-
 ghc8.5.20180103.dylib`newCAF(reg=<unavailable>, caf=0x00000001037286b8) +
 142 at Storage.c:429
    426      bh = lockCAF(reg, caf);
    427      if (!bh) return NULL;
    428
 -> 429      if(keepCAFs)
    430      {
    431          // Note [dyn_caf_list]
    432          // If we are in GHCi _and_ we are using dynamic libraries,
 (lldb)
 Process 92235 resuming
 Process 92235 stopped
 * thread #1: tid = 0xc753fd, 0x00000001077babc8 libHSrts_thr-
 ghc8.5.20180103.dylib`checkTagged, queue = 'com.apple.main-thread', stop
 reason = breakpoint 1.1
     frame #0: 0x00000001077babc8 libHSrts_thr-
 ghc8.5.20180103.dylib`checkTagged
 libHSrts_thr-ghc8.5.20180103.dylib`checkTagged:
 ->  0x1077babc8 <+0>: testb  $0x7, %bl
     0x1077babcb <+3>: jne    0x1077babe3               ; <+27>
     0x1077babcd <+5>: subq   $0x8, %rsp
     0x1077babd1 <+9>: leaq   0x165a4(%rip), %rdi       ; "NOT TAGGED! "
 (lldb) p/x $rbx
 (unsigned long) $8 = 0x00000001037286b8
 (lldb) watchpoint list
 Number of supported hardware watchpoints: 4
 Current watchpoints:
 Watchpoint 1: addr = 0x1037286b8 size = 8 state = enabled type = w
     old value: 4420539208
     new value: 4420538632
 (lldb) dis -s 4420538632
 libHSrts_thr-ghc8.5.20180103.dylib`stg_IND_STATIC_info:
     0x1077c1108 <+0>:  movq   0x8(%rbx), %rbx
     0x1077c110c <+4>:  andq   $-0x8, %rbx
     0x1077c1110 <+8>:  jmpq   *(%rbx)
     0x1077c1112 <+10>: adcb   %al, (%rax)
     0x1077c1114 <+12>: addb   %al, (%rax)
     0x1077c1116 <+14>: nop

 libHSrts_thr-ghc8.5.20180103.dylib`stg_BLACKHOLE_info_dsp:
     0x1077c1118 <+0>:  addl   %eax, (%rax)
     0x1077c111a <+2>:  addb   %al, (%rax)
     0x1077c111c <+4>:  addb   %al, (%rax)
     0x1077c111e <+6>:  addb   %al, (%rax)
     0x1077c1120 <+8>:  addb   %al, %es:(%rax)
     0x1077c1123 <+11>: addb   %al, (%rax)
     0x1077c1125 <+13>: addb   %al, (%rax)
 (lldb) dis -s 4420538632+16
 libHSrts_thr-ghc8.5.20180103.dylib`stg_BLACKHOLE_info_dsp:
     0x1077c1118 <+0>:  addl   %eax, (%rax)
     0x1077c111a <+2>:  addb   %al, (%rax)
     0x1077c111c <+4>:  addb   %al, (%rax)
     0x1077c111e <+6>:  addb   %al, (%rax)
     0x1077c1120 <+8>:  addb   %al, %es:(%rax)
     0x1077c1123 <+11>: addb   %al, (%rax)
     0x1077c1125 <+13>: addb   %al, (%rax)
     0x1077c1127 <+15>: addb   %cl, -0x75(%rax)

 libHSrts_thr-ghc8.5.20180103.dylib`stg_BLACKHOLE_info:
     0x1077c112a <+2>:  orb    %bpl, -0x37af0f9(%r8)
     0x1077c1131 <+9>:  addb   %al, (%rax)
     0x1077c1133 <+11>: addb   %cl, -0x75(%rax)
 (lldb) p/x $rbx
 (unsigned long) $10 = 0x00000001037286b8
 }}}

 So it is probably another bug that is easier to trigger on OS X.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14677#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list