[Issue 5798] Weakly pure function calls skipped inside a comma	expression
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue Apr 19 13:01:26 PDT 2011
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=5798
timon.gehr at gmx.ch changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
           Severity|normal                      |major
--- Comment #2 from timon.gehr at gmx.ch 2011-04-19 12:57:50 PDT ---
I changed importance to mayor, because this also affects some compiler
rewrites, and the fix is trivial.
Eg:
int weakly_pure_function(out param)pure{...}
1^^weakly_pure_function(param), will be optimized away to
(weakly_pure_function(param),1) and then only 1, without setting the param.
This bug exists because the compiler incorrectly assumes that a weakly pure
function has no side effects.
Suggested fix:
in expression.c, function CallExp::checkSideEffect, replace
(~line 7278)
-     if (t->ty == Tfunction && ((TypeFunction *)t)->purity)
-         return 0;
by
+     if (t->ty == Tfunction && ((TypeFunction *)t)->purity > PUREweak)
+         return 0;
-- 
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