[Issue 2682] const struct initialized with struct literal recreates value on stack when used

2009-03-29 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2682





--- Comment #3 from kamm-removet...@incasoftware.de  2009-03-29 04:50 
---
Removing that optimization lead to constant folding issues. Instead we have now
demoted struct literals to rvalues in LDC. It does not create any regressions
in our testsuite - please let us know if you expect this to be trouble.


-- 



[Issue 2682] const struct initialized with struct literal recreates value on stack when used

2009-03-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2682





--- Comment #2 from to...@famolsen.dk  2009-03-02 21:46 ---
I fixed this in LDC by disabling the Initializer - Expression optimization for
StructInitializerS:

--- a/dmd/optimize.cTue Mar 03 02:51:21 2009 +0100
+++ b/dmd/optimize.cTue Mar 03 04:38:49 2009 +0100
@@ -46,7 +46,7 @@
 if (e1-op == TOKvar)
 {  VarExp *ve = (VarExp *)e1;
VarDeclaration *v = ve-var-isVarDeclaration();
-   if (v  v-isConst()  v-init)
+   if (v  v-isConst()  v-init  !v-init-isStructInitializer())
{   Expression *ei = v-init-toExpression();
if (ei  ei-type)
e1 = ei;


-- 



[Issue 2682] const struct initialized with struct literal recreates value on stack when used

2009-02-22 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2682


s...@iname.com changed:

   What|Removed |Added

 CC||s...@iname.com




--- Comment #1 from s...@iname.com  2009-02-22 09:08 ---
This reminds me of bug 2414 ... related?


--