[Issue 12095] Wrong code with -O -inline

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 7 06:51:46 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12095



--- Comment #6 from yebblies <yebblies at gmail.com> 2014-02-08 01:51:43 EST ---
Don and Walter, since you're both here: I would really like a green light on
refactoring inside interpret.c

(and here's the comment I forgot to post half an hour ago)

Reduced, this just requires -O

void vfunc();

void fun(int k)
{
    int e = 0;
    e ? k || assert(0) : !e || vfunc();
}

void main()
{
    fun(0);
}

Any expression of this form will trigger it:

(something that the optimizer can find is 0, but the constfolder can't) ?
(binary expression that can't be reduced) :
(expression that gets reduced to NULL by the optimizer)

e1 and e2 can be swapped too, with appropriate changes to the condition

eg
e ? k || assert(0) : e && vfunc();
!e ? !e || vfunc() : k || assert(0);

I've fixed this by returning when OPcolon has NULL children, and allowing
el_selecte1/e2 to pick a child that is NULL.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list