Branch: Tag:

2013-07-13

2013-07-13 09:22:43 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Fixed over optimization in __INIT().

Constant expressions that have external dependencies that
evaluate to zero should not be removed, since they may
get overloaded later.

Also fixes forward refering constants like in the Calendar module:

program Foo = cFoo;
class cFoo {
// ...
}

Fixes [LysLysKOM 20361227]/Pike mailinglist 13656.

Thanks to Chris Angelico <rosuav@gmail.com> for the report.

1707:    }    expr0    { -  if (!TEST_COMPAT(7, 8) && is_const($5) && !Pike_compiler->num_parse_error) { +  if (!TEST_COMPAT(7, 8) && ($5) && is_const($5) && +  !($5->tree_info & OPT_EXTERNAL_DEPEND) && +  !Pike_compiler->num_parse_error) {    /* Attempt to evaluate it to see if it is zero,    * in which case we can throw it away.    *