Artifacts Associated With Ticket 0f14b45adc1932e4
Ticket change [086ae725df] (rid 140167) by anonymous on 2014-10-07 05:53:15:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
I was trying to compile an open source program on windows 64bit. the program needs at least 64bit TCL libraries so I have build tcl85 static and dynamic libraries. And seems to work ok. Then I compiled my program which was also ok during compile time with no error or warning . I created the executables and when I try to run my program the program crashes in startup at a Tcl_SetVar statement with memory access violation error. I have put a zip file of the debugable executable here: http://gpiutmd.iut.ac.ir/vmd/MYVMD.rar for reproducing the error you should extract the rar file to an empty folder (it was originally on C:\temp\MYVMD in my computer) and run the vmd_WIN64.exe. it has the required pdb files for debugging. I compiled the program using a 64bit VS2008 with the latest updates and service pack, and tried to fix the error about 1 week but no chance. The only thing I guess is making the problem is the assembly translation of the code which I think is making the problem (maybe there is a bug in VS2008 compile optimization which in my opinion makes a pointer problem). any help would be appreciated. BTW If anyone thinks I should download the ready and compiled libraries of TCL 8.5 from tcl.tk instead of making them myself I should say, I have done this and the same problem persists. I also guess that I should try to build the TCL with a special kind of compiler flag to disable optimization but I don't know how I should do that in its windows makefile.vc, if my previous guess is right. And also most important to this, the very same program works fine with 32bit compilation (also 32bit tcl). I have checked it. Please help me (of course in detail) what should I do? cheers
- foundin initialized to: "8.5.16"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- private_contact initialized to: "12b9ce977ab964cb0c83efe506f18bba88b144ab"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "69. Other"
- title initialized to: "A bug in Tcl 64bit libraries"
- type initialized to: "Bug"
Ticket change [d03825e866] (rid 140168) by ekd123 on 2014-10-07 12:17:58:
- icomment:
Tested on Win 8.1 x64. Output: Failed to find registry key in 64-bit registry. Falling back in desparation for 32-bit registry key... Complete and total failure finding any usable registry key. Guessing VMD location from default 32-bit install directory Failed to find registry key. Backtrace: > vmd_WIN64.exe!TclTextInterp::TclTextInterp(VMDApp * vmdapp, int guienabled, int mpienabled) Line 155 C++ vmd_WIN64.exe!UIText::UIText(VMDApp * vmdapp, int guienabled, int mpienabled) Line 78 C++ vmd_WIN64.exe!VMDApp::VMDinit(int argc, char * * argv, const char * displaytype, int * displayLoc, int * displaySize) Line 435 C++ vmd_WIN64.exe!main(int argc, char * * argv) Line 49 C++ vmd_WIN64.exe!__tmainCRTStartup() Line 266 C vmd_WIN64.exe!mainCRTStartup() Line 182 C Debugger recognized an access to NULL.
- login: "ekd123"
- mimetype: "text/plain"
- icomment:
Ticket change [419f9b3e2c] (rid 140169) by dgp on 2014-10-07 13:53:01:
- icomment:
If the problem has been isolated to a Tcl_SetVar() call, then copy and paste that call and all relevant code nearby, such as that code that controls the state of the arguments passed in to it. You say the crash is at startup. Does your program successfully call Tcl_FindExecutable() ? How about Tcl_Init() ? These are things embedders often overlook.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [8fb9f9dd34] (rid 140170) by dgp on 2014-10-07 14:08:15:
- icomment:
It might also help if you report precisely what Tcl sources you are using. A URL is the best identifier.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [030a8c80c5] (rid 140171) by dgp on 2014-10-07 14:12:05:
- icomment:
Is there any chance that this call to Tcl_SetVar() passes the TCL_APPEND_VALUE flag? If so, please see the Tcl 8.5.16 release notes and http://core.tcl.tk/tcl/tktedit?name=7368d225a6
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [7d4c0dfba0] (rid 140172) by anonymous on 2014-10-07 14:26:57:
- icomment:
Hi every body and thanks for the replies. I forget to add the source files. I am sorry. you can download the source files from: http://gpiutmd.iut.ac.ir/vmd/vmd.rar the source contents was originally on this folder (c:\temp\VMD\vmd) on my computer. I should add you can find the file TclTextInterp.C in the src folder. the app crashes at line 155. The registry errors are not really important. you can silent them by adding this registry (also note to use your own path to the vmd_WIN64.exe): [HKEY_LOCAL_MACHINE\SOFTWARE\University of Illinois\VMD\1.9.2] "VMDDIR"="C:\\Temp\\MYVMD" I am currently working on your responses. many thanks in advance.
- login: "anonymous"
- mimetype: "text/plain"
- icomment:
Ticket change [d86df93da2] (rid 140173) by anonymous on 2014-10-07 14:30:10:
- icomment:
Hi every body and thanks for the replies. I forget to add the source files. I am sorry. you can download the source files from: http://gpiutmd.iut.ac.ir/vmd/vmd.rar the source contents was originally on this folder (c:\temp\VMD\vmd) on my computer. I should add you can find the file TclTextInterp.C in the src folder. the app crashes at line 155. The registry errors are not really important. you can silent them by adding this registry (also note to use your own path to the vmd_WIN64.exe): [HKEY_LOCAL_MACHINE\SOFTWARE\University of Illinois\VMD\1.9.2] "VMDDIR"="C:\\Temp\\MYVMD" I am currently working on your responses. many thanks in advance.
- login: "anonymous"
- mimetype: "text/plain"
- icomment:
Ticket change [a0c1bcb84a] (rid 140174) by anonymous on 2014-10-07 14:34:51:
- icomment:
And also the TCL source I used: http://prdownloads.sourceforge.net/tcl/tcl8516-src.zip
- login: "anonymous"
- mimetype: "text/plain"
- icomment:
Ticket change [ecb9513e8a] (rid 140175) by dgp on 2014-10-07 16:27:23:
- icomment:
So what specifically goes wrong on line 155? Is something invalid about the value app->argv_m[0] ?
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [f27def3e5b] (rid 140176) by anonymous on 2014-10-07 19:38:54:
- icomment:
The question is as you said. The app->argv_m[0] has no problem. In debug mode it has a value (which is the path to where VMD had been run from) it is also a const char * , and when you look at the disassembly you see that the register is destroying itself. I'm not an experienced programmer but I think there is a problem with VS2008 utilizing TCL libraries or vice versa. I fyou think the problem is somewhere else please explain it more. Thanks a lot
- login: "anonymous"
- mimetype: "text/plain"
- icomment:
Ticket change [67048ddd6b] (rid 140177) by dgp on 2014-10-08 02:56:28:
- icomment:
Precisely what are all the arguments to Tcl_SetVar() when it fails? Do not refer me to debuggers. I am not on your platform.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [7f7e841484] (rid 140190) by anonymous on 2014-10-08 11:10:06:
- icomment:
Hi again The exact statement: Tcl_SetVar(interp, "argv0", app->argv_m[0], TCL_GLOBAL_ONLY); interp is an interpreter initialized in previous lines and its pointers and values are valid. app->argv_m[0] is a const char * with the following text value it points to: "C:/temp/MYVMD/vmd_WIN64.exe" and as I have told you before there is no problem to the app->argv_m[0] pointer or its value.
- login: "anonymous"
- mimetype: "text/plain"
- icomment:
Ticket change [b7a381695c] (rid 140191) by dgp on 2014-10-08 11:48:27:
- icomment:
Is there any regression information that might help? As in, does this same code build and run successfully with other releases of Tcl? If your speculation is correct that this is really the effects of a broken toolchain, there's only so much that we can do. I think I've reached the end of what I can do. Leaving the ticket open for some other dev to pick up.
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [049ca48f9b] (rid 140194) by apnadkarni on 2014-10-08 16:58:03:
- icomment:
I believe that you are compiling your modules with different preprocessor flags (nothing to do with Tcl). Stepping through the disassembled code (will not be visible at C level) of TclTextInterp::TclTextInterp, the offset to argv_m member in the object is 0x68. This value is NULL and hence the crash. The initialization of argv_m happens in VMDApp::VMDApp where it is initialized at offset 0x60 (NOT 0x68). Looking at the definition of the VMDApp class, there are a couple of #defines wrapping members. My guess is one of these is not defined when you are compiling VMDApp but defined for TclTextInterp. Hence the inconsistency. Do not look at the debugger symbol values. Those assume compilation with consistent flags and hence will not show true state. Look at the actual memory dump. BTW, if you look at the contents of argcbuf[] a few lines before the crash, you will see a bogus value has been sprintf'ed into the buffer for the same reason. /Ashok
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [f1c19617b1] (rid 140247) by anonymous on 2014-10-10 11:45:33:
- closedate changed to: "2456940.98997427"
- closer changed to: "anonymous"
- icomment:
Thanks for your analysis. That was my fault. The problem was the compiling flags. Cheers
- login: "anonymous"
- mimetype: "text/plain"
- status changed to: "Closed"
Ticket change [d4ae847497] (rid 140248) by jan.nijtmans on 2014-10-10 12:08:05:
- closedate changed to: "2456941.00562174"
- closer changed to: "jan.nijtmans"
- login: "jan.nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Invalid"