Apologies for the non-minimality of the test-case, but this is a smidge weird.

The changes made in b2d25e "Compiler: Improved soundness of the
op-assign optimizer" seem to have broken this:

//Should print ({ }) to stdout and return 0, because the array should
end up empty.
//This is what happens in 7.8 on Windows.
//In the latest 8.0, the first removal fails, so it shows ({ "a" })
and returns 1.
array(string) arr=({"a","b","c"});

int main()
{
    add_constant("G",this);
    compile_string("void x() {string z=\"a\"; G->arr-=({z});}")()->x();
    compile_string("void x() {string z=\"b\"; G->arr=G->arr-({z});}")()->x();
    compile_string("void x() {G->arr-=({\"c\"});}")()->x();
    write("%O\n",arr);
    return sizeof(arr);
}


In theory, the three forms of element removal ought to be equivalent,
but the first one doesn't seem to be functional. I'm afraid the
details are a bit beyond me - the optimizer isn't something I'm
familiar with. All I know is, bisection points to that commit, and
reverting it on top of 8.0 makes the above script work correctly.
Sorry for the vagueness.

ChrisA

Reply via email to