[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PSPP-BUG: [bug #62267] Debian 1.5.4-2: Regression fails for test 521, 52

From: Friedrich Beckmann
Subject: PSPP-BUG: [bug #62267] Debian 1.5.4-2: Regression fails for test 521, 522, 525, 528 on mips64el, mipsel, ia64
Date: Sun, 10 Apr 2022 06:16:22 -0400 (EDT)

Follow-up Comment #1, bug #62267 (project pspp):

I think he reason for regression failure for some architectures is a bug in
the handling of system-missing values in the expression processing.

The expression handling code is generated via generate.py.

The result for the "replace" function is

case OP_REPLACE_sssn:
    struct substring arg_haystack = get_string_arg (node, 0);
    struct substring arg_needle = get_string_arg (node, 1);
    struct substring arg_replacement = get_string_arg (node, 2);
    int arg_n = get_number_arg (node, 3);
    return expr_allocate_string (e, eval_OP_REPLACE_sssn (arg_haystack,
arg_needle, arg_replacement, arg_n, e));


The result type of "get_number_arg" is double. The result of "get_number_arg"
is cast to the integer variable "arg_n". However if the argument of
get_number_arg is for example "1.5" as in the test szenario, then this is
converted to system-missing here in the generated "evaluate.h" file:

static inline double 
eval_OP_NUM_TO_INTEGER (double x, struct expression *e, const struct expr_node
  if (x == floor (x) && x > INT_MIN && x <= INT_MAX)
    return x;

  msg_at (SE, expr_location (e, n),
          _("Treating unexpected non-integer value %g as missing."), x);
  return SYSMIS;

which results in the system-missing value which is defined as -DBL_MAX,
something -10**308. A cast of a double type to integer that cannot be
represented is undefined. So here this happens.

This handling of integer is done systematiclly. I guess code like this:

case OP_DATE_DMY_nnn:
    int arg_d = get_number_arg (node, 0);
    int arg_m = get_number_arg (node, 1);
    int arg_y = get_number_arg (node, 2);
    bool force_sysmis = !is_valid (arg_d) || !is_valid (arg_m) || !is_valid
    double result = force_sysmis ? SYSMIS : eval_OP_DATE_DMY_nnn (arg_d,
arg_m, arg_y, e, node);
    return expr_allocate_number (e, result);

from optimize.inc will not work either, because the get_number_arg is cast to
int and then the int result is checked with "is_valid" where the parameter is
double again. 


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]