Branch: Tag:

2020-10-16

2020-10-16 13:52:19 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Fixed infinite loop in low_type_binop().

There was a break statement that was intended to break a loop,
but instead broke a switch. Replaced with a goto.

Also adds a missing break.

4527:       while(1) {    /* Invariant: -  * a->type and b->type are either T_FUNCTION or T_MANY. +  * ai->type and bi->type are either T_FUNCTION or T_MANY.    */    enum pt_cmp_flags avoidable = 0;    enum pt_cmp_flags bvoidable = 0;
4555:    } else {    goto function_fail;    } -  } +  } else {    push_finished_type(tmp);    free_type(tmp); -  +  }       if (avoidable && bvoidable) {    /* Time to check the return types. */
4592:    got_full = 1;    } else {    free_type(tmp); -  break; +  goto complex_function;    }    free_type(tmp);    if (got_empty) goto function_next;
4632:    default:    Pike_fatal("Unsupported.\n");    } +     function_next:    -  +  if (avoidable && bvoidable) break; +     /* Advance to the next argument. */    if (ai->type == T_FUNCTION) {    ai = ai->cdr;
4655:    }    }    +  complex_function: +     nargs = pop_stack_mark();    if (op != PT_BINOP_AND) {    nargs = 0;
5125:    return NULL;    }    } +  break;    case PT_BINOP_MINUS:    if (!b->cdr) {    return NULL;