Opened 9 years ago

Last modified 3 years ago

#80 new defect

ALM crashes on syntax error

Reported by: charles.unix.pro@… Owned by: Eric Swenson
Priority: minor Milestone: No Milestore
Component: Tools Version: MR12.6f
Keywords: alm Cc:

Description

pr crash1.alm

crash1.alm 08/22/17 1950.2 pst Tue

dec foo

foo: end

r 19:50 0.052 11

alm crash1
ALM 8.14

Error: illegal_procedure condition by decevl_$|572
(>system_library_standard>bound_alm_)
referencing any_to_any_|1224 (>system_library_1>bound_library_wired_|46576)

r 19:50 0.109 1 level 2

Change History (4)

comment:1 by canthony, 7 years ago

Seen again:

pr -nhe a.alm
main:dec *+1
end
r 14:35 0.030 0

alm a
ALM 8.14

Error: illegal_procedure condition by decevl_$|427
(>system_library_standard>bound_alm_)
referencing any_to_any_|1206 (>system_library_1>bound_library_wired_|46560)

comment:2 by Eric Swenson, 5 years ago

Milestone: MR12.6fMR12.8

comment:3 by Gary Dixon, 5 years ago

Attempting to compile the program with an unbound alm, and decevl_ compiled with -table shows where in decevl_ the problem is occurring:

Error:  illegal_procedure condition by >udd>m>gd>w>alm>decevl_|660 (line 256)
referencing any_to_any_|1224 (>system_library_1>bound_library_wired_|46576)

r 21:11 0.738 1 level 2

pb
Condition illegal_procedure raised at assign_|710023 (level 8).
sk all
 14          command_processor_ (pl1)
 13          abbrev_processor (pl1)
 12          release_stack (pl1)
 11          unclaimed_signal (pl1)
 10          wall (pl1)
  9          any_other.2 (pl1)
  8.3        signal_ (pl1)
  8.2        return_to_ring_0_ (ring 0) (Other)
  8.1        assign_                                       illegal_procedure
  8          decevl_ (line 256) (pl1)
  7          pass1_ (line 1037) (pl1)
  6          alm_ (pl1)
  5          alm (pl1)
  4          command_processor_ (pl1)
  3          abbrev_processor (pl1)
  2          listen_ (pl1)
  1          initialize_process_ (pl1)

Line 256 of decevl_ is the statement:

      call assign_ (addr (x (1)), 2 * real_flt_bin_2_dtype, 63, addr (buffer),
                    2 * real_flt_dec_9bit_dtype, prec);

The final 3 arguments are a pointer to the source numeric string to be converted, its descriptor data type, and its precision. Unfortunately, when being asked to convert the numeric string "foo" to a floating point number, decevl_ found no digits in "foo" and therefore is passing in a prec (precision of the input string) of 0.

v prec
prec = 0

The input string to be converted is in the buffer variable, which the program overlays with a structure called number:

          declare 1 number               aligned based (addr (buffer)),
                    2 sign               char (1) unal,
                    2 digit              (prec) char (1) unal,
                    2 skip               bit (1) unal,
                    2 exponent           fixed bin (7) unal;

v addr(buffer)->number
number
  sign = "+"
Warning: extent 1 of number.sign.digit is zero.
  digit (1) = "\000"
  skip = "0"b
  exponent = 0

Note that the number structure has invalid content because the dimension of the number.digit array is 0 (because prec = 0).

Needless to say, assign_ is being told it is receiving a real float decimal 9-bit data type (in other words a float decimal (prec) data variable where 0 precision is invalid. It therefore encounters an error while trying to evaluate this bogus input.

A proper fix for this problem might require that decevl_ (or even significant parts of the ALM compiler) to be totally rewritten to parse input into tokens, so it can recognize and properly diagnose invalid inputs. It could then use assign_ (or PL/I convert) to actually convert the numeric strings to an arithmetic data type;, or else diagnose an input string that contains no digits, only the letters "foo".

In fact decevl_ stops reading input letters when it sees the "f" in "foo". That's why prec = 0. So it never sees the entire operand for the dec operator.

comment:4 by Eric Swenson, 3 years ago

Milestone: MR12.8No Milestore
Note: See TracTickets for help on using tickets.