[Issue 4298] Constant array translated to unnecessary array literal creation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 8 18:02:28 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4298
Shin Fujishiro <rsinfu at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
--- Comment #1 from Shin Fujishiro <rsinfu at gmail.com> 2010-06-08 18:02:25 PDT ---
Patch against DMD r526:
====================
--- src/optimize.c
+++ src/optimize.c
@@ -58,10 +58,9 @@ Expression *expandVar(int result, VarDeclaration *v)
return e;
}
- Type *tb = v->type->toBasetype();
if (result & WANTinterpret ||
v->storage_class & STCmanifest ||
- (tb->ty != Tsarray && tb->ty != Tstruct)
+ v->type->isscalar()
)
{
if (v->init)
====================
The if condition is changed so that only scalar constants are expanded.
Affected types are Tarray, Taarray, Tclass and Tdelegate. Arrays and
associative arrays should not be expanded (the reported problem); classes and
delegates are not necessary to be expanded.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list