pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:1:   /*   || 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.242 2005/02/04 10:47:53 grubba Exp $ + || $Id: pike_types.c,v 1.243 2005/02/05 20:54:25 grubba Exp $   */      #include "global.h"   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"   #include "stralloc.h"   #include "stuff.h"   #include "array.h"   #include "program.h"
pike.git/src/pike_types.c:336:    int flag_method)   {    unsigned INT32 hash = DO_NOT_WARN((unsigned INT32)    ((ptrdiff_t)type*0x10204081)^    (0x8003*PTR_TO_INT(car))^    ~(0x10001*PTR_TO_INT(cdr)));    unsigned INT32 index = hash % pike_type_hash_size;    struct pike_type *t;       /* PIKE_DEBUG code */ +  if (type & ~255) { +  /* The bad type node on OSF/1 seems to be: +  * +  * type: 0xffff +  * car: valid pointer. +  * cdr: 0x400000000 +  * next: 0x100000000 +  */ +  Pike_fatal("Attempt to create an invalid type node: %d(%s)\n" +  " car: %p\n" +  " cdr: %p\n", +  type, get_name_of_type(type), +  car, cdr); +  }    if (index >= pike_type_hash_size) {    Pike_fatal("Modulo operation failed for hash:%u, index:%u, size:%u.\n",    hash, index, pike_type_hash_size);    }    /* End PIKE_DEBUG code */       for(t = pike_type_hash[index]; t; t = t->next) {   #ifdef PIKE_EXTRA_DEBUG -  if ((type == T_FUNCTION) && (car->type == T_STRING)) { +  if ((type == T_FUNCTION) && +  (car->type == T_STRING) && +  (cdr->type == T_FUNCTION) && +  (cdr->car->type == T_STRING) && +  (cdr->cdr->type == T_MULTI) && +  (cdr->cdr->car->type == T_VOID) && +  (cdr->cdr->cdr->type == T_STRING)) {    /* Attempt to detect why we get a core-dump on OSF/1 -  * when loading Unicode.so from test_resolv +  * when loading Unicode.so from test_resolv. +  * +  * The problem triggs when the type for normalize() is created. +  * function(string,string:string)    * /grubba 2005-02-04    */ -  fprintf(stderr, " %s:%d:PIKE_EXTRA_DEBUG:\n" -  " t: %p\n", +  fprintf(stderr, +  " %s:%d:PIKE_EXTRA_DEBUG:\n" +  " t: %p\n",    __FILE__, __LINE__,    t); -  fprintf(stderr, " t->type:%d (%s)\n" -  "t->car: %p (%p)\n" -  "t->cdr: %p (%p)\n", +  fprintf(stderr, +  " t->type:%d (%s)\n" +  " t->car: %p (%p)\n" +  " t->cdr: %p (%p)\n" +  " t->next:%p\n",    t->type, get_name_of_type(t->type),    t->car, car, -  t->cdr, cdr); +  t->cdr, cdr, +  t->next);    }   #endif /* PIKE_EXTRA_DEBUG */    if ((t->hash == hash) && (t->type == type) &&    (t->car == car) && (t->cdr == cdr)) {    /* Free car & cdr as appropriate. */    switch(type) {    case T_FUNCTION:    case T_MANY:    case T_TUPLE:    case T_MAPPING: