Branch: Tag:

2020-03-14

2020-03-14 08:57:47 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: The type for >32-bit integers is now int.

This should solve issues with strange derived types due to truncation
with eg sprintf(%c).

Fixes #10018.

8134:    case T_INT:    if(s->u.integer) {    type_stack_mark(); -  /* Fixme, check that the integer is in range of MIN_INT32 .. MAX_INT32! -  */ +  /* Check that the integer is in range of MIN_INT32 .. MAX_INT32. */ +  if (((s->u.integer & 0x7fffffff) == s->u.integer) || +  ((s->u.integer | 0x7fffffff) == s->u.integer)) {    push_int_type(s->u.integer, s->u.integer); -  +  } else { +  /* Out of range. Depending on where the integer ends up it may +  * get truncated in various ways. Avoid confusion by reducing +  * the specificity of the type. +  */ +  push_int_type(MIN_INT32, MAX_INT32); +  }    return pop_unfinished_type();    }else{    copy_pike_type(ret, zero_type_string);