4820 – Regression(1.058, 2.044) in DStress caused by changeset 452

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4820 - Regression(1.058, 2.044) in DStress caused by changeset 452
Summary: Regression(1.058, 2.044) in DStress caused by changeset 452
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Linux
: P2 regression
Assignee: No Owner
URL:
Keywords:
: 4304 (view as issue list)
Depends on: 4440
Blocks:
Show dependency tree / graph
Reported: 2010年09月05日 09:14 UTC by siegelords_abode
Modified: 2015年06月09日 05:10 UTC (History)
4 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description siegelords_abode 2010年09月05日 09:14:10 UTC
Changeset 452 that was used to solve bug 2935 causes 4 regressions in the DStress test suite. The tests that now fail are the following:
run/l/lazy_02_A.d
run/l/lazy_02_B.d
run/l/lazy_02_C.d
run/l/lazy_02_D.d
The first one, for example is:
bool nextis(void delegate() dgpositive = {}) {
	return true;
}
bool looping(lazy bool condition) {
	return true;
}
int main() {
	looping(nextis());
	return 0;
}
and when compiled with DMD1.063 yields:
test.d(1): Error: cannot inline default argument __dgliteral1
Comment 1 Don 2010年09月06日 00:44:52 UTC
Thanks for the superb bug report!
Reduced test case shows it's nothing to do with lazy:
void nextis(void delegate() dg = {}) {}
void main() {
 nextis();
}
This is failing because function/delegate literals cannot be inlined. Prior to svn 452, that wasn't being checked in the special case where they were default parameters. Until bug 2935 was fixed, default values were created in the same scope as the function declaration. That was a disaster for structs, but might be OK for function literals -- not sure. Here's an example which used to compile, but now fails, which never used global scope.
void main() {
 int x = 27;
 int nextis(int delegate() dg = { return x; }) { return dg(); }
 ++x;
 assert(nextis() == 28);
}
Comment 2 Don 2010年09月13日 23:57:27 UTC
*** Issue 4304 has been marked as a duplicate of this issue. ***
Comment 3 Don 2010年09月14日 00:02:29 UTC
Although this particular case used to work, it was very fragile.
Calling nextis() directly from main() never worked.
This whole feature probably won't correctly until delegate literals can be inlined.
Comment 4 github-bugzilla 2012年03月02日 21:28:41 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/06e98272f690cf79444b797d2de021ee7eb4a186
fix Issue 4820 - Regression(1.058, 2.044) in DStress caused by changeset 452
Comment 5 github-bugzilla 2012年03月02日 22:19:06 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/415e48ac4703ffab94cd6ce5a3211625099c637a
fix Issue 4820 - Regression(1.058, 2.044) in DStress caused by changeset 452


AltStyle によって変換されたページ (->オリジナル) /