Branch: Tag:

2008-05-14

2008-05-14 16:02:05 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Don't allow promotion of naked void to zero in strict types mode.
Fixes [bug 3085 (#3085)].

Rev: src/pike_types.c:1.334
Rev: src/pike_types.h:1.116

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: pike_types.c,v 1.333 2008/05/11 22:40:11 mast Exp $ + || $Id: pike_types.c,v 1.334 2008/05/14 16:02:04 grubba Exp $   */      #include "global.h"
6211:    */       case T_OR: -  if (!(tmp = low_new_check_call(fun_type, arg_type->car, flags, sval))) { +  if (!(tmp = low_new_check_call(fun_type, arg_type->car, +  flags | CALL_WEAK_VOID, sval))) {    if (flags & CALL_STRICT) {    return NULL;    }    arg_type = arg_type->cdr;    goto loop;    } -  if (!(tmp2 = low_new_check_call(fun_type, arg_type->cdr, flags, sval))) { +  if (!(tmp2 = low_new_check_call(fun_type, arg_type->cdr, +  flags | CALL_WEAK_VOID, sval))) {    if (flags & CALL_STRICT) {    free_type(tmp);    return NULL;
6231:    return res;       case T_AND: -  if (!(tmp = low_new_check_call(fun_type, arg_type->car, flags, sval))) { +  if (!(tmp = low_new_check_call(fun_type, arg_type->car, +  flags & ~CALL_WEAK_VOID, sval))) {    return NULL;    } -  if (!(tmp2 = low_new_check_call(fun_type, arg_type->cdr, flags, sval))) { +  if (!(tmp2 = low_new_check_call(fun_type, arg_type->cdr, +  flags & ~CALL_WEAK_VOID, sval))) {    free_type(tmp);    return NULL;    }
6245:       case T_VOID:    if (!(flags & CALL_7_6)) { +  if ((flags & (CALL_WEAK_VOID|CALL_STRICT)) == CALL_STRICT) { +  return NULL; +  }    /* Promote void arguments to zero. */    arg_type = zero_type_string;    }    break;    }    -  if (!(tmp = lower_new_check_call(fun_type, arg_type, flags, sval +  if (!(tmp = lower_new_check_call(fun_type, arg_type, +  flags & ~CALL_WEAK_VOID, sval   #ifdef PIKE_TYPE_DEBUG    , 0   #endif