[dmd-internals] [D-Programming-Language/dmd] 502fd5: Set return type of lazy void delegates to void
GitHub via dmd-internals
dmd-internals at puremagic.com
Sat Jan 31 02:46:55 PST 2015
Branch: refs/heads/master
Home: https://github.com/D-Programming-Language/dmd
Commit: 502fd53028407a6107be3760e8c48f3d95a841fa
https://github.com/D-Programming-Language/dmd/commit/502fd53028407a6107be3760e8c48f3d95a841fa
Author: Johannes Pfau <johannespfau at gmail.com>
Date: 2015-01-31 (Sat, 31 Jan 2015)
Changed paths:
M src/delegatize.c
M src/expression.c
M src/expression.h
Log Message:
-----------
Set return type of lazy void delegates to void
Before this commit the delegates generated for lazy void parameters
returned the type of the wrapped expression. Example:
void test(lazy void a) {}
test(new Object()); //The generated delegate returns Object
The delegate calling code however expects a delegate with no
return value. Usually the result of the lazy func delegate is returned
in a register. As a function may modify the result register internally
even if defined with void return type this never causes problems and the
value is ignored.
For bigger aggregate types (on ARM already >4byte) the result is written
onto the stack and this requires an additional hidden parameter passed
to the delegate.
But as the delegate is called as void(...) the additional parameter is
never initialized and whatever is in the argument register is passed
into the function and used as the location were the result will be
written ==> memory corruption.
Commit: b4f0403e7dce280e83f2c902f2a5020dd25dec14
https://github.com/D-Programming-Language/dmd/commit/b4f0403e7dce280e83f2c902f2a5020dd25dec14
Author: Hara Kenji <k.hara.pg+dev at gmail.com>
Date: 2015-01-31 (Sat, 31 Jan 2015)
Changed paths:
M src/delegatize.c
M src/expression.c
M src/expression.h
Log Message:
-----------
Merge pull request #4360 from jpf91/gdc
Set return type of lazy void delegates to void [GDC] [ARM]
Compare: https://github.com/D-Programming-Language/dmd/compare/f1b6d1386480...b4f0403e7dce
More information about the dmd-internals
mailing list