Skip to content
Tcl Source Code History Of Ticket 26f1328a86
Login

History Of Ticket 26f1328a86

Artifacts Associated With Ticket 26f1328a86

  1. Ticket change [4a1768d3de] (rid 196947) by anonymous on 2022-01-07 16:13:04:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      I'm having fun trying to port Tcl to Plan 9 at the moment.
      
      One early problem was that Tcl crashed as soon as I was executing
      anything, like "parray env".  Debugging the problem, it turns out that
      there is a problem in the bytecode interpreter.  This is quite similar
      to #2796438 on AIX, it might be the same issue.
      
      The bytecode interpreter uses the macro TclGetInt1AtPtr to read an
      offset from the bytecode.  These offsets can be negative Problem is
      that the result of that macro is an unsigned int, despite the name.
      Adding a huge unsigned number to a pointer instead of a small negative
      signed is of course not healthy unless you can count on wrap-around.
      But on Plan9/amd64, sizeof(int) == 4 and sizeof(void*) == 8.
      
      The attached path fixes this.  Sorry that this patch is made against
      the Git mirror, I hope that is ok.
      
    5. foundin initialized to: "8.7a6"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "11198a4027193b80a694e66a04403b2c879b1f6f"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "anonymous"
    14. subsystem initialized to: "53. Configuration and Build Tools"
    15. title initialized to: "sizeof(int) < sizeof(void*) -> Crash"
    16. type initialized to: "Bug"
  2. Add attachment "0001-generic-tclCompile.h-TclGet-Int-AtPtr-Fix-casts.patch" [70ee304936] (rid 196948) by anonymous on 2022-01-07 16:14:06.

  3. Ticket change [6fa2573931] (rid 196972) by anonymous on 2022-01-12 13:00:35:

    1. icomment:
      Some more information:
      
      The problem originates in JUMP_PEEPHOLE_F (tclExecute.c:317), where
      TclGetInt4AtPtr(pc+1)) is calculated and than added to pc in
      NEXT_INST_F (tclExecute.c:246).  The bytes at the incoming pc+1 are
      0xFF,0xFF,0xFD,0xBC, which is supposed to mean -580.
      
      The attached test program exercises this.  The result on Linux/amd64
      is
      
          $ gcc -o ts test-signed-tcl.c && ./ts
          12 -> U:0
          12U -> U:1
          -12 -> U:0
          int(bytes): -580 U:0
          ptr: 0x55c79ab8f135 + int(bytes) -> 0x55c79ab8eef1 (diff:-580)
      
      The result on Plan 9 (9front/amd64) is:
      
          term% pcc -o tsp test-signed-tcl.c && tsp
          12 -> U:0
          12U -> U:1
          -12 -> U:0
          int(bytes): -580 U:1
          ptr: 0x200028 + int(bytes) -> 0x1001FFDE4 (diff:4294966716)
      
    2. login: "anonymous"
    3. mimetype: "text/plain"
    4. username: "[email protected]"
  4. Add attachment "test-signed-tcl.c" [d3564d3320] (rid 196973) by anonymous on 2022-01-12 13:01:28.

  5. Ticket change [fbc02301e9] (rid 196974) by anonymous on 2022-01-12 13:07:07:

    1. icomment:
      > result of that macro is an unsigned int, [...]
      > But on Plan9/amd64, sizeof(int) == 4 and sizeof(void*) == 8.
      
      Actually, my initial analysis was wrong regarding the reason for this.
      The sizeofs are the same on Linux/amd64.  Still the macro returns an
      int on Linux, but an unsigned int on Plan 9, and that *is* actually
      the underlying problem.
      
    2. login: "anonymous"
    3. mimetype: "text/plain"
    4. username: "[email protected]"
  6. Ticket change [652010c131] (rid 196978) by jan.nijtmans on 2022-01-12 14:21:13:

    1. assignee changed to: "jan.nijtmans"
    2. icomment:
      Proposed fix committed [7178b3b4397d5c8c|here]. Looks good, but first let's see what Github ACTIONS thinks of it.
      
      Thanks for the report and the patch!
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
    5. resolution changed to: "Fixed"
    6. status changed to: "Pending"
  7. Ticket change [bfd50a2dae] (rid 197092) by jan.nijtmans on 2022-01-14 22:52:58:

    1. closedate changed to: "2459594.453452"
    2. closer changed to: "jan.nijtmans"
    3. login: "jan.nijtmans"
    4. mimetype: "text/plain"
    5. status changed to: "Closed"
  8. Ticket change [e7f9725d9f] (rid 197095) by anonymous on 2022-01-15 13:26:03:

    1. closedate changed to: "2459595.05976521"
    2. closer changed to: "anonymous"
    3. icomment: "Thanks, Jan."
    4. login: "anonymous"
    5. mimetype: "text/plain"