Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 95bac0ca5f82a0f10d335116e92dd4911bd035a1
Ticket: c383ebb5e414458cd386e6016e59f693e3840e81
"glob -path a" core dumps instead of argument error
User & Date: dah on 2016-06-14 23:48:38
Changes

  1. icomment:
    Ok, in case anyone is interested, it doesn't crash when compiled with gcc due to an optimization where it reuses local variable storage. There is a DString "pref" initialization done before the code block triggering the crash with MSVC, and that same storage is reused later for DString "str" (with gcc).
    
    Below is essentially what is happening and shouldn't crash with gcc either, but does with MSVC:
    
    #include <tcl.h>
    #include <stdio.h>
    int main (int argc, char *argv[]) {
            if (1) {
                    Tcl_DString one;
                    Tcl_DStringInit(&one);
                    Tcl_DStringFree(&one);
            }
            if (2) {
                    /* Should crash, but gcc saves the day! two -> one */
                    Tcl_DString two;
                    Tcl_DStringFree(&two);
            }
    }
    
    
    This isn't a Windows only bug, I suspect it will manifest itself with other compilers.
    
  2. login: "dah"
  3. mimetype: "text/plain"
  4. username: "dah"