poldy / OpenCOMAL

OpenCOMAL aims to be a compliant Common COMAL interpreter. It has been tested on Linux and macOS.
http://www.josvisser.nl/opencomal/
GNU General Public License v3.0
21 stars 6 forks source link

PRINT "one"; 2^3 gives error #1

Closed poldy closed 6 years ago

poldy commented 6 years ago

The above gives a "FATAL error: Invalid marker in mem_free()" error.

PRINT 2^3 and PRINT 1; 2^3 work, this is the prnum_list rule in pdcpars.y

For the print_list rule, PRINT "one"; 2+3 and all other arithmetic operators work, I think the difference here is that ^ (powerSYM) is the only %right-associative token.

poldy commented 6 years ago

This is the stack trace:

$ print "1";2^3
1
Breakpoint 1, fatal (s=0x802f3c5 "Invalid marker in mem_free()") at pdcmisc.c:88
88      {
(gdb) bt
#0  fatal (s=0x802f3c5 "Invalid marker in mem_free()") at pdcmisc.c:88
#1  0x000000000801e2ff in mem_free (m=0x85028e0) at pdcmem.c:235
#2  0x0000000008022d2b in val_free (result=0x85028e0, type=V_STRING) at pdcval.c:116
#3  0x00000000080230b8 in val_float (f=8, ptr=0x85028e0, type=0x7ffffffddad4) at pdcval.c:234
#4  0x000000000801c604 in exp_binary_i (op=344, result=0x7ffffffddad8, type=0x7ffffffddad4, v1=0x85028e0,
    v2=0x85028f0) at pdcexp.c:703
#5  0x000000000801d1a7 in exp_binary (exp=0x85022a8, result=0x7ffffffddad8, type=0x7ffffffddad4)
    at pdcexp.c:979
#6  0x000000000801da70 in calc_exp (exp=0x85022a8, result=0x7ffffffddad8, type=0x7ffffffddad4)
    at pdcexp.c:1250
#7  0x000000000801d9b8 in exp_reexp (exp=0x8502268, result=0x7ffffffddad8, type=0x7ffffffddad4)
    at pdcexp.c:1210
#8  0x000000000801da70 in calc_exp (exp=0x8502268, result=0x7ffffffddad8, type=0x7ffffffddad4)
    at pdcexp.c:1250
#9  0x00000000080165dd in print_con (printroot=0x8502368, pr_sep=0) at pdcexec.c:1743
#10 0x0000000008016952 in print_maybe_using (p=0x85021a0) at pdcexec.c:1840
#11 0x0000000008016a47 in exec_print (line=0x8502188) at pdcexec.c:1862
#12 0x0000000008017db9 in exec_line (line=0x8502188) at pdcexec.c:2340
#13 0x000000000802355a in process_comal_line (line=0x8502188) at pdccloop.c:52
#14 0x0000000008023768 in comal_loop (newstate=3) at pdccloop.c:115
#15 0x00000000080238a1 in pdc_go (argc=1, argv=0x7ffffffde088) at pdccloop.c:146
#16 0x000000000800ce5f in main (argc=1, argv=0x7ffffffde088) at pdcmain.c:205
(gdb)
poldy commented 6 years ago

Fixed in commit 0b92e66