📄 no.163.mal
字号:
# Monet Mil to Mal compiler# Copyright (c) 2001-2004, CWI. All rights reserved.#Predefined code segment#The compiler can not guarantee an accurate compilation,#because MIL unlike MAL is a dynamically typed language.#A few guidelines to maximize usefullness.#- make the type of variables explicit, in particular 'nil'#- upon advice of M2m to remap identifiers, change it in your program directly#use the "mil_schema" for additional support routines# io.print("# >Number: 163\n");# io.print("# >Category: MIL\n");# io.print("# >Synopsis: multi[lex bug\n");# io.print("# >Confidential: no\n");# io.print("# >Severity: serious\n");# io.print("# >Priority: medium\n");# io.print("# >Responsible: boncz (Peter Boncz)\n");# io.print("# >State: open\n");# io.print("# >Class: sw-bug\n");# io.print("# >Submitter-Id: unknown\n");# io.print("# >Arrival-Date: Mon Jul 20 09:56:02 1998\n");# io.print("# >Originator: manegold@cwi.nl\n");# io.print("# >Organization:\n");# io.print("# >Release: 980101\n");# io.print("# >Environment:\n");# io.print("# any\n");# io.print("# >Description:\n");# io.print("# Tim Ruhl (DDi) reported this bug:\n");# io.print("# \n");# io.print("# The following script fails with \"GDKmalloc called with size 0\".\n");# io.print("# (cf. output below)\n");# io.print("# \n");# io.print("# -8<-----\n");# io.print("# \n");# io.print("# proc tst(BAT[any, int] b) : bat\n");# io.print("# { \n");# io.print("# var i;\n");# io.print("# \n");# io.print("# i := 0;\n");# io.print("# while (i < 2) {\n");# io.print("# b := [+](b, 1);\n");# io.print("# i := i + 1;\n");# io.print("# }\n");# io.print("# \n");# io.print("# return b;\n");# io.print("# }\n");# io.print("# \n");# io.print("# b1 := bat.new(int, int);\n");# io.print("# b1.insert(0, 0);\n");# io.print("# b1.insert(0, 1);\n");# io.print("# \n");# io.print("# bn := tst(b1);\n");# io.print("# bn.print;\n");# io.print("# \n");# io.print("# quit;\n");# io.print("# \n");# io.print("# -8<-----\n");# io.print("# \n");# io.print("# # Monet Database Server V4.0 (IRIX5.3/32bit) of Fri Jul 17 21:30:49 MET DST 1998\n");# io.print("# # Copyright (c) 1993-1998, CWI & SION. All rights reserved.\n");# io.print("# #script:../tim.mil\n");# io.print("# \n");# io.print("# loaded;\n");# io.print("# #---------------------------------#\n");# io.print("# # module | usage_count #\n");# io.print("# #---------------------------------#\n");# io.print("# [ \"kernel\", 1 ]\n");# io.print("# [ \"arith\", 1 ]\n");# io.print("# [ \"bat\", 1 ]\n");# io.print("# [ \"algebra\", 1 ]\n");# io.print("# [ \"sys\", 1 ]\n");# io.print("# [ \"trans\", 1 ]\n");# io.print("# \n");# io.print("# Try: modules; - for other modules.\n");# io.print("# ls; - for persistent bat listing.\n");# io.print("# sigs(\"<module>\") - for available commands per module.\n");# io.print("# help(\"<command>\") - for help one-liner for a command.\n");# io.print("# \n");# io.print("# #You are system administrator (adm)!\n");# io.print("# \n");# io.print("# proc tst(BAT[any, int] b) : bat\n");# io.print("# {\n");# io.print("# var i;\n");# io.print("# \n");# io.print("# i := 0;\n");# io.print("# while (i < 2) {\n");# io.print("# b := [+](b, 1);\n");# io.print("# i := i + 1;\n");# io.print("# }\n");# io.print("# \n");# io.print("# return b;\n");# io.print("# }\n");# io.print("# \n");# io.print("# b1 := bat.new(int, int);\n");# io.print("# b1.insert(0, 0);\n");# io.print("# b1.insert(0, 1);\n");# io.print("# \n");# io.print("# bn := tst(b1);\n");# io.print("# GDKmalloc called with size 0\n");# io.print("# \n");# io.print("# -8<-----\n");# io.print("# \n");# io.print("# As Tim sais, it has probably to do with rewriting the\n");# io.print("# MIL parse tree after the first iteration of the while loop.\n");# io.print("# \n");# io.print("# ========\n");# io.print("# \n");# io.print("# As I just noticed, similar (the same\?) bugs have already been\n");# io.print("# reported in bug reports #117 & #156.\n");# io.print("# \n");# io.print("#\t\tStefan\n");# io.print(""); aa_a := calc.oid(20000000); ba_a := calc.setoid(aa_a);# io.print("");function tst(b:bat[:any_1,:int]):bat[:any_1,:int];# io.print(""); i := 0;# io.print(" i := 0;");barrier ca_a := true;barrier da_a := calc.<(i,2);# io.print(" while (i < 2) {"); b := batcalc.+(b,1);# io.print(" b := [+](b, 1);"); i := calc.+(i,1);# io.print(" i := i + 1;");redo ca_a;exit da_a;exit ca_a;# io.print(""); return ea_a :=b;end tst;# io.print(""); b1 := bat.new(:oid,nil:int); fa_a := bat.insert(b1,0@0,0); ga_a := bat.insert(b1,0@0,1); bn := user.tst(b1); ha_a := io.print(bn); ia_a := clients.quit();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -