Bug 12848 – [REG2.061] crash in _d_run_main() on some unicode command line argument (Win32)
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-06-03T23:24:00Z
Last change time
2014-07-12T16:31:34Z
Keywords
pull
Assigned to
nobody
Creator
mk
Comments
Comment #0 by mk — 2014-06-03T23:24:56Z
I get a crash in Druntime in _d_run_main() function when I supply a command line argument like 'ěě' (several same accented characters).
This is on Windows (XP 32bit), dmd 2.065.
The crash or exception occurs in alloca function here:
https://github.com/D-Programming-Language/druntime/blob/2.065/src/rt/dmain2.d#L345
Console codepage settings (chcp 852 or 65001) doesn't matter;
Program source code doesn't matter, empty main() is enough. I know there are problems with Unicode support in Windows console, but this needs some workaround.
Comment #1 by mk — 2014-06-04T23:05:58Z
https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L303
Actually this assert fails, because argc contains wrong number of arguments (wargc is right). argc is set before C main(), where startup code calls GetCommandLineA and then _setargv, which fails to recognize correctly number of arguments. Also argv string is in the Windows charset at this stage.
So the solution seem to be either to fix the startup code or to "fix" argc and argv later using windows API W functions.