Bug 14710 – VC-built DMD crashes on templated variadic function IFTI
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-06-18T11:57:00Z
Last change time
2017-07-22T12:35:32Z
Keywords
pull
Assigned to
nobody
Creator
dlang-bugzilla
Comments
Comment #0 by dlang-bugzilla — 2015-06-18T11:57:24Z
////////// test.d //////////
void a(T)(T val, T[] arr...)
{
}
void b()
{
a("", "");
}
////////////////////////////
When DMD is built with dmd_msc.vcxproj (in the Release/x64 configuration), it causes an access violation.
This appears to be a regression, introduced in
https://github.com/D-Programming-Language/dmd/pull/4535
Comment #1 by dlang-bugzilla — 2015-06-18T11:59:23Z
When built in the Debug/x64 configuration, the compiler produces the following error:
test.d(7,3): Error: template test.a cannot deduce function from argument types !()(string, string), candidates are:
test.d(1,6): test.a(T)(T val, T[] arr...)
However, this error does not occur when DMD is built by DMC, and the code compiles correctly.
Comment #2 by dlang-bugzilla — 2015-06-18T12:09:47Z
Debug/x64 also started failing after dmd PR#4535.
Comment #3 by dlang-bugzilla — 2015-06-18T12:28:44Z
Same with Release/Win32 and Debug/Win32 as with /x64.
Comment #4 by dlang-bugzilla — 2015-06-18T12:42:16Z
The PR in question moved the "new" operator overload to its own .c file, which was added to the makefiles but not the Visual Studio project files. As a result, Visual Studio builds have been using the normal C++ "new" and "delete" operators. Adding newdelete.c to the VC project files caused the bug to disappear.
It is thus very likely that there exists a use-after-free bug in DMD, but it does not manifest with the "bump-the-pointer" allocator.
Comment #5 by dlang-bugzilla — 2015-06-18T15:05:55Z