Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /bugs/trunk/bugs.0201-0400
ViewVC logotype

Annotation of /bugs/trunk/bugs.0201-0400

Parent Directory Parent Directory | Revision Log Revision Log


Revision 944 - (view) (download)

1 : macqueen 944 Number: 201
2 :     Title: funny tycon aliasing behavior
3 :     Keywords: types, modules
4 :     Submitter: John Reppy
5 :     Date: 8/18/89
6 :     Version: 0.33
7 :     Transcript
8 :     Standard ML of New Jersey, Version 0.33, 1 April 1989
9 :     val it = () : unit
10 :     - structure A = struct datatype foo = Bar of int end
11 :     = ;
12 :     structure A :
13 :     sig
14 :     datatype foo
15 :     con Bar : int -> foo
16 :     end
17 :     - structure B : sig datatype foo' = Bar of int end = struct
18 :     = open A
19 :     = type foo' = foo
20 :     = end;
21 :     structure B :
22 :     sig
23 :     datatype foo'
24 :     con Bar : int -> A.foo
25 :     end
26 :     Status: fixed in 0.56
27 :     --------------------------------------------------------------------------------
28 :     Number: 202
29 :     Title: type error not caught?
30 :     Keywords: modules, functors, type checking
31 :     Submitter: Norman Ramsey
32 :     Date: 8/28/89
33 :     Version: ?
34 :     Problem:
35 :     I believe that the following file should generate a type error, but
36 :     it doesn't. In particular, the line val _ = begin_str "replicas"
37 :     ufanout(c,chans) should force chans to be type 'a chan list when c is
38 :     type 'a chan.
39 :     Code:
40 :     datatype 'a chan = CHAN of 'a
41 :    
42 :     signature BADGUYS = sig
43 :     val mkchan : unit -> '1a chan
44 :     val ufanout : '2a chan * '2a chan list -> 'b
45 :     val begin_str : string -> ('a -> 'b) -> 'a -> unit
46 :     end
47 :    
48 :     signature WONKY = sig
49 :     val ureplicas : int -> '2a chan -> '6b chan list
50 :     (* wrong! should be int -> '2a chan -> '2a chan list *)
51 :     end
52 :    
53 :     functor buggy(bad:BADGUYS):WONKY = struct
54 :    
55 :     open bad
56 :    
57 :     fun ureplicas n c = (* n unsynchronized copies of channel c *)
58 :     let fun channels(l,0) = l
59 :     | channels(l,n) = channels(mkchan()::l,n-1)
60 :     val chans = channels(nil,n)
61 :     val _ = begin_str "replicas" ufanout(c,chans)
62 :     in chans
63 :     end
64 :    
65 :     end
66 :     Transcript: (0.52)
67 :     - use "code/bug.202";
68 :     [opening code/bug.202]
69 :     code/bug.202:16.36-28.3 Error: value type in structure doesn't match signature
70 :     spec
71 :     name: ureplicas
72 :     spec: int -> '2a chan -> '6b chan list
73 :     actual: int -> '1a chan -> '6b chan list
74 :     Status: fixed in 0.56
75 :     --------------------------------------------------------------------------------
76 :     Number: 203
77 :     Title: printing of infix specs in signatures
78 :     Keywords: modules, signatures, printing
79 :     Submitter: Trevor Jim
80 :     Date: 4/3/89
81 :     Version: 0.32, 0.52
82 :     Problem:
83 :     infix specs are printed with two precedence numbers
84 :     Transcript:
85 :     - signature SS = sig infix 5 bar end;
86 :     signature SS =
87 :     sig
88 :     infix 10 10 bar
89 :     end
90 :     Status: fixed in 0.54
91 :     --------------------------------------------------------------------------------
92 :     Number: 204
93 :     Title: constructors printed when not accessible
94 :     Keywords: modules, signatures, printing
95 :     Submitter: Dave Berry
96 :     Date: 2/2/89
97 :     Version: 0.52
98 :     Problem:
99 :     constructors of a datatype in a structure are printed in the structure
100 :     signature even though they are masked out by a signature constraint.
101 :     Transcript:
102 :     - signature S1 = sig type d end;
103 :     signature S1 =
104 :     sig
105 :     type d
106 :     end
107 :     - structure A : S1 = struct datatype d = A | B of int end;
108 :     structure A :
109 :     sig
110 :     datatype d
111 :     con A : d
112 :     con B : int -> d
113 :     end
114 :     Status: fixed in 0.56
115 :     --------------------------------------------------------------------------------
116 :     Number: 205
117 :     Title: performance problem with many opens in a structure
118 :     Keywords: modules, top level, open
119 :     Submitter: Jawahar Malhotra
120 :     Date: 3/15/90
121 :     Version: 0.56
122 :     Problem: many opens
123 :     Code:
124 :     structure A = struct (* 30 val declarations *) end
125 :     structure B,C,D... similar
126 :     structure S = struct open A B C D E F G end
127 :     Status: fixed in 0.58
128 :     ------------------------------------------------------------------------------
129 :     Number: 206
130 :     Title: unhelpful parser error message (new parser)
131 :     Keywords:
132 :     Submitter: Dave
133 :     Date: 3/15/90
134 :     Version: 0.52
135 :     Transcript:
136 :     - structure A =
137 :     struct
138 :     val x = if true then if true then 1 else 2
139 :     end;
140 :     std_in:4.1 Error: syntax error found at END
141 :     -
142 :     Comment: what we need is %prefer ELSE 0, that is, the ability to give
143 :     a hint for the insertion of two tokens in a row. Right now, %prefer can
144 :     only hint about single-token insertions. This fix has to be done
145 :     in mlyacc.
146 :     Fix: multitoken inserts
147 :     Status: fixed in 1.03f
148 :     -------------------------------------------------------------------------------
149 :     Number: 207
150 :     Title: uncaught tycStamp exception
151 :     Keywords: types, modules, signatures, functors
152 :     Submitter: Nevin.Heintze@PROOF.ERGO.CS.CMU.EDU
153 :     Date: 4/3/90
154 :     Version: 0.44 (0.53)
155 :     Problem: tycStamp raised during compilation
156 :     Code: (file bug207.sml)
157 :     signature SS =
158 :     sig
159 :     datatype t = B of t | A of t list
160 :     end
161 :    
162 :     functor F(X:SS) =
163 :     struct
164 :     fun f(X.B(v)) = (v :: nil = v :: nil) | f _ = false
165 :     end
166 :     Transcript:
167 :     Standard ML of New Jersey, Version 0.44, 4 December 1989
168 :     val it = () : unit
169 :     - use "bug.sml";
170 :     [opening bug.sml]
171 :     bug.sml, line 11: Error: Compiler bug: tycStamp
172 :     equal: type = ?.ttt list
173 :     [closing bug.sml]
174 :     -
175 :     Comments:
176 :     The problem appears to be the typing of the equality test.
177 :     It is sensitive to the use of lists, both in the datatype
178 :     definition and the equality test.
179 :     Status: fixed in 0.56
180 :     -------------------------------------------------------------------------------
181 :     Number: 208
182 :     Title: bug in optimizer causing bad free variable
183 :     Keywords:
184 :     Submitter: Appel & MacQueen
185 :     Date: 4/27/90
186 :     Version: 0.56
187 :     Problem: impossible error in cpsopt phase, on MIPS machine,
188 :     with default optimization settings
189 :     Code:
190 :     functor MipsCoder(val emit : 'a -> unit) = struct
191 :     fun needs _ = true
192 :     fun pass now =
193 :     let fun gen inst =
194 :     if now andalso needs() then ()
195 :     else if now
196 :     then let fun gen1() = gen(raise Match)
197 :     in case inst of
198 :     NONE => gen1()
199 :     | SOME b =>
200 :     let fun bc1f offset = ()
201 :     fun bc1t offset = ()
202 :     in if inst=NONE then
203 :     (emit((if b then bc1t else bc1f)
204 :     inst); gen1())
205 :     else ()
206 :     end
207 :     end
208 :     else ()
209 :     in gen
210 :     end
211 :     val assemble = pass true
212 :     end
213 :    
214 :     Comment: this can be avoided by setting closurestrategy to 2, which we now
215 :     do; Trevor may fix this bug eventually.
216 :    
217 :     Status: fixed in 0.60 (avoided)
218 :     -------------------------------------------------------------------------------
219 :     Number: 209
220 :     Title: equality types and functors, again
221 :     Keywords: modules, functors, equality
222 :     Submitter: Appel & MacQueen
223 :     Date: 4/30/90
224 :     Version: 0.56
225 :     Problem:
226 :     Problem in eqtypes/defineEqTycon/eqty. failure when attempting to
227 :     reevaluate equality properties of generative/defined tycons in functor body
228 :     after functor is applied.
229 :     Code:
230 :     signature S1 = sig type t end;
231 :     structure A = struct type t = int end;
232 :     functor F(X : S1) =
233 :     struct
234 :     structure B = struct datatype s1 = K of X.t end
235 :     type s = B.s1
236 :     end;
237 :     structure C = F(A);
238 :     Comments: we've put in a warning message, and assumed a non-equality type
239 :     when this happens. (still causes impossible error in 0.56).
240 :     Fix: "fixed" by following the lead of the Definition and not recalculating
241 :     equality properties on functor applications.
242 :     Status: fixed in 0.66
243 :     --------------------------------------------------------------------------------
244 :     Number: 210
245 :     Title: sharing checking with fixed stamps
246 :     Keywords: modules, signatures, sharing
247 :     Submitter: Appel & MacQueen
248 :     Date: 5/3/90
249 :     Version: 0.56
250 :     Problem:
251 :     Union exception is not caught when sharing specs try to identify two distinct
252 :     types or structures (with differing fixed stamps).
253 :     Code:
254 :     structure S = struct end;
255 :     structure T = struct end;
256 :     signature Q = sig sharing S=T end;
257 :     Comments:
258 :     Easy to fix. Just add a handler for the Union exception in Sharing.doSharing
259 :     and produce and appropriate error message.
260 :     Status: fixed in 0.57
261 :     --------------------------------------------------------------------------------
262 :     Number: 211
263 :     Title: Union exception processing correct sharing in functor body
264 :     Keywords: modules, functors, sharing
265 :     Submitter: MacQueen
266 :     Date: 5/4/90
267 :     Version: 0.56
268 :     Problem:
269 :     Union exception is raised in doSharing when processing correct sharing
270 :     specs in a functor body.
271 :     Code: (* bug211.sml *)
272 :     functor F(type t) =
273 :     struct
274 :     structure K =
275 :     struct
276 :     type s = t
277 :     end
278 :     structure M : sig structure L : sig type s sharing type s = t end
279 :     sharing L=K
280 :     end =
281 :     struct
282 :     structure L = K
283 :     end
284 :     end;
285 :    
286 :     Comments:
287 :     The bug occurs because the type definition shortcut (for "type s = t", s
288 :     is made a copy (modulo path) of t) is not done when t has a bound stamp,
289 :     as in the code above. Here s is a DEFtyc tycon with a different stamp
290 :     from t.
291 :     Status: fixed in 0.58
292 :     --------------------------------------------------------------------------------
293 :     Number: 212
294 :     Title: polymorphic exception declarations
295 :     Keywords: exceptions, polymorphism
296 :     Submitter: Dave Berry (for Jo Blishen) (submitted to ml-bugs)
297 :     Date: 5/11/90
298 :     Version: 0.56
299 :     Severity: major
300 :     Problem: rejects proper weak polymorphic type for locally declared exception
301 :     Code:
302 :     fun f (l:'_a) = let exception E of '_a in (raise (E l)) handle E t => t end;
303 :     Comments:
304 :     Worked in 0.44a.
305 :     Status: fixed in 0.58
306 :     (suspect related bugs because of the way TyvarSet.union_tyvars is defined.)
307 :     --------------------------------------------------------------------------------
308 :     Number: 213
309 :     Title: equality on int*int
310 :     Keywords: equality
311 :     Submitter: Soren Christensen,
312 :     University of Aarhus, Computer Science Dep.,
313 :     Denmark
314 :     schristensen@daimi.dk
315 :     Date: 5/16/90
316 :     Version: 0.56
317 :     System: Sun4/280 / SunOS 4.0.1
318 :     Severity: Critical
319 :     Problem: failure compiling equality on type int*int
320 :     Code: (* filename: bug213.sml *)
321 :    
322 :     (3,3,) = (3,3);
323 :    
324 :     Transcript:
325 :     Standard ML of New Jersey, Version 0.56, 13 April 1990
326 :     Warning: input and output are now uncurried, arithmetic exceptions
327 :     are re-arranged, div and mod are different; see doc/NEWS
328 :     val it = () : unit
329 :     - use "fun";
330 :     [opening fun]
331 :     datatype 'a $$$
332 :     con $ : 'a -> 'a $$$
333 :     con $$ : 'a $$$
334 :     LOOKUP FAILS in close(FIX 2795 2799 2707 2996
335 :     ) on 2927
336 :     in environment:
337 :     2792 2790 2791
338 :     [closing fun]
339 :     uncaught exception Match
340 :     - val x = 5;
341 :     Illegal instruction
342 :     Comments:
343 :     [Christensen] It looks like the compiler is messed up after this error. It
344 :     core-dumps parsing the next declaration. Version 0.44 has no problem
345 :     handling this declaration.
346 :    
347 :     [dbm] The code "(3,3) = (3,3);" reproduces the bug. Haven't been able
348 :     to reproduce the core dump.
349 :     Status: fixed in 0.58 (bug was in codegen)
350 :     --------------------------------------------------------------------------------
351 :     Number: 214
352 :     Title: Compiler bug: EnvAccess.lookPath when printing
353 :     Keywords: modules, functors, printing
354 :     Submitter: Frank Pfenning (Frank.Pfenning@proof.ergo.cs.cmu.edu
355 :     Date: 5/17/90
356 :     Version: 0.56
357 :     Severity: critical
358 :     Problem: Compiler bug: EnvAccess.lookPath occurs when printing a top-level result.
359 :     Code:
360 :     signature TERM =
361 :     sig
362 :     datatype term = Const of string
363 :     and varbind = Varbind of string * term
364 :     end
365 :    
366 :     functor Term ( ) : TERM =
367 :     struct
368 :     datatype term = Const of string
369 :     and varbind = Varbind of string * term
370 :     end
371 :    
372 :     signature BUG =
373 :     sig
374 :     structure Term : TERM
375 :     type progentry
376 :     val bug : progentry list
377 :     end
378 :    
379 :     functor Bug ( structure Term : TERM ) : BUG =
380 :     struct
381 :     structure Term = Term
382 :     open Term
383 :     datatype progentry =
384 :     Progentry of string * Term.term * Term.varbind list * Term.term
385 :     val bug =
386 :     [Progentry("test",Const "test",
387 :     [Varbind("v",Const("test"))],Const("test"))]
388 :     end
389 :    
390 :     structure Term : TERM = Term ();
391 :     structure Bug : BUG = Bug ( structure Term = Term );
392 :    
393 :     Bug.bug;
394 :    
395 :     Status: fixed in 0.58
396 :     --------------------------------------------------------------------------------
397 :     Number: 215
398 :     Title: sin gives incorrect values
399 :     Keywords:
400 :     Submitter: Thomas M. Breuel (tmb@ai.mit.edu)
401 :     Date: 5/18/90
402 :     Version: 0.59
403 :     System: SPARC/SunOS 4.0.3c
404 :     Severity: major
405 :     Problem: sin function is incorrect
406 :     Transcript:
407 :     (* SparcStation 1, SunOS 4.0 *)
408 :     Standard ML of New Jersey, Version 0.56, 13 April 1990
409 :     Warning: input and output are now uncurried, arithmetic exceptions
410 :     are re-arranged, div and mod are different; see doc/NEWS
411 :     val it = () : unit
412 :     - sin(4.0);
413 :     val it = ~0.756802495307928 : real
414 :     - sin(5.0);
415 :     val it = ~0.958924274663138 : real
416 :     - sin(6.0);
417 :     val it = 0.279415498198926 : real
418 :     - (* ^^^^^^^^^^^^^^^^^ this should be negative, since it is between pi and 2 pi *)
419 :    
420 :     Comments:
421 :     Probably someone transcribed the sin function from the Berkeley
422 :     math library incorrectly in boot/math.sml.
423 :     Status: fixed in 0.58 (Appel)
424 :     --------------------------------------------------------------------------------
425 :     Number: 216
426 :     Title: floating point on SPARC
427 :     Keywords:
428 :     Submitter: tmb@ai.mit.edu
429 :     Date: 19/5/90
430 :     Version: 0.56
431 :     System: Sun SS1, Sun OS 4.0.3
432 :     Severity: critical
433 :     Problem: floating point broken in Sparc compiler?!
434 :     Transcript:
435 :    
436 :     (everything that begins with a TAB comes from an actual transcript)
437 :    
438 :     Standard ML of New Jersey, Version 0.56, 13 April 1990
439 :     Warning: input and output are now uncurried, arithmetic exceptions
440 :     are re-arranged, div and mod are different; see doc/NEWS
441 :     val it = () : unit
442 :     - fun ilist(from:int,to:int,step:int)
443 :     = f = if (from<to) then (f from)::ilist(from+step,to,step) f else [];
444 :     val ilist = fn : int * int * int -> (int -> 'a) -> 'a list
445 :     - ilist(0,10,1) (fn x => x);
446 :     val it = [0,1,2,3,4,5,6,7,8,9] : int list
447 :     - ilist(0,10,1) print;
448 :     0123456789val it = [(),(),(),(),(),(),(),(),(),()] : (unit) list
449 :    
450 :     all is as it should be--so far
451 :    
452 :     - fun rlist(from:real,to:real,step:real) f =
453 :     = if (from<to) then (f from)::rlist(from+step,to,step) f else [];
454 :     val rlist = fn : real * real * real -> (real -> 'a) -> 'a list
455 :    
456 :     this is the same definition with different type constraints
457 :    
458 :     - rlist(0.0,10.0,1.0) (fn x => x);
459 :     val it = [] : real list
460 :    
461 :     ???
462 :    
463 :     - rlist(0.0,10.0,1.0) (fn x => x);
464 :     val it = [0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0] : real list
465 :    
466 :     same expression, different result???
467 :    
468 :     - rlist(0.0,10.0,1.0) (fn x => x);
469 :     val it = [0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0] : real list
470 :    
471 :     now it seems to work...
472 :    
473 :     - rlist(0.0,10.0,1.0) print;
474 :     0.0val it = [()] : (unit) list
475 :    
476 :     but it still doesn't work with "print"
477 :    
478 :     - rlist(0.0,10.0,1.0) (fn x => x);
479 :     val it = [0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0] : real list
480 :     -
481 :    
482 :     Comments:
483 :    
484 :     These problems don't occur on the m68 version of SML. In fact,
485 :     the problem with "sin" that I reported previously also doesn't
486 :     occur with the m68 version.
487 :    
488 :     Maybe this is an installation problem, but if it is, then there is
489 :     probably something wrong with the makeml script. The Sparc version
490 :     was generated with "makeml -sun4 -sunos" if I remember correctly.
491 :    
492 :     Here is the transcript from a Sun-3:
493 :    
494 :     Standard ML of New Jersey, Version 0.56, 13 April 1990
495 :     Warning: input and output are now uncurried, arithmetic exceptions
496 :     are re-arranged, div and mod are different; see doc/NEWS
497 :     val it = () : unit
498 :     - [opening /tmp_mnt/home/vi/tmb/cad/bad.sml]
499 :     val identity = fn : 'a -> 'a
500 :     val ilist = fn : int * int * int -> (int -> 'a) -> 'a list
501 :     val rlist = fn : real * real * real -> (real -> 'a) -> 'a list
502 :     [closing /tmp_mnt/home/vi/tmb/cad/bad.sml]
503 :     val it = () : unit
504 :    
505 :     these are the same definitions as above
506 :    
507 :     - ilist(0,10,1) (fn x => x);
508 :     val it = [0,1,2,3,4,5,6,7,8,9] : int list
509 :     - ilist(0,10,1) print;
510 :     0123456789val it = [(),(),(),(),(),(),(),(),(),()] : (unit) list
511 :     - rlist(0.0,10.0,1.0) (fn x => x);
512 :     val it = [0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0] : real list
513 :     - rlist(0.0,10.0,1.0) print;
514 :     0.01.02.03.04.05.06.07.08.09.0val it = [(),(),(),(),(),(),(),(),(),()] : (unit) list
515 :     - sin 6.0;
516 :     val it = ~0.279415498198926 : real
517 :     - sin 5.0;
518 :     val it = ~0.958924274663138 : real
519 :     -
520 :    
521 :     Status: fixed in 0.58 (Reppy)
522 :     --------------------------------------------------------------------------------
523 :     Number: 217
524 :     Title: simultaneous opens
525 :     Keywords:
526 :     Submitter: Larry Paulson (lcp@lfcs.ed.ac.uk)
527 :     Date: 5/25/90
528 :     Version: 0.56
529 :     Severity: major
530 :     Problem: opening several structures simultaneously can result in Runbind
531 :     Code: code/bug217.sml
532 :     structure A = struct val x = 3 end;
533 :     structure B = struct structure A = A; end;
534 :     open A B;
535 :     x;
536 :     Comments:
537 :     This works if "open A B;" is replaced with "open A; open B;"
538 :     Status: fixed in 0.59
539 :     --------------------------------------------------------------------------------
540 :     Number: 218
541 :     Title: compiler bug after unbound variable
542 :     Keywords: types, type checking
543 :     Submitter: John Reppy (jhr@cs.cornell.edu)
544 :     Date: 5/26/90
545 :     Version: 0.57
546 :     Severity: major
547 :     Problem: Compiler bug: generalizeTy -- bad arg occurs after top level unbound var
548 :     Transcript:
549 :     - x;
550 :     std_in:2.1 Error: unbound variable x
551 :     Error: Compiler bug: generalizeTy -- bad arg
552 :     Status: fixed in 0.59
553 :     --------------------------------------------------------------------------------
554 :     Number: 219
555 :     Title: parsing layered patterns
556 :     Keywords:
557 :     Submitter: Andrew Appel
558 :     Date: 5/1/90
559 :     Version: 0.56 and later
560 :     Severity: minor
561 :     Problem: parsing of layered pattern is too liberal. An atomic pattern is
562 :     accepted where a variable is required by the Definition syntax.
563 :     Code:
564 :     let val (x) as (y :: z) = [1,2] in x end
565 :     Comments:
566 :     Seems to require nontrivial change to the mlyacc grammar
567 :     Status: fixed in 1.04 (actually 1.03f)
568 :     --------------------------------------------------------------------------------
569 :     Number: 220
570 :     Title: Match exception after error
571 :     Keywords: modules, signatures, signature matching
572 :     Submitter: John Reppy
573 :     Date: 6/1/90
574 :     Version: 0.58
575 :     System: Sun 4
576 :     Severity: minor
577 :     Problem: uncaught exception Match after signature matching error
578 :     Code:
579 :     signature S = sig
580 :     type foo
581 :     val f : int -> foo
582 :     end
583 :    
584 :     structure Foo : S = struct
585 :     datatype foo_t = Foo of int
586 :     val f = Foo
587 :     end
588 :    
589 :     Transcript:
590 :     xxx.sml:6.21-9.3 Error: unmatched type spec: foo
591 :     xxx.sml:6.21-9.3 Error: value type in structure doesn't match signature spec
592 :     name: f
593 :     spec: int -> [closing xxx.sml]
594 :    
595 :     uncaught exception Match
596 :     -
597 :     Comment:
598 :     Now produces
599 :     std_in:10.21-13.3 Error: unmatched type spec: foo
600 :     std_in:10.21-13.3 Error: value type in structure doesn't match signature spec
601 :     name: f
602 :     spec: int -> NULLtyc
603 :     actual: int -> foo_t
604 :     The NULLtyc is undesirable.
605 :    
606 :     Status: fixed in 0.65
607 :     --------------------------------------------------------------------------------
608 :     Number: 221
609 :     Title: profiling broken
610 :     Keywords: profiling
611 :     Submitter: Benjamin Pierce (Benjamin.Pierce%proof.ergo.cs.cmu.edu
612 :     Date: 5/22/90
613 :     System: 0.56 (and later)
614 :     Problem:
615 :     Profiling provides call counts bug not timings. For separately compiled
616 :     modules, profiling provides neither call counts nor timings.
617 :     Transcript:
618 :     (1) for separately compiled code
619 :     %time cumsecs #call ms/call name
620 :     .00 0 (toplevel)
621 :     .00 0 (gc)
622 :     .00 0 (unprofiled)
623 :    
624 :    
625 :     (2) for "used" code
626 :     %time cumsecs #call ms/call name
627 :     .00 2398 .0000 anon.AType.==.anon
628 :     .00 2398 .0000 anon.AType.==
629 :     .00 2051 .0000 anon.Id.==.anon
630 :     .00 2051 .0000 anon.Id.==
631 :     .00 1890 .0000 anon.AType.apply_rule.anon
632 :     [etc...]
633 :     Fix:
634 :     Some of the problems may be caused by handleprof() in runtime/signal.c
635 :     being braindamaged. I changed it to be:
636 :    
637 :     SIGH_RET_TYPE handleprof ()
638 :     {
639 :     extern ML_val_t current0[];
640 :     ML_val_t cur_barray = current0[1];
641 :     cur_barray[1] = (unsigned int)INT_incr(cur_barray[1],1);
642 :     }
643 :    
644 :     and it seemed to work for simple examples. However, I'm not too sure
645 :     that the times mean anything for larger examples. Perhaps there's some
646 :     bad interaction with GC?
647 :     Status: fixed in 0.70
648 :     --------------------------------------------------------------------------------
649 :     Number: 222
650 :     Title: equality on ref types
651 :     Keywords: equality
652 :     Submitter: Larry Paulson <lcp@lfcs.edinburgh.ac.uk>
653 :     Date: 11/6/90
654 :     Version: 0.56, 0.59
655 :     Severity: major
656 :     Problem:
657 :     ref type not being recognized as unconditionally an equality type
658 :     Transcript:
659 :     - fun silly x = (ref x = ref x);
660 :     val silly = fn : ''1a -> bool
661 :     - silly not;
662 :     std_in:4.1-4.9 Error: operator and operand don't agree (equality type required)
663 :     operator domain: ''0S
664 :     operand: bool -> bool
665 :     in expression:
666 :     silly not
667 :    
668 :     And anyway the type checker behaves inconsistently by admitting the
669 :     following:
670 :    
671 :     - ref not = ref not;
672 :     val it = false : bool
673 :     Status: fixed in 0.65 --- before
674 :     --------------------------------------------------------------------------------
675 :     Number: 223
676 :     Title: nontty standard input and uncaught exceptions
677 :     Keywords:
678 :     Submitter: KINOSHITA Yoshiki yoshiki@etl.go.jp
679 :     Date: 6/4/90
680 :     Version: SML of NJ 0.56
681 :     System: Sparc Station 330 (SUN4), SUN-OS 4.0.3 (generic version)
682 :     Severity: major
683 :     Problem: If the standard input is a pipe, the system ends
684 :     abnormally after it sends an error message.
685 :     Code: None. The problem concerns with the interface to UNIX.
686 :     Transcript:
687 :     % cat - | sml
688 :     Standard ML of New Jersey, Version 0.56, 13 April 1990
689 :     Warning: input and output are now uncurried, arithmetic exceptions
690 :     are re-arranged, div and mod are different; see doc/NEWS
691 :     val it = () : unit
692 :     - foo;
693 :     std_in:2.1-2.3 Error: unbound variable foo
694 :     uncaught exception Stop
695 :     ^Z
696 :     Stopped
697 :     % jobs
698 :     [1] + Stopped cat - |
699 :     Done sml
700 :     %
701 :    
702 :     Comments: This problem makes it impossible to use the system with
703 :     its input sent through a UNIX filter.
704 :     from jhr:
705 :     You might call this a feature. It appears that the person who wrote
706 :     the top-level loop code (interact.sml), decided that exceptions
707 :     should only be caught at the top-level loop when std_in is a tty
708 :     (look at lines 292-309 in interact.sml). The following work-around
709 :     avoids the problem
710 :    
711 :     <jhr@rocky:76> cat - | sml
712 :     Standard ML of New Jersey, Version 0.59, 4 June 1990
713 :     Warning: input and output are now uncurried, arithmetic exceptions
714 :     are re-arranged, div and mod are different; see doc/NEWS
715 :     val it = () : unit
716 :     - set_term_in(std_in, true);
717 :     val it = () : unit
718 :     - foo;
719 :     std_in:3.1-3.3 Error: unbound variable foo
720 :     - 1+2;
721 :     val it = 3 : int
722 :     -
723 :    
724 :     But, maybe the code should change. It isn't clear to me what the correct
725 :     semantics are in this case. This problem came up here at Cornell when
726 :     Bill Aitken was using "rsh" to run sml on a remote machine.
727 :     Status: fixed in 0.65
728 :     --------------------------------------------------------------------------------
729 :     Number: 224
730 :     Title: weakness 0 type variables in let declaration
731 :     Keywords: types, type checking, weak types
732 :     Submitter: Larry Paulson
733 :     Date: 6/4/90
734 :     Version: 0.56, 0.59
735 :     Severity: major
736 :     Problem:
737 :     A weakness 0 type variable should be admitted, but not generalized, in local
738 :     declarations.
739 :     Transcript: <transcript of session illustrating problem>
740 :     - let val f = ref(fn x => x) in f := not; !f true end;
741 :     std_in:1.9-1.26 Error: nongeneric weak type variable
742 :     f : ('0Y -> '0Y) ref
743 :     std_in:1.9-1.26 Error: nongeneric weak type variable
744 :     f : ('0Y -> '0Y) ref
745 :     Comments:
746 :     This worked in 0.44.
747 :     Status: fixed in 0.65 --- (before)
748 :     --------------------------------------------------------------------------------
749 :     Number: 225
750 :     Title: import broken in 0.59
751 :     Keywords:
752 :     Submitter: Lars Bo Nielsen <lbn@iesd.auc.dk>
753 :     Date: 6/5/90
754 :     Version: Version 0.59
755 :     System: Sparc/sunos
756 :     Severity: critical
757 :     Problem: import broken. A simple 'import "file"' doesn't work, if
758 :     only 'file.sml' is present. If 'file.bin' is present it
759 :     works.
760 :     I DIDN'T have this problem with version 0.56.
761 :     Transcript:
762 :    
763 :     The following example shows the problem.
764 :    
765 :     SHELL% ll
766 :     total 68
767 :     2 calc.dsl 11 calc.grm.sml 31 calc.parser.sml
768 :     3 calc.grm 1 calc.instr 2 calc.sml
769 :     4 calc.grm.desc 2 calc.lex
770 :     1 calc.grm.sig 11 calc.lex.sml
771 :     SHELL% sml
772 :     Standard ML of New Jersey, Version 0.59, 4 June 1990
773 :     Warning: input and output are now uncurried, arithmetic exceptions
774 :     are re-arranged, div and mod are different; see doc/NEWS
775 :     val it = () : unit
776 :     - import "calc.parser";
777 :    
778 :     uncaught exception SystemCall
779 :     - ^Z
780 :     Stopped
781 :     SHELL% touch calc.parser.bin
782 :     SHELL% fg
783 :     sml
784 :     - import "calc.parser";
785 :     [reading calc.parser.bin... ]
786 :     [calc.parser.bin is the wrong format; recompiling
787 :     [closing calc.parser.bin]
788 :     [reading calc.parser.sml]
789 :    
790 :     [Major collection... 69% used (1475096/2123360), 1700 msec]
791 :    
792 :     [Increasing heap to 4451k]
793 :    
794 :     ..... etc .....
795 :    
796 :     Status: fixed in 0.60 (jhr)
797 :     --------------------------------------------------------------------------------
798 :     Number: 226
799 :     Title: uncaught exception Match while printing type (same as 220)
800 :     Keywords: modules, types, printing
801 :     Submitter: John Reppy
802 :     Date: 6/1/90
803 :     Version: 0.56
804 :     Severity: major
805 :     Problem:
806 :     Uncaught Match exception occurs when printing out the spec type in an error message.
807 :     Code:
808 :    
809 :     signature S = sig
810 :     type foo
811 :     val f : int -> foo
812 :     end
813 :    
814 :     structure Foo : S = struct
815 :     datatype foo_t = Foo of int
816 :     val f = Foo
817 :     end
818 :    
819 :     Transcript:
820 :     xxx.sml:6.21-9.3 Error: unmatched type spec: foo
821 :     xxx.sml:6.21-9.3 Error: value type in structure doesn't match signature spec
822 :     name: f
823 :     spec: int -> [closing xxx.sml]
824 :    
825 :     uncaught exception Match
826 :     -
827 :    
828 :     Status: fixed in 0.65 --- partially fixed (before 0.65)
829 :     --------------------------------------------------------------------------------
830 :     Number: 227
831 :     Title: equality property of datatypes
832 :     Keywords: types, datatypes, equality
833 :     Submitter: Brian Boutel (brian@comp.vuw.ac.nz)
834 :     Date: 5/25/90
835 :     Version: 0.56
836 :     System: Sun3/sunos and H-P workstation (More/bsd)
837 :     Severity: major
838 :     Problem: Equality test for recursive types may fail in various ways
839 :     (similar to bug 45, reported fixed)
840 :    
841 :     Description:
842 :     Given
843 :     datatype 'a d1 = c11 | c12 of ('a * 'a d1);
844 :     datatype 'a d2 = c21 | c22 of ('a d2 * 'a );
845 :     datatype d3 = c31 | c32 of ( d3 * int);
846 :    
847 :     a) c11 = c11 works correctly
848 :     b) c12(1,c11) = c12(1,c11) gets uncaught exception Match (* ok in 0.59 *)
849 :     c) c21 = c21 loops forever (* in 0.59 as well *)
850 :     d) c22(c21,1) = c22(c21,1) gets uncaught exception Match (* ok in 0.59 *)
851 :     e) c31 = c31 works correctly
852 :     f) c32(c31,1) = c32(c31,1) gets uncaught exception Match (* ok in 0.59 *)
853 :    
854 :     Transcript: (with System.Control.debugging := true)
855 :     b)
856 :     - c12(1,c11) = c12(1,c11);
857 :     parse
858 :     semantics
859 :    
860 :     BEFORE:
861 :     val it = = (c12 (1,c11),c12 (1,c11))
862 :    
863 :     AFTER:
864 :     val it = = (c12 (1,c11),c12 (1,c11))
865 :    
866 :     test: int d1
867 :     test: int d1
868 :     find: int d1
869 :     find-notfound
870 :     enter: int d1
871 :     test: int * int d1
872 :     find: int * int d1
873 :     find-notfound
874 :     enter: int * int d1
875 :     test: int
876 :     test: int
877 :     test: int d1
878 :     find: int d1
879 :     translate
880 :     reorder
881 :     convert
882 :     cpsopt
883 :     closure
884 :     LOOKUP FAILS in close(FIX 4146 4150
885 :     ) on 4161
886 :     in environment:
887 :     4143 4141 4142
888 :     globalfix
889 :     spill
890 :     codegen
891 :     uncaught exception Match
892 :     -
893 :    
894 :     c)
895 :     - c21 = c21;
896 :     parse
897 :     semantics
898 :    
899 :     BEFORE:
900 :     val it = = (c21,c21)
901 :    
902 :    
903 :     AFTER:
904 :     val it = = (c21,c21)
905 :    
906 :     test: ''S d2
907 :     test: ''S d2
908 :     find: ''S d2
909 :     find-notfound
910 :     enter: ''S d2
911 :     test: ''S d2 * ''S
912 :     find: ''S d2 * ''S
913 :     find-notfound
914 :     enter: ''S d2 * ''S
915 :     test: ''S d2
916 :     find: ''S d2
917 :     find-notfound
918 :     enter: ''S d2
919 :     test: ''S d2 * ''S
920 :     find: ''S d2 * ''S
921 :     find-notfound
922 :     enter: ''S d2 * ''S
923 :     test: ''S d2
924 :     find: ''S d2
925 :     find-notfound
926 :     .....
927 :    
928 :     Status: fixed in 0.60
929 :     --------------------------------------------------------------------------------
930 :     Number: 228
931 :     Title: string to real conversion
932 :     Keywords:
933 :     Submitter: jubu@tub.UUCP or jubu@tub.BITNET (Juergen Buntrock TUB)
934 :     Date: 27/4/90
935 :     Version: 0.44
936 :     System: Sun4, SunOS Release 4.0.3c
937 :     Severity: critical
938 :     Code: and Transcript:
939 :    
940 :     Script started on Fri Apr 27 13:49:54 1990
941 :     jubu@curry mlj/handel 1) cat bug.sml
942 :     exception bad_number;
943 :    
944 :     fun string2real (s : string) = let
945 :     val (fac,li) = case explode s of
946 :     "-" :: li => (~1.0,li) |
947 :     "+" :: li => (1.0,li) |
948 :     li => (1.0,li)
949 :     val (res,_) = (revfold (fn (c,(a,fac1)) => let
950 :     val n = ord c - ord "0"
951 :     in
952 :     output std_out ""; (* comiler bug ! *)
953 :     if fac1 > 0.0
954 :     then
955 :     if n < 0 orelse n > 9
956 :     then raise bad_number
957 :     else (a + fac1 * (real n),fac1/10.0)
958 :     else if c = "."
959 :     then (a,1.0/10.0)
960 :     else
961 :     if n < 0 orelse n > 9
962 :     then raise bad_number
963 :     else (10.0 * a + (real n),0.0)
964 :     end) li (0.0,0.0))
965 :     in
966 :     res * fac
967 :     end
968 :    
969 :     fun string2real_bug (s : string) = let
970 :     val (fac,li) = case explode s of
971 :     "-" :: li => (~1.0,li) |
972 :     "+" :: li => (1.0,li) |
973 :     li => (1.0,li)
974 :     val (res,_) = (revfold (fn (c,(a,fac1)) => let
975 :     val n = ord c - ord "0"
976 :     in
977 :     if fac1 > 0.0
978 :     then
979 :     if n < 0 orelse n > 9
980 :     then raise bad_number
981 :     else (a + fac1 * (real n),fac1/10.0)
982 :     else if c = "."
983 :     then (a,1.0/10.0)
984 :     else
985 :     if n < 0 orelse n > 9
986 :     then raise bad_number
987 :     else (10.0 * a + (real n),0.0)
988 :     end) li (0.0,0.0))
989 :     in
990 :     res * fac
991 :     end
992 :    
993 :    
994 :     jubu@curry mlj/handel 2) sml
995 :     Standard ML of New Jersey, Version 0.44, 4 December 1989
996 :     val it = () : unit
997 :     - use"bug.sml";
998 :     [opening bug.sml]
999 :     exception bad_number
1000 :     val string2real = fn : string -> real
1001 :     val string2real_bug = fn : string -> real
1002 :     [closing bug.sml]
1003 :     val it = () : unit
1004 :     - string2real "123.456";
1005 :     val it = 123.456 : real
1006 :     - string2real_bug "123.456";
1007 :     val it = 12346.0 : real
1008 :     - open System.Control.CG;
1009 :     structure M68 :
1010 :     sig
1011 :     val trapv : bool ref
1012 :     end
1013 :     val reducemore = ref 15 : int ref
1014 :     val printit = ref false : bool ref
1015 :     val knowngen = ref 12 : int ref
1016 :     val etasplit = ref true : bool ref
1017 :     val comment = ref false : bool ref
1018 :     val knowncl = ref 0 : int ref
1019 :     val scheduling = ref true : bool ref
1020 :     val printsize = ref false : bool ref
1021 :     val reduce = ref true : bool ref
1022 :     val closureprint = ref false : bool ref
1023 :     val stdgen = ref 64 : int ref
1024 :     val alphac = ref true : bool ref
1025 :     val profile = ref false : bool ref
1026 :     val hoist = ref true : bool ref
1027 :     val foldconst = ref true : bool ref
1028 :     val tailrecur = ref true : bool ref
1029 :     val path = ref false : bool ref
1030 :     val rounds = ref 1 : int ref
1031 :     val closureStrategy = ref 1 : int ref
1032 :     val recordopt = ref true : bool ref
1033 :     val bodysize = ref 0 : int ref
1034 :     val tail = ref true : bool ref
1035 :     -
1036 :     script done on Fri Apr 27 13:55:57 1990
1037 :    
1038 :     Comments:
1039 :     the Sun3 Compiler is correct
1040 :     Status: fixed in 0.56
1041 :     --------------------------------------------------------------------------------
1042 :     Number: 229
1043 :     Title: uncaught Match after signature spec error
1044 :     Keywords: modules, signatures, signature matching
1045 :     Submitter: Peter Buneman
1046 :     Date: 4/21/89
1047 :     Version: 0.59
1048 :     Severity: major
1049 :     Problem:
1050 :     Following code produces uncaught Match exception
1051 :     Code:
1052 :     signature SS = sig type t1 val t2:t1 end;
1053 :    
1054 :     structure ss:SS =
1055 :     struct local
1056 :     datatype t = T of int
1057 :     in val t2 = T 3
1058 :     end
1059 :     end;
1060 :     Comment:
1061 :     Output in 0.65 is
1062 :     std_in:8.1-12.3 Error: unmatched type spec: t1
1063 :     std_in:8.1-12.3 Error: value type in structure doesn't match signature spec
1064 :     name: t2
1065 :     spec: NULLtyc
1066 :     actual: ?.ss.t
1067 :     NULLtyc for spec is undesirable (similar to 220,226 problem).
1068 :    
1069 :     Status: fixed in 0.65 --- partially fixed (before 0.65)
1070 :     --------------------------------------------------------------------------------
1071 :     Number: 230
1072 :     Title: printing reals on mips
1073 :     Keywords:
1074 :     Submitter: David MacQueen, Andrew Tolmach
1075 :     Date: 6/12/90
1076 :     Version: 0.59
1077 :     System: MIPS, RISCos
1078 :     Severity: critical
1079 :     Problem:
1080 :     Uncaught exception Overflow when printing real numbers at top level. Infinite
1081 :     loop in other cases (e.g. code/bug230.sml).
1082 :     Transcript:
1083 :     - 1.0;
1084 :     val it =
1085 :     uncaught exception Overflow
1086 :     -
1087 :     Comment: works ok on Sun3 and Sun4.
1088 :     works ok on DECsystem (with MIPS chip) / Ultrix
1089 :     Status: fixed in 0.64
1090 :     --------------------------------------------------------------------------------
1091 :     Number: 231
1092 :     Title: equality property of DEFtyc
1093 :     Keywords: types, equality
1094 :     Submitter: Nick Rothwell
1095 :     Date: 6/21/90
1096 :     Version: 0.56?
1097 :     Severity: major
1098 :     Problem:
1099 :     A type abbreviation for an abstract type admits equality.
1100 :     Code:
1101 :     abstype A = A
1102 :     with
1103 :     type B = A
1104 :     end;
1105 :    
1106 :     fn (x: B) => (x=x);
1107 :    
1108 :     Comments:
1109 :     The type name associated with A (and therefore with B) should be
1110 :     stripped of its equality attribute outside the "abstype".
1111 :     Status: fixed in 0.69
1112 :     --------------------------------------------------------------------------------
1113 :     Number: 232
1114 :     Title: user bound type variable in exception declaration
1115 :     Keywords: types, type variables, exceptions
1116 :     Submitter: Jo Blishen, Nick Rothwell
1117 :     Date: 6/20/90
1118 :     Version: 0.59
1119 :     Severity: minor
1120 :     Problem:
1121 :     User-bound tyvar is not generalized at val binding containing it.
1122 :     Transcript:
1123 :     - fun f l = let exception E of '_a in (raise (E l)) handle E t => t end;
1124 :     std_in:2.30-2.32 Error: unbound tyvars in exception declaration
1125 :     Comments:
1126 :     According to the Definition '_a should be considered bound at the outermost
1127 :     val (fun f l ...) where it is the type of the lambda-bound variable l.
1128 :     Status: fixed in 0.65
1129 :     --------------------------------------------------------------------------------
1130 :     Number: 233
1131 :     Title: opening locally declared structure causes Runbind
1132 :     Keywords: modules, open, dynamic env
1133 :     Submitter: Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
1134 :     Date: 6/20/90
1135 :     Version: 0.56 (applies to 0.59 as well I believe)
1136 :     System: Sun3, SunOS 4.1
1137 :     Severity: You decide....
1138 :     Problem:
1139 :     You cannot declare a local structure and open it.
1140 :     Transcript:
1141 :     Standard ML of New Jersey, Version 0.56, 13 April 1990
1142 :     val it = () : unit
1143 :     - local
1144 :     = structure Bug =
1145 :     = struct
1146 :     = val message = "Try to evaluate me !"
1147 :     = end
1148 :     = in
1149 :     = open Bug
1150 :     = end ;
1151 :     open Bug
1152 :     - message;
1153 :     uncaught exception Runbind
1154 :     -
1155 :     Status: fixed in 0.60
1156 :     --------------------------------------------------------------------------------
1157 :     Number: 234
1158 :     Title: Compiler Bug: abstractBody.abstractType 1
1159 :     Keywords: modules, functors
1160 :     Submitter: deutsch@poly.polytechnique.fr.
1161 :     Alain Deutsch,
1162 :     Laboratoire d'Informatique de l'Ecole Polytechnique (LIX)
1163 :     91128 Palaiseau Cedex
1164 :     France.
1165 :     Date: 6/19/90
1166 :     Version: Standard ML of New Jersey, Version 0.56, 13 April 1990
1167 :     System: Sun 3/60, SunOS Release 4.0_Export
1168 :     Severity: major (?)
1169 :     Problem: Compiler Bug: abstractBody.abstractType 1
1170 :     Code: Too long, ommited.
1171 :     Transcript:
1172 :     - use "/home/icsla/deutsch/ESTFM/basic_ev.sml";
1173 :     [opening /home/icsla/deutsch/ESTFM/basic_ev.sml]
1174 :     [reading Powerset.bin... done]
1175 :     signature FunctionLattice
1176 :     signature ProductLattice
1177 :     signature OrderedSet
1178 :     signature Lattice
1179 :     signature Product
1180 :     signature PartialFunction
1181 :     signature TotalFunction
1182 :     functor Powerset
1183 :     [reading HashTable.bin... done]
1184 :     signature arrayext
1185 :     functor HashTable
1186 :     functor arrayext
1187 :     [reading lattice.sig.bin... done]
1188 :     signature FunctionLattice
1189 :     signature ProductLattice
1190 :     signature OrderedSet
1191 :     signature Lattice
1192 :     signature Product
1193 :     signature PartialFunction
1194 :     signature TotalFunction
1195 :     [reading Syntax.sig.bin... done]
1196 :     signature Syntax
1197 :     [reading StrgHash.sig.bin... done]
1198 :     signature StrgHash
1199 :     [reading Error.sig.bin... done]
1200 :     signature Error
1201 :     [reading ListUtilities.sig.bin...
1202 :     [Major collection... 66% used (2325300/3480644), 2680 msec]
1203 :    
1204 :     [Increasing heap to 7023k]
1205 :     done]
1206 :     signature ListUtilities
1207 :     [reading Io.sig.bin... done]
1208 :     signature Io
1209 :     [closing /home/icsla/deutsch/ESTFM/basic_ev.sml]
1210 :     /home/icsla/deutsch/ESTFM/basic_ev.sml:20.3 Compiler Bug: abstractBody.abstractType 1
1211 :     -
1212 :    
1213 :     Comments: the bug is not systematic, and hard to reproduce, this is why the
1214 :     source code has been ommited, as I have not been able to isolate the faulty part
1215 :     of the source.
1216 :    
1217 :     Status: fixed in 0.65 (same as 261)
1218 :     --------------------------------------------------------------------------------
1219 :     Number: 235
1220 :     Title: repeated type variables in typdesc and datdesc
1221 :     Keywords: modules, signatures, type variables, duplicate bindings
1222 :     Submitter: Don Sannella <dts@informatik.uni-Bremen.de>
1223 :     Date: 6/13/90
1224 :     Version: 0.44?
1225 :     Severity: major
1226 :     Problem:
1227 :     The Definition of SML seems to allow repeated type variables in a typdesc and
1228 :     datdesc, making the following signatures legal:
1229 :    
1230 :     signature SIG1 =
1231 :     sig
1232 :     eqtype ('a,'a) t1
1233 :     type ('a,'a) t2
1234 :     end
1235 :    
1236 :     signature SIG2 =
1237 :     sig
1238 :     datatype ('a,'a) t3 = foo of 'a
1239 :     end
1240 :    
1241 :     Section 2.9 forbids repeated variables in a typbind and datbind, but I don't
1242 :     see anything forbidding it in a typdesc or datdesc. I assume below that the
1243 :     omission of a syntactic restriction here was intentional.
1244 :    
1245 :     Repeated type variables in a typdesc seem unproblematic if strange, since the
1246 :     semantics only looks at the number of variables. SML-NJ accepts SIG1 above,
1247 :     and treats it the same as a signature without repeated type variables, which is
1248 :     correct.
1249 :    
1250 :     Repeated type variables in a datdesc are more of a problem, since the
1251 :     constructors refer to them. According to the Definition, foo in SIG2 above
1252 :     gets type 'a -> ('a,'a) t3. Both of the following structures then match SIG2:
1253 :    
1254 :     structure A =
1255 :     struct
1256 :     datatype ('a,'b) t3 = foo of 'a
1257 :     end
1258 :    
1259 :     structure B =
1260 :     struct
1261 :     datatype ('a,'b) t3 = foo of 'b
1262 :     end
1263 :    
1264 :     SML-NJ (version 0.44a) says foo : 'a -> ('a,'b) t3, which is wrong. The result
1265 :     of this is that A matches SIG2 but B does not. I don't know about Poly-SML,
1266 :     since I don't have it here.
1267 :     Status: fixed in 0.65
1268 :     --------------------------------------------------------------------------------
1269 :     Number: 236
1270 :     Title: Mach problems in 0.59
1271 :     Keywords:
1272 :     Submitter: David Tarditi
1273 :     Date: 6/18/90
1274 :     Version: 0.59
1275 :     System: Mach
1276 :     Severity: critical
1277 :     Comments:
1278 :     I have installed version 0.59 on Vaxes, Suns, and Pmaxes running Mach.
1279 :    
1280 :     There were two problems:
1281 :    
1282 :     VAX.prim.s contained a reference to the variable maskSignals.
1283 :     The name should be _maskSignals instead.
1284 :    
1285 :     The file export.c should also include the file ml_os.h, which
1286 :     contains some definitions needed for Decstations running Mach.
1287 :     Status: fixed in 0.60
1288 :     --------------------------------------------------------------------------------
1289 :     Number: 237
1290 :     Title: Can't parse most-negative integer constant
1291 :     Keywords:
1292 :     Submitter: David Berry
1293 :     Date: 6/5/90
1294 :     Version: 0.56
1295 :     System: All
1296 :     Severity: mild
1297 :     Comments:
1298 :    
1299 :     - ~1073741823;
1300 :     exception Overflow
1301 :    
1302 :     - ~1073741822;
1303 :     val it = ~1073741822: int
1304 :    
1305 :     - it - 1;
1306 :     val it = ~1073741823: int
1307 :    
1308 :     Status: fixed in 0.60
1309 :     --------------------------------------------------------------------------------
1310 :     Number: 238
1311 :     Title: div is unreliable at extremes
1312 :     Keywords:
1313 :     Submitter: Andrew Appel
1314 :     Date: 7/5/90
1315 :     Version: 0.56
1316 :     System: All
1317 :     Severity: mild
1318 :     Comments:
1319 :    
1320 :     - val a = ~1073741822 - 2;
1321 :     val a = ~1073741824: int
1322 :     - a div 2;
1323 :    
1324 :     uncaught exception Overflow;
1325 :    
1326 :     Status: fixed in 0.60
1327 :     --------------------------------------------------------------------------------
1328 :     Number: 239
1329 :     Title: INCONSISTENT exception raised in sharing analysis
1330 :     Keywords: modules, signatures, sharing, functors
1331 :     Submitter: Nick
1332 :     Date: 7/13/90
1333 :     Version: 0.56, 0.59
1334 :     System: <irrelevant>
1335 :     Severity: Serious
1336 :     Problem: Internal exception raised in the typechecker during sharing
1337 :     analysis
1338 :     Code:
1339 :    
1340 :     signature A =
1341 :     sig
1342 :     type A
1343 :     datatype Foo = FOO of A
1344 :     end;
1345 :    
1346 :     signature B = sig type B end;
1347 :    
1348 :     signature C = sig datatype C = C of int -> int end;
1349 :    
1350 :     functor XYZZY(structure A: A
1351 :     structure B: B sharing type A.A = B.B
1352 :     structure C: C sharing type C.C = B.B
1353 :     ) =
1354 :     struct
1355 :     end;
1356 :    
1357 :     Transcript:
1358 :    
1359 :     signature A =
1360 :     sig
1361 :     type A
1362 :     datatype Foo
1363 :     con FOO : A -> Foo
1364 :     end
1365 :     signature B =
1366 :     sig
1367 :     type B
1368 :     end
1369 :     signature C =
1370 :     sig
1371 :     datatype C
1372 :     con C : (int -> int) -> C
1373 :     end
1374 :     [closing Kit/foo.sml]
1375 :     uncaught exception INCONSISTENT
1376 :     Status: fixed in 0.61 (dbm)
1377 :     --------------------------------------------------------------------------------
1378 :     Number: 240
1379 :     Title: concrete printing of abstype value
1380 :     Keywords: types, abstypes, sharing
1381 :     Submitter: Allen Leung. allen@sbcs.sunysb.edu
1382 :     Date: 7/12/90
1383 :     Version: v59 4 June, 1990
1384 :     System: SUN 3 on bsd
1385 :     Severity: minor
1386 :     Problem: Toplevel printing of abstype is transparent.
1387 :     Code: - abstype Foo = Foo of int
1388 :     = with fun foo i = Foo i end
1389 :     = val bar = foo 0;
1390 :     > type Foo
1391 :     > val foo = fn : int -> Foo
1392 :     > val bar = Foo 0 : Foo (* instead of - : Foo *)
1393 :     -
1394 :     Transcript:
1395 :     Comments: Is this a new feature of v59+?
1396 :     It does help debugging.
1397 :     Status: fixed in 0.64
1398 :     --------------------------------------------------------------------------------
1399 :     Number: 241
1400 :     Title: sharing constraint error ignored
1401 :     Keywords: modules, signatures, functors, sharing
1402 :     Submitter: David Turner
1403 :     Date: 7/12/90
1404 :     Version: 0.59
1405 :     System: Sun4
1406 :     Severity: Slightly irritating
1407 :     Problem: Ignores error in sharing constraint even though it
1408 :     obviously detects it.
1409 :    
1410 :     Input:
1411 :     - signature S = sig type t end;
1412 :    
1413 :     - functor F
1414 :     (structure A : S
1415 :     structure B : S
1416 :     sharing type B.t = A.s) = struct end;
1417 :    
1418 :     Output:
1419 :     Error: unbound type in structure: s
1420 :     functor F : <sig>
1421 :     Comment:
1422 :     Nonstandard function used in doSharing to report the bug.
1423 :     In 0.65 error message is:
1424 :     std_in:9.6-11.23 Error: unbound type in structure: s
1425 :     This doesn't provide as much useful information as it should. Error
1426 :     message should read something like "unbound type A.s in sharing spec".
1427 :    
1428 :     Status: fixed in 0.65
1429 :     -------------------------------------------------------------------------------
1430 :     Number: 242
1431 :     Title: incorrect forward referencing allowed
1432 :     Keywords: modules, functors, scoping
1433 :     Submitter: Nick
1434 :     Date: 7/12/90
1435 :     Version: 0.56, 0.59
1436 :     System: Irrelevant
1437 :     Severity: Major (& Embarrassing?)
1438 :     Problem: Incorrect forward referencing when analysing SPECs in
1439 :     functor arguments.
1440 :    
1441 :     Input:
1442 :     signature SIG = sig type t end
1443 :    
1444 :     functor F(structure STR1: sig type t end sharing type STR1.t = Foo.t
1445 :     structure Foo: SIG
1446 :     ) = struct end;
1447 :    
1448 :     Output:
1449 :     functor F: <sig>
1450 :    
1451 :     Status: fixed in 0.73
1452 :     --------------------------------------------------------------------------------
1453 :     Number: 243
1454 :     Title: include compiler bug
1455 :     Keywords: modules, signatures, include
1456 :     Submitter: Nick Rothwell <nick@lfcs.edinburgh.ac.uk>
1457 :     Date: 7/5/90
1458 :     Version: 0.59
1459 :     Problem:
1460 :     The following file produces the error
1461 :    
1462 :     Compiler bug: Parse.includeSig.newTyc.
1463 :     Code:
1464 :     (* This "batch" file has been generated from the original
1465 :     sources by MAKE. If you want to make alterations, make them
1466 :     to the originals, and execute Make.make_task again. *)
1467 :    
1468 :     (*$DECTREE_DT*)
1469 :     (* Just the bare datatype for decision trees. *)
1470 :    
1471 :     signature DECTREE_DT =
1472 :     sig
1473 :     type lab
1474 :     type lvar
1475 :     type longvar
1476 :     type longcon
1477 :     type longexcon
1478 :     type scon
1479 :     type pat
1480 :     type type_info
1481 :     eqtype (*pah!*) RuleNum sharing type RuleNum = int
1482 :     type Decision
1483 :     type (''a, 'b) map
1484 :    
1485 :     datatype 'a option = NONE | SOME of 'a
1486 :    
1487 :     datatype DecisionTree =
1488 :     LAB_DECOMPOSE of {bind: lvar,
1489 :     parent: lvar,
1490 :     lab: lab,
1491 :     child: DecisionTree,
1492 :     info: type_info
1493 :     }
1494 :     | CON_DECOMPOSE of {bind: lvar, parent: lvar, child: DecisionTree}
1495 :     | EXCON_DECOMPOSE of {bind: lvar, parent: lvar, child: DecisionTree}
1496 :    
1497 :     | CON_SWITCH of {arg: lvar,
1498 :     selections: (longcon, DecisionTree) map,
1499 :     wildcard: DecisionTree option,
1500 :     (* An `option' because we may notice that all
1501 :     the constructors are present. *)
1502 :     info: type_info
1503 :     }
1504 :     | SCON_SWITCH of {arg: lvar,
1505 :     selections: (scon, DecisionTree) map,
1506 :     wildcard: DecisionTree
1507 :     }
1508 :     | EXCON_SWITCH of {arg: lvar,
1509 :     selections: (longexcon * DecisionTree) list,
1510 :     wildcard: DecisionTree
1511 :     }
1512 :    
1513 :     | END of {ruleNum: RuleNum,
1514 :     environment: (longvar, lvar) map
1515 :     }
1516 :    
1517 :     | FAIL
1518 :     end;
1519 :    
1520 :     (*$MATCH_COMPILER: DECTREE_DT*)
1521 :    
1522 :     (* The match compiler interface; the actual match compiler is built from
1523 :     a number of sub-functors, but this top-level interface is the only one
1524 :     which the rest of the compiler cares about. Given a series of patterns,
1525 :     it returns a DecisionTree (which is essentially an abstract form of the
1526 :     final lambda-code), in which all the lvars for identifiers and temporaries
1527 :     have been generated. At each leaf of the decision tree, there's a
1528 :     single rule number (the rule reached by this series of decisions), and an
1529 :     environment from identifiers to lvars, which is used to compile the
1530 :     right-hand-side expression for this rule. Nice, huh? *)
1531 :    
1532 :     signature MATCH_COMPILER =
1533 :     sig
1534 :     include DECTREE_DT
1535 :    
1536 :     val matchCompiler:
1537 :     lvar * pat list * {warnInexhaustive: bool, warnNoBindings: bool}
1538 :     -> DecisionTree (* these flags are set when the
1539 :     warnings are required. *)
1540 :    
1541 :     type StringTree
1542 :     val layoutDecisionTree: DecisionTree -> StringTree
1543 :     end;
1544 :    
1545 :     Status: fixed in 0.69
1546 :     -------------------------------------------------------------------------------
1547 :     Number: 244
1548 :     Title: compiler bug on product of large integer constants on SPARC
1549 :     Keywords:
1550 :     Submitter: Bennet Vance (bennet@cse.ogi.edu)
1551 :     Date: 7/1/90
1552 :     Version: 0.59
1553 :     System: Sun 4/60 - SunOS Release 4.0.3c
1554 :     Severity: minor
1555 :     Problem: compiler bug on large products of integer constants
1556 :     Transcript:
1557 :    
1558 :     val it = () : unit
1559 :     - 2*268435455;
1560 :     val it = 536870910 : int
1561 :     - 2*268435456;
1562 :     Error: Compiler bug: [SparcCM.ashr]
1563 :     Status: fixed in 0.61 (jhr)
1564 :     --------------------------------------------------------------------------------
1565 :     Number: 245
1566 :     Title: NeXT installation problem
1567 :     Keywords:
1568 :     Submitter: Lyman Taylor ( respond to lyman@portia.stanford.edu )
1569 :     Date: 07/12/90
1570 :     Version: 0.56
1571 :     System: NeXT , 8M , hard disk , & OD ( build done on OD )
1572 :     Severity: major
1573 :     Problem: install script does not excute
1574 :     Code: none
1575 :     Transcript: following ouput of makeml ( machine name helen )
1576 :    
1577 :     helen> makeml -next
1578 :     makeml> (cd runtime; make clean)
1579 :     rm -f *.o lint.out prim.s linkdata allmo.s run
1580 :     makeml> rm -f mo
1581 :     makeml> ln -s ../mo.m68 mo
1582 :     makeml> (cd runtime; rm -f run allmo.o)
1583 :     makeml> (cd runtime; make MACHINE=M68 'DEFS= -DBSD -DNeXT -DRUNTIME=\"runtime\"' linkdata)
1584 :     cc -O -DM68 -DBSD -DNeXT -DRUNTIME=\"runtime\" -o linkdata linkdata.c
1585 :     makeml> runtime/linkdata [runtime/IntM68.mos]
1586 :     runtime/linkdata> as runtime/allmo.s -o runtime/allmo.o
1587 :     makeml> (cd runtime; make MACHINE=M68 'DEFS= -DBSD -DNeXT' CPP=/lib/cpp 'CFL=' 'AS=as')
1588 :     cc -O -DM68 -DBSD -DNeXT -c run.c
1589 :     ml_os.h:113: can't find include file `sys/syscall.h'
1590 :     *** Exit 1
1591 :     Stop.
1592 :    
1593 :     Comments: I'm not skilled at development for the NeXT. I was just looking
1594 :     to compile the latest version of SMLNJ so I could try it out
1595 :     there is an older version ( 0.43 ) on the Sparcs around here
1596 :     but the Next allows me to dump all this onto an OD so noone
1597 :     can complain about the space all the source is taking up.
1598 :    
1599 :     Status: fixed in 0.59 (jhr)
1600 :     --------------------------------------------------------------------------------
1601 :     Number: 246
1602 :     Title: repeated import consumes too much memory
1603 :     Keywords:
1604 :     Submitter: Peter Canning <canning@hplabs.hp.com>
1605 :     Date: 6/27/90
1606 :     Version: 0.56
1607 :     System: HP900S370 (m68030) HP-UX 7.0
1608 :     Severity: major
1609 :     Problem: repeated use of the import facility causes the heap to grow
1610 :     Comments:
1611 :     In particular, if I repeatedly modify a file, import the file, then run the
1612 :     program defined in the file (the standard edit/compile/debug loop), my sml
1613 :     image seems to grow (and never shink again). When I was just using "use",
1614 :     sml would garbage collect freqently, but the process size would stay between
1615 :     4000 and 5000 Kbytes. Using import (working on the same program), the
1616 :     process has grown as large as 11000 Kbytes. It appears that for some reason
1617 :     some data related to importing/compiling files is not being reclaimed by the
1618 :     garbage collector.
1619 :     Status: not a bug --- (defunct feature)
1620 :     --------------------------------------------------------------------------------
1621 :     Number: 247
1622 :     Title: close_out std_out
1623 :     Keywords:
1624 :     Submitter: Mark R. Leone <mleone@cs.cmu.edu>
1625 :     Date: 6/29/90
1626 :     Version: 0.59
1627 :     Problem:
1628 :     If standard output is closed, the top level exits ungracefully:
1629 :     Transcript:
1630 :     [r.ergo]/usr/mleone/sml/hypo-pl> sml
1631 :     Standard ML of New Jersey, Version 0.59, 4 June 1990
1632 :     Warning: input and output are now uncurried, arithmetic exceptions
1633 :     are re-arranged, div and mod are different; see doc/NEWS
1634 :     val it = () : unit
1635 :     - close_out std_out;
1636 :     Uncaught exception Io with "output "<std_out>": closed outstream"
1637 :     Status: not a bug
1638 :     --------------------------------------------------------------------------------
1639 :     Number: 248
1640 :     Title: abstract types are not abstract
1641 :     Keywords: types, abstypes
1642 :     Submitter: Dave MacQueen
1643 :     Date: 7/16/90
1644 :     Version: 0.59 (0.57 and later)
1645 :     Severity: major
1646 :     Problem:
1647 :     Abstract types defined by abstype declarations are not made abstract
1648 :     (i.e. converted from DATAtyc to ABStyc form), and their equality property
1649 :     is not reset to NO. Equality properties of types defined in terms of the
1650 :     abstype are not recomputed (see bug 231.)
1651 :     Comments:
1652 :     After the abstype body has been processed, the concrete form of the abstract
1653 :     types must be replaced by the abstract form throughout the 'signature' of the
1654 :     exported bindings (values, constructors, types). Also equality properties
1655 :     of exported types have to be reevaluated.
1656 :     Currently, there is a function that attempts to transform the tycons in the
1657 :     type checker, but it affects only the abstract syntax, and not the static
1658 :     environment. The problem results from the removal of the ref around tycons
1659 :     in 0.57.
1660 :     Status: fixed in 0.64
1661 :     --------------------------------------------------------------------------------
1662 :     Number: 249
1663 :     Title: separate compilation printing problems
1664 :     Keywords:
1665 :     Submitter: Nick Rothwell <nick@lfcs.ed.ac.uk> (also Richard O'Neill)
1666 :     Date: 7/5/90
1667 :     Version: 0.59
1668 :     Severity: minor
1669 :     Problem:
1670 :     0. If only one or other of the files exists (say, Foo.sml without Foo.bin
1671 :     or vice versa), the exception SystemCall gets raised.
1672 :    
1673 :     1. The error message
1674 :    
1675 :     [Foo.bin is in the wrong format; recompiling]
1676 :    
1677 :     seems to have lost its closing "]" in 0.59.
1678 :    
1679 :     2. The final bindings from a separately compiled module get
1680 :     printed on one line, as in:
1681 :    
1682 :     signature Asignature Bsignature Csignature D-
1683 :    
1684 :     rather than
1685 :    
1686 :     signature A
1687 :     signature B
1688 :     etc.
1689 :     Fix: (Richard O'Neill)
1690 :     For some reason the function printBindingTbl in print/printdec.sml was changed
1691 :     from its form in release 0.56 to a slightly modified forn in 0.59. The new
1692 :     form is functionally equivalent appart from omiting to generate newlines.
1693 :    
1694 :     Fix (currently untried):
1695 :    
1696 :     Return printBindingTbl to it 0.56 form.
1697 :     Status: fixed in 0.64 (?)
1698 :     --------------------------------------------------------------------------------
1699 :     Number: 250
1700 :     Title: interpreter broken
1701 :     Keywords:
1702 :     Submitter: Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
1703 :     Date: 7/17/90
1704 :     Version: 0.59
1705 :     System: Sun3, SunOS 4.1
1706 :     Severity: Major
1707 :     Problem:
1708 :    
1709 :     In interpret mode, version 0.59 fails with no explanation when compiling a
1710 :     grammar from mlyacc (slightly modified to use 'import'), whilst in compile
1711 :     mode, the grammar is compiled correctly. Version 0.56 does not exhibit the same
1712 :     problem.
1713 :    
1714 :     This seems a significant problem since using compile mode takes significant
1715 :     time and memory. Equally, I cannot use version 0.56 due to some of its bugs
1716 :     which manifest themselves when compiling other modules.
1717 :    
1718 :     I have not included the files as they are rather long (being an mlyacc
1719 :     generated parser and the relevant support files). I can supply you with a
1720 :     uuencoded compressed tar archive of them all if you desire.
1721 :    
1722 :     Transcript:
1723 :    
1724 :     unix% sml
1725 :     Standard ML of New Jersey, Version 0.59, 4 June 1990
1726 :     - System.Control.interp;
1727 :     val it = ref true : bool ref
1728 :     - import "clean.grm";
1729 :     [clean.grm.bin is out of date; recompiling]
1730 :     [reading clean.grm.sml]
1731 :     [reading lib/token.sig.bin... done]
1732 :     [closing clean.grm.sml]
1733 :     IMPORT failed (compile-time exception: SystemCall)
1734 :     - import "clean.grm";
1735 :     [clean.grm.bin is out of date; recompiling]
1736 :     [reading clean.grm.sml]
1737 :     [reading lib/token.sig.bin... done]
1738 :     [reading clean.grm.sig.bin... done]
1739 :    
1740 :     [Major collection... 60% used (648480/1067380), 1900 msec]
1741 :    
1742 :     [Major collection... 96% used (1015412/1055228), 3000 msec]
1743 :    
1744 :     [Increasing heap to 3088k]
1745 :    
1746 :     [Major collection... 96% used (1526764/1586468), 4740 msec]
1747 :    
1748 :     [Increasing heap to 4640k]
1749 :    
1750 :     [Major collection... 96% used (2287536/2378284), 7480 msec]
1751 :    
1752 :     [Increasing heap to 6952k]
1753 :    
1754 :     [Major collection...
1755 :     [Increasing heap to 10528k]
1756 :     96% used (3515248/3635044), 11120 msec]
1757 :    
1758 :     [Increasing heap to 10632k]
1759 :     [closing clean.grm.sml]
1760 :     IMPORT failed (compile-time exception: Cascade)
1761 :     - ^D
1762 :    
1763 :     unix% old-sml
1764 :     Standard ML of New Jersey, Version 0.56, 13 April 90
1765 :     val it = () : unit
1766 :     - System.Control.interp;
1767 :     val it = ref true : bool ref
1768 :     - import "clean.grm";
1769 :     [clean.grm.bin is out of date; recompiling]
1770 :     [reading clean.grm.sml]
1771 :     [reading lib/token.sig.bin... ]
1772 :     [lib/token.sig.bin is the wrong format; recompiling]
1773 :     [closing lib/token.sig.bin]
1774 :     [reading lib/token.sig.sml]
1775 :     [reading lib/lrtable.sig.bin... ]
1776 :     [lib/lrtable.sig.bin is the wrong format; recompiling]
1777 :     [closing lib/lrtable.sig.bin]
1778 :     [reading lib/lrtable.sig.sml]
1779 :     [writing lib/lrtable.sig.bin... done]
1780 :     [closing lib/lrtable.sig.sml]
1781 :     [writing lib/token.sig.bin... done]
1782 :     [closing lib/token.sig.sml]
1783 :     [reading clean.grm.sig.bin... ]
1784 :     [clean.grm.sig.bin is the wrong format; recompiling]
1785 :     [closing clean.grm.sig.bin]
1786 :     [reading clean.grm.sig.sml]
1787 :     [reading lib/parserdata.sig.bin... ]
1788 :     [lib/parserdata.sig.bin is the wrong format; recompiling]
1789 :     [closing lib/parserdata.sig.bin]
1790 :     [reading lib/parserdata.sig.sml]
1791 :     [reading lib/token.sig.bin... ]
1792 :     [import(s) of lib/token.sig are out of date; recompiling]
1793 :     [closing lib/token.sig.bin]
1794 :     [reading lib/token.sig.sml]
1795 :     [reading lib/lrtable.sig.bin... done]
1796 :     [writing lib/token.sig.bin... done]
1797 :     [closing lib/token.sig.sml]
1798 :     [reading lib/lrtable.sig.bin... done]
1799 :     [writing lib/parserdata.sig.bin... done]
1800 :     [closing lib/parserdata.sig.sml]
1801 :     [writing clean.grm.sig.bin... done]
1802 :     [closing clean.grm.sig.sml]
1803 :    
1804 :    
1805 :     [Major collection... 66% used (1058292/1581868), 3360 msec]
1806 :    
1807 :     [Increasing heap to 3249k]
1808 :    
1809 :     [Major collection... 96% used (1629952/1687576), 5020 msec]
1810 :    
1811 :     [Increasing heap to 4929k]
1812 :    
1813 :     [Major collection... 96% used (2478864/2562240), 7800 msec]
1814 :    
1815 :     [Increasing heap to 7481k]
1816 :    
1817 :     [Major collection... 30% used (1226344/3978648), 4200 msec]
1818 :    
1819 :     [Decreasing heap to 4153k]
1820 :    
1821 :     [Major collection... 92% used (1982616/2147092), 6060 msec]
1822 :    
1823 :     [Increasing heap to 6081k]
1824 :    
1825 :     [Major collection... 85% used (2731764/3199400), 8480 msec]
1826 :    
1827 :     [Increasing heap to 8593k]
1828 :    
1829 :     [Major collection... 62% used (2809816/4478688), 9180 msec]
1830 :    
1831 :     [Increasing heap to 8657k]
1832 :    
1833 :     [Major collection... 60% used (2770384/4573952), 8920 msec]
1834 :    
1835 :     [Major collection... 62% used (2804296/4452412), 8980 msec]
1836 :    
1837 :     [Increasing heap to 8721k]
1838 :    
1839 :     [Major collection... 67% used (3031468/4473120), 8700 msec]
1840 :    
1841 :     [Increasing heap to 9033k]
1842 :     [writing clean.grm.bin... done]
1843 :     [closing clean.grm.sml]
1844 :     signature Clean_TOKENS
1845 :     signature TOKEN
1846 :     signature PARSER_DATA
1847 :     signature Clean_LRVALS
1848 :     signature LR_TABLE
1849 :     functor CleanLrValsFun
1850 :     - ^D
1851 :    
1852 :     unix% sml
1853 :     Standard ML of New Jersey, Version 0.59, 4 June 1990
1854 :     - System.Control.interp := false;
1855 :     val it = () : unit
1856 :     - import "clean.grm";
1857 :     [reading clean.grm.bin... ]
1858 :     [clean.grm.bin is the wrong format; recompiling
1859 :     [closing clean.grm.bin]
1860 :     [reading clean.grm.sml]
1861 :     [reading lib/token.sig.bin... ]
1862 :     [lib/token.sig.bin is the wrong format; recompiling
1863 :     [closing lib/token.sig.bin]
1864 :     [reading lib/token.sig.sml]
1865 :     [reading lib/lrtable.sig.bin... ]
1866 :     [lib/lrtable.sig.bin is the wrong format; recompiling
1867 :     [closing lib/lrtable.sig.bin]
1868 :     [reading lib/lrtable.sig.sml]
1869 :     [writing lib/lrtable.sig.bin... done]
1870 :     [closing lib/lrtable.sig.sml]
1871 :     [writing lib/token.sig.bin... done]
1872 :     [closing lib/token.sig.sml]
1873 :     [reading clean.grm.sig.bin... ]
1874 :     [clean.grm.sig.bin is the wrong format; recompiling
1875 :     [closing clean.grm.sig.bin]
1876 :     [reading clean.grm.sig.sml]
1877 :     [reading lib/parserdata.sig.bin... ]
1878 :     [lib/parserdata.sig.bin is the wrong format; recompiling
1879 :     [closing lib/parserdata.sig.bin]
1880 :     [reading lib/parserdata.sig.sml]
1881 :     [reading lib/token.sig.bin... done]
1882 :     [reading lib/lrtable.sig.bin... done]
1883 :     [writing lib/parserdata.sig.bin... done]
1884 :     [closing lib/parserdata.sig.sml]
1885 :     [writing clean.grm.sig.bin... done]
1886 :     [closing clean.grm.sig.sml]
1887 :    
1888 :     [Major collection... 61% used (679180/1109552), 2060 msec]
1889 :    
1890 :     [Increasing heap to 2240k]
1891 :    
1892 :     [Major collection... 80% used (932040/1158752), 2780 msec]
1893 :    
1894 :     [Increasing heap to 2848k]
1895 :    
1896 :     [Major collection... 95% used (1403328/1463408), 4240 msec]
1897 :    
1898 :     [Increasing heap to 4272k]
1899 :    
1900 :     [Major collection... 96% used (2109420/2194020), 6680 msec]
1901 :    
1902 :     [Increasing heap to 6408k]
1903 :    
1904 :     [Major collection...
1905 :     [Increasing heap to 9656k]
1906 :     96% used (3255168/3361612), 10700 msec]
1907 :    
1908 :     [Increasing heap to 9824k]
1909 :    
1910 :     [Major collection... 36% used (1914068/5201708), 6400 msec]
1911 :    
1912 :     [Decreasing heap to 6208k]
1913 :    
1914 :     [Major collection... 85% used (2811340/3298792), 8620 msec]
1915 :    
1916 :     [Increasing heap to 8816k]
1917 :    
1918 :     [Major collection... 61% used (2810740/4607236), 8320 msec]
1919 :    
1920 :     [Major collection... 63% used (2882812/4569184), 8900 msec]
1921 :    
1922 :     [Increasing heap to 8928k]
1923 :    
1924 :     [Major collection... 57% used (2705236/4669212), 8360 msec]
1925 :    
1926 :     [Major collection... 61% used (2854268/4612180), 8560 msec]
1927 :     [writing clean.grm.bin... done]
1928 :     [closing clean.grm.sml]
1929 :     signature Clean_TOKENSsignature TOKENsignature PARSER_DATAsignature Clean_LRVALSsignature LR_TABLEfunctor CleanLrValsFun-
1930 :    
1931 :     Comment: import and interpreter mode are currently incompatible
1932 :    
1933 :     Status: not a bug
1934 :     -------------------------------------------------------------------------------
1935 :     Number: 251
1936 :     Title: omits tests for repeated bindings
1937 :     Keywords: duplicate bindings
1938 :     Submitter: Dave Berry db@lfcs.ed.ac.uk
1939 :     Date: 7/18/90
1940 :     Version: 0.59
1941 :     System: All (I presume; actually tested on a Sun 3 with SunOS 4.0)
1942 :     Severity: minor
1943 :     Problem: omits tests for repeated bindings
1944 :     Code:
1945 :    
1946 :     type t = int and t = string;
1947 :    
1948 :     exception E and E;
1949 :    
1950 :     val rec f = fn x => x + 1
1951 :     and f = fn n => if n > 0 then 1 else n * f (n - 1);
1952 :    
1953 :     Transcript:
1954 :    
1955 :     - type t = int and t = string;
1956 :     type t = int
1957 :     type t = string
1958 :    
1959 :     - exception E and E;
1960 :     exception E
1961 :     exception E
1962 :    
1963 :     - val rec f = fn x => x + 1
1964 :     = and f = fn n => if n > 0 then 1 else n * f (n - 1);
1965 :     val f = fn : int -> int
1966 :     val f = fn : int -> int
1967 :    
1968 :     Comments:
1969 :    
1970 :     I expect that few people would make these mistakes in "real"
1971 :     code, but they might be more common when teaching.
1972 :    
1973 :     The tests are made for repeated constructors in a datatype,
1974 :     and in some (non-recursive?) value bindings, e.g.
1975 :    
1976 :     - datatype a = A | A;
1977 :     std_in:3.14-3.18 Error: duplicate constructor name
1978 :    
1979 :     - val a = 1 and a = 2;
1980 :     std_in:2.5-2.19 Error: duplicate variable-name `a' in pattern(s)
1981 :    
1982 :     Page 9 is the relevant part of the definition.
1983 :    
1984 :     Status: fixed in 0.65
1985 :     --------------------------------------------------------------------------------
1986 :     Number: 252
1987 :     Title: include broken in 0.59
1988 :     Keywords: modules, signatures, sharing, include
1989 :     Submitter: Nick
1990 :     Date: 7/17/90
1991 :     Version: 0.59
1992 :     System: Irrelevant
1993 :     Severity: Major
1994 :     Problem: Inclusion of signatures with shared types: >Blam!<.
1995 :     Code:
1996 :    
1997 :     signature SIG1 = sig type ty sharing type ty = int end;
1998 :    
1999 :     signature SIG2 = sig include SIG1 end;
2000 :    
2001 :     Transcript:
2002 :    
2003 :     signature SIG1 =
2004 :     sig
2005 :     eqtype ty
2006 :     end
2007 :     Error: Compiler bug: Parse.includeSig.newTyc
2008 :    
2009 :     Comments: Works in 0.56 (which has different problems - see a previous
2010 :     report).
2011 :     Status: fixed in 0.64
2012 :     --------------------------------------------------------------------------------
2013 :     Number: 253
2014 :     Title: SML Dumping core compiling mlyacc with -pervshare
2015 :     Keywords:
2016 :     Submitter: Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
2017 :     Date: 7/18/90
2018 :     Version: 0.59
2019 :     System: Sun3/50, SunOS 4.1
2020 :     Severity: You decide...
2021 :     Problem:
2022 :    
2023 :     Attempting to compile mlyacc (as supplied with version 0.56 of SML of NJ)
2024 :     with a '-pervshare' version of SML of NJ 0.59 causes a Segmentation Fault.
2025 :    
2026 :     This does not seem to happen with the sharable SML compiler.
2027 :    
2028 :     I have the core dump if that would help...
2029 :    
2030 :     Status: fixed in 0.74 --- sometime between 0.59 and 0.74
2031 :     --------------------------------------------------------------------------------
2032 :     Number: 254
2033 :     Title: failure to detect type error
2034 :     Keywords: modules, functors, types
2035 :     Submitter: Andrew Appel
2036 :     Date: 7/23/90
2037 :     Version: 0.60
2038 :     Severity: critical
2039 :     Problem: type error not detected
2040 :     Code:
2041 :     signature SIG = sig
2042 :     type EA
2043 :     val fopt : ((EA * EA) -> unit) option
2044 :     end
2045 :    
2046 :     functor CPSgen(M: SIG) : sig end =
2047 :     struct
2048 :     val g =
2049 :     case M.fopt
2050 :     of SOME f => let fun h x = f (x,x)
2051 :     in h
2052 :     end
2053 :     val x = g 2
2054 :     end
2055 :     Comments:
2056 :     Caused by missing case in scan function in the definition of Unify.instantiate.
2057 :     Status: fixed in 0.61 (dbm)
2058 :     --------------------------------------------------------------------------------
2059 :     Number: 255
2060 :     Title: space leak with redeclaration of variables
2061 :     Keywords:
2062 :     Submitter: John Reppy
2063 :     Date: 7/24/90
2064 :     Version: 0.60
2065 :     Severity: major
2066 :     Problem:
2067 :     I think that there is a space leak in the top-level loop/environment.
2068 :     If I keep redefining the same identifiers, the amount of live data
2069 :     grows, when it should be fairly constant. I assume that the problem
2070 :     is that the top-level symbol table is holding onto something it shouldn't.
2071 :     Transcript:
2072 :     Here is a simple demonstration of the space leak (60 bytes/iteration):
2073 :    
2074 :     Standard ML of New Jersey, Version 0.60, 13 July 1990
2075 :     val it = () : unit
2076 :     - structure S = struct val _ = System.Unsafe.CInterface.gc 1 end;
2077 :    
2078 :     [Major collection... 98% used (516680/526692), 610 msec]
2079 :     structure S :
2080 :     sig
2081 :     end
2082 :     - structure S = struct val _ = System.Unsafe.CInterface.gc 1 end;
2083 :    
2084 :     [Major collection... 98% used (517100/525980), 550 msec]
2085 :     structure S :
2086 :     sig
2087 :     end
2088 :     - structure S = struct val _ = System.Unsafe.CInterface.gc 1 end;
2089 :    
2090 :     [Major collection... 98% used (517160/526388), 550 msec]
2091 :     structure S :
2092 :     sig
2093 :     end
2094 :     - structure S = struct val _ = System.Unsafe.CInterface.gc 1 end;
2095 :    
2096 :     [Major collection... 98% used (517220/526448), 550 msec]
2097 :     structure S :
2098 :     sig
2099 :     end
2100 :     - structure S = struct val _ = System.Unsafe.CInterface.gc 1 end;
2101 :    
2102 :     [Major collection... 98% used (517280/526508), 540 msec]
2103 :     structure S :
2104 :     sig
2105 :     end
2106 :    
2107 :     Comment: (appel) This is the top-level line-number information, and
2108 :     is a few bytes per line, regardless of size of defined structures.
2109 :     Status: fixed in 0.65 (actually, it's now a 48-byte leak)
2110 :     -------------------------------------------------------------------------------
2111 :     Number: 256
2112 :     Title: mcopt compiler bug with improper function definition
2113 :     Keywords:
2114 :     Submitter: John Mitchell (jcm@iswim.stanford.edu)
2115 :     Date: 7/24/90
2116 :     Version: 0.60
2117 :     Severity: critical
2118 :     Problem:
2119 :     Compiler bug "r_o in mcopt" raised as a result of improper clausal
2120 :     function definition.
2121 :     Transcript:
2122 :     - datatype 'a stack = empty | stk of 'a *'a stack;
2123 :     datatype 'a stack
2124 :     con empty : 'a stack
2125 :     con stk : 'a * 'a stack -> 'a stack
2126 :     - fun pop stk(e,s) = s;
2127 :     Error: Compiler bug: r_o in mcopt
2128 :    
2129 :     adding parens fixes the problem, so not serious as is:
2130 :    
2131 :     fun pop (stk (e,s)) = s;
2132 :     std_in:2.5-2.23 Warning: match not exhaustive
2133 :     stk (e,s) => ...
2134 :     val pop = fn : 'a stack -> 'a stack
2135 :    
2136 :     >Submitter: Sergio Antoy, antoy@vtodie.cs.vt.edu
2137 :     >Date: 8/9/90
2138 :     >Version: SML of NJ version number 056
2139 :     >System: DEC3100 V2.2 (Rev. 15)
2140 :     >Severity:
2141 :     >Problem: "using" following file sml generates "Compiler bug" msg
2142 :     >Code:
2143 :     datatype 'a Xlist
2144 :     = Xnil
2145 :     | Xcons of 'a * 'a Xlist
2146 :     | Xappend of 'a Xlist * 'a Xlist;
2147 :    
2148 :     fun incr Xappend(Xnil,Xnil) = Xnil
2149 :     | incr Xappend(Xnil,Xcons(a,b)) = Xcons(a,b);
2150 :     Transcript:
2151 :     goliat[8]% sml
2152 :     Standard ML of New Jersey, Version 0.56, 13 April 1990
2153 :     Warning: input and output are now uncurried, arithmetic exceptions
2154 :     are re-arranged, div and mod are different; see doc/NEWS
2155 :     val it = () : unit
2156 :     - use "trans.sml";
2157 :     [opening trans.sml]
2158 :     datatype 'a Xlist
2159 :     con Xappend : 'a Xlist * 'a Xlist -> 'a Xlist
2160 :     con Xcons : 'a * 'a Xlist -> 'a Xlist
2161 :     con Xnil : 'a Xlist
2162 :     Error: Compiler bug: r_o in mcopt
2163 :     [closing trans.sml]
2164 :     -
2165 :     Status: fixed in 0.62?
2166 :     --------------------------------------------------------------------------------
2167 :     Number: 257
2168 :     Title: Compiler bug: EnvAccess.lookPath with imported functors (bug 214 again)
2169 :     Keywords: modules, functors
2170 :     Submitter: Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
2171 :     Date: 7/30/90
2172 :     Version: 0,59, 0.60
2173 :     System: Sun3/180, SunOS 4.1
2174 :     Severity: Major
2175 :     Problem:
2176 :    
2177 :     Bug #214 ('Compiler bug: EnvAccess.lookPath occurs when printing a top level
2178 :     result') has not been laid to rest, it still occurs with imported functors.
2179 :    
2180 :     Transcript:
2181 :    
2182 :     unix% cat > one.sml
2183 :    
2184 :     functor classes () =
2185 :     struct
2186 :     datatype symbol_class =
2187 :     DataClass of data_class
2188 :     | SpecialClass of special_class
2189 :    
2190 :     and data_class = Int | Real | Bool | String
2191 :     and special_class = Any | None
2192 :     end
2193 :     ^D
2194 :     unix% cat > two.sml
2195 :    
2196 :     signature classes =
2197 :     sig
2198 :     datatype symbol_class =
2199 :     DataClass of data_class
2200 :     | SpecialClass of special_class
2201 :    
2202 :     and data_class = Int | Real | Bool | String
2203 :     and special_class = Any | None
2204 :     end
2205 :    
2206 :     functor nodes ( structure Classes : classes ) =
2207 :     struct
2208 :     structure Classes = Classes
2209 :     local
2210 :     open Classes
2211 :     in
2212 :     datatype node =
2213 :     ClassNode of symbol_class
2214 :     | ValueNode of data_class
2215 :     end
2216 :     end
2217 :     ^D
2218 :     unix% sml
2219 :     Standard ML of New Jersey, Version 0.60, 13 July 1990
2220 :     val it = () : unit
2221 :     - import "one" "two";
2222 :     [reading one.sml]
2223 :     [writing one.bin... done]
2224 :     [closing one.sml]
2225 :     functor classes
2226 :     [reading two.sml]
2227 :     [writing two.bin... done]
2228 :     [closing two.sml]
2229 :     signature classes
2230 :     functor nodes
2231 :     - structure Classes = classes ()
2232 :     = structure Nodes = nodes ( structure Classes = Classes )
2233 :     = open Classes Nodes ;
2234 :     structure Classes :
2235 :     sig
2236 :     datatype special_class
2237 :     con Any : special_class
2238 :     con None : special_class
2239 :     datatype symbol_class
2240 :     con DataClass : data_class -> symbol_class
2241 :     con SpecialClass : special_class -> symbol_class
2242 :     datatype data_class
2243 :     con Bool : data_class
2244 :     con Int : data_class
2245 :     con Real : data_class
2246 :     con String : data_class
2247 :     end
2248 :     structure Nodes :
2249 :     sig
2250 :     structure Classes : sig...end
2251 :     datatype node
2252 :     con ClassNode : symbol_class -> node
2253 :     con ValueNode : data_class -> node
2254 :     end
2255 :     open Classes Nodes
2256 :     - ClassNode (DataClass Int);
2257 :     val it = ClassNode Error: Compiler bug: EnvAccess.lookPath
2258 :     - ValueNode Int;
2259 :     val it = ValueNode Int : node
2260 :     - ^D
2261 :     unix% sml
2262 :     Standard ML of New Jersey, Version 0.60, 13 July 1990
2263 :     val it = () : unit
2264 :     - app use ["one.sml","two.sml"];
2265 :     [opening one.sml]
2266 :     functor classes : <sig>
2267 :     [closing one.sml]
2268 :     [opening two.sml]
2269 :     signature classes =
2270 :     sig
2271 :     datatype special_class
2272 :     con Any : special_class
2273 :     con None : special_class
2274 :     datatype symbol_class
2275 :     con DataClass : data_class -> symbol_class
2276 :     con SpecialClass : special_class -> symbol_class
2277 :     datatype data_class
2278 :     con Bool : data_class
2279 :     con Int : data_class
2280 :     con Real : data_class
2281 :     con String : data_class
2282 :     end
2283 :     functor nodes : <sig>
2284 :     [closing two.sml]
2285 :     val it = () : unit
2286 :     - structure Classes = classes ()
2287 :     = structure Nodes = nodes ( structure Classes = Classes )
2288 :     = open Classes Nodes ;
2289 :     structure Classes :
2290 :     sig
2291 :     datatype special_class
2292 :     con Any : special_class
2293 :     con None : special_class
2294 :     datatype symbol_class
2295 :     con DataClass : data_class -> symbol_class
2296 :     con SpecialClass : special_class -> symbol_class
2297 :     datatype data_class
2298 :     con Bool : data_class
2299 :     con Int : data_class
2300 :     con Real : data_class
2301 :     con String : data_class
2302 :     end
2303 :     structure Nodes :
2304 :     sig
2305 :     structure Classes : sig...end
2306 :     datatype node
2307 :     con ClassNode : symbol_class -> node
2308 :     con ValueNode : data_class -> node
2309 :     end
2310 :     open Classes Nodes
2311 :     - ClassNode (DataClass Int);
2312 :     val it = ClassNode (DataClass Int) : node
2313 :     - ValueNode Int;
2314 :     val it = ValueNode Int : node
2315 :     - ^D
2316 :     Status: fixed in 0.66 (?)
2317 :     --------------------------------------------------------------------------------
2318 :     Number: 258
2319 :     Title: System.Directory.cd failure
2320 :     Keywords:
2321 :     Submitter: Dave MacQueen
2322 :     Date: 8/15/90
2323 :     Version: 0.63
2324 :     Problem:
2325 :     System.Directory.cd applied to nonexistent directory name raises uncaught
2326 :     exception
2327 :     Transcript:
2328 :     - System.Directory.cd "foo";
2329 :     uncaught exception SysError
2330 :     -
2331 :     Status: fixed in 0.65
2332 :     --------------------------------------------------------------------------------
2333 :     Number: 259
2334 :     Title: uncaught exception Match compiling normperv.sml
2335 :     Keywords:
2336 :     Submitter: Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
2337 :     Date: 8/14/90
2338 :     Version: 0.63 (not in 0.62 or earlier)
2339 :     System: Sun3/180, SunOS 4.1
2340 :     Severity: Critical
2341 :     Problem:
2342 :    
2343 :     Version 0.63 has a new bug whereby it cannot compile dbguser/normperv.sml
2344 :     This prevents creating the '-debug' version.
2345 :    
2346 :     Transcript:
2347 :    
2348 :     unix% sml
2349 :     Standard ML of New Jersey, Version 0.63, 10 August 1990
2350 :     val it = () : unit
2351 :     - use "dbguser/normperv.sml";
2352 :     [opening dbguser/normperv.sml]
2353 :     [closing dbguser/normperv.sml]
2354 :    
2355 :     uncaught exception Match
2356 :     -
2357 :    
2358 :     Comments:
2359 :    
2360 :     Smlc, version 0.62, created the 680X0 '.mo' files from which a -pervshare
2361 :     runtime system was built using gcc. This runtime system was then used to build
2362 :     a normal and then a -debug system (which failed).
2363 :    
2364 :     I've marked the severity as critical because it is a critical problem for this
2365 :     version. For me however, its not so critical as I seem to be managing OK with
2366 :     0.62.
2367 :     Status: fixed in 0.75 approxiamtely
2368 :     --------------------------------------------------------------------------------
2369 :     Number: 260
2370 :     Title: failure to raise overflow
2371 :     Keywords:
2372 :     Submitter: David.Tarditi@B.GP.CS.CMU.EDU
2373 :     Date: 8/13/90
2374 :     Version: 0.63?
2375 :     Problem:
2376 :     The following program should raise an Overflow exception on all
2377 :     32-bit 2's complement machines but it doesn't:
2378 :     -------
2379 :     fun exp 0 = 1 | exp i = 2 * exp (i-1);
2380 :    
2381 :     val a = exp 29;
2382 :     val minint = ~a + ~a;
2383 :    
2384 :     (* should raise overflow *)
2385 :    
2386 :     val test = minint div ~1;
2387 :     -------
2388 :     An overflow exception was not raised in version 0.59 on a Sun 3 running
2389 :     Mach emluating 4.3 BSD. It was raised in version 0.59 on a MicroVax 3
2390 :     running Mach emulating 4.3 BSD.
2391 :    
2392 :     Comments:
2393 :    
2394 :     This is the only case where overflow can occur in division. It occurs
2395 :     since MININT = -(MAXINT+1) in 2's complement. Division of MININT by -1
2396 :     causes an overflow.
2397 :    
2398 :     Status: fixed in 0.64
2399 :     -------------------------------------------------------------------------------
2400 :     Number: 261
2401 :     Title: Compiler Bug: abstractBody.abstractType 1 (assumed same as 234)
2402 :     Keywords: modules, functors
2403 :     Submitter: George Beshers, beshers@sun2.brc.uconn.edu
2404 :     Date: 8/9/90
2405 :     Version: 0.56, sparc
2406 :     Severity: Significant
2407 :     Problem: Compiler generates
2408 :     ``Regex.sml:21.17 Compiler Bug: abstractBody.abstractType 1''
2409 :     Note: this is somewhat delicate to reproduce. If you
2410 :     break the following into files and start a clean sml
2411 :     and do "use Regex.sml;" it consistently generates
2412 :     the error. However, if you *repeat* the use Regex.sml
2413 :     it compiles (however I have a lingering suspision about
2414 :     the correctness of the code produced...).
2415 :     On one occasion I tried "using" all the files in
2416 :     sequence and that worked OK, at least the working
2417 :     parts of the module did.
2418 :    
2419 :     Also I have tried to cut parts of the Regex.sml
2420 :     file and reproduce the error but without success.
2421 :     In particular, the error is dependent on at least
2422 :     some of the code appearing later in the file.
2423 :    
2424 :     Code:
2425 :    
2426 :     (*---------------------------- Ordinal.sml ---------------------*)
2427 :    
2428 :    
2429 :     signature ORD_RANGE =
2430 :     sig
2431 :     type elem
2432 :     val ord : elem -> int
2433 :     and de_ord : int -> elem
2434 :     end
2435 :    
2436 :     functor NatFn() : ORD_RANGE =
2437 :     struct
2438 :     type elem = int
2439 :     fun ord x = x
2440 :     fun de_ord x = x
2441 :     end
2442 :    
2443 :     functor CharFn() : ORD_RANGE =
2444 :     struct
2445 :     type elem = string
2446 :     val ord = String.ord
2447 :     val de_ord = chr
2448 :     end
2449 :    
2450 :    
2451 :     (*------------------------ BitSet.sml ---------------------------*)
2452 :    
2453 :    
2454 :     import "Ordinal";
2455 :    
2456 :     signature BITSET =
2457 :     sig
2458 :     structure Elem : ORD_RANGE
2459 :     exception NoSuchElement
2460 :     type bitset
2461 :     val empty: bitset
2462 :     and singleton : Elem.elem -> bitset
2463 :     and range : Elem.elem * Elem.elem -> bitset
2464 :     and setFromList : Elem.elem list -> bitset
2465 :    
2466 :     and exists : Elem.elem -> bitset -> bool
2467 :     and union : bitset * bitset -> bitset
2468 :     and intersect : bitset * bitset -> bitset
2469 :     and difference : bitset * bitset -> bitset
2470 :    
2471 :     val isempty : bitset -> bool
2472 :     and eq : bitset * bitset -> bool
2473 :     and subset : bitset * bitset -> bool
2474 :     and subset': bitset * bitset -> bool
2475 :    
2476 :     val select : bitset * (Elem.elem -> bool) -> bitset
2477 :     val lowest : bitset -> Elem.elem
2478 :     val lowest' : bitset -> Elem.elem -> Elem.elem
2479 :     val highest : bitset -> Elem.elem
2480 :     val highest' : bitset -> Elem.elem -> Elem.elem
2481 :     val totOrder : bitset * bitset -> bool
2482 :     val forall : bitset -> Elem.elem list
2483 :     val makeString : bitset -> string
2484 :     end;
2485 :    
2486 :     (* trivialized version *)
2487 :     functor BitSetFn(Elem1 : ORD_RANGE) : BITSET =
2488 :     struct
2489 :     structure Elem = Elem1
2490 :     local
2491 :     open Elem Bits
2492 :     val bits_per_int = 30;
2493 :     val all_bits = 1073741823 (* 077777777777 *)
2494 :     in
2495 :     datatype bitset = BS of {lo : int, hi : int, setx : int array}
2496 :     val empty = BS{lo = 0, hi = ~1, setx = array(0, 0)}
2497 :     fun singleton x = empty
2498 :     fun range(l, h) = empty
2499 :     fun exists x (BS{lo, hi, setx}) = false
2500 :     fun union(set1, set2) = empty
2501 :     exception NoSuchElement
2502 :     fun lowest (BS{lo,...}) = de_ord lo
2503 :     fun lowest' (BS{lo,...}) start = de_ord lo
2504 :     fun highest (BS{hi,...}) = de_ord hi
2505 :     fun highest' (BS{hi,...}) start = de_ord hi
2506 :     fun reduce bs = empty
2507 :     fun intersect(set1, set2) = empty
2508 :     fun difference(set1, set2) = empty
2509 :     fun isempty (BS{lo, hi,...}) = hi < lo
2510 :     fun eq (set1, set2) = true
2511 :     fun op subset(s1, s2) = isempty (reduce (difference (s1, s2)))
2512 :     fun op subset'(s1, s2) = isempty (reduce (difference (s1, s2)))
2513 :     andalso (not (isempty (reduce (difference (s2, s1)))))
2514 :     fun lowQuery (bs, q) =
2515 :     let
2516 :     val BS{lo, hi, setx} = bs
2517 :     val i = ref lo
2518 :     in
2519 :     de_ord (!i)
2520 :     end
2521 :     fun highQuery (bs, q) =
2522 :     let
2523 :     val BS{lo, hi, setx} = bs
2524 :     val i = ref hi
2525 :     in
2526 :     de_ord (!i)
2527 :     end
2528 :     fun select (bs, q) = bs
2529 :     fun totOrder (set1, set2) = true
2530 :     fun forall s = nil
2531 :     fun makeString s = ""
2532 :     fun setFromList (l' : Elem.elem list) = empty
2533 :     end
2534 :     end
2535 :    
2536 :     (*------------------------------ RedBlack.sml ------------------*)
2537 :    
2538 :     signature RED_BLACK =
2539 :     sig type tree
2540 :     type key
2541 :     val empty : tree
2542 :     val insert : key * tree -> tree
2543 :     val lookup : key * tree -> key
2544 :     exception notfound of key
2545 :     end
2546 :    
2547 :     functor RedBlack(B : sig type key
2548 :     val > : key*key->bool
2549 :     end): RED_BLACK =
2550 :     struct
2551 :     open B
2552 :     datatype color = RED | BLACK
2553 :     datatype tree = empty | tree of key * color * tree * tree
2554 :     exception notfound of key
2555 :    
2556 :     fun insert (key,t) =
2557 :     let fun f empty = tree(key,RED,empty,empty)
2558 :     | f (tree(k,BLACK,l,r)) =
2559 :     if key>k
2560 :     then case f r
2561 :     of r as tree(rk,RED, rl as tree(rlk,RED,rll,rlr),rr) =>
2562 :     (case l
2563 :     of tree(lk,RED,ll,lr) =>
2564 :     tree(k,RED,tree(lk,BLACK,ll,lr),
2565 :     tree(rk,BLACK,rl,rr))
2566 :     | _ => tree(rlk,BLACK,tree(k,RED,l,rll),
2567 :     tree(rk,RED,rlr,rr)))
2568 :     | r as tree(rk,RED,rl, rr as tree(rrk,RED,rrl,rrr)) =>
2569 :     (case l
2570 :     of tree(lk,RED,ll,lr) =>
2571 :     tree(k,RED,tree(lk,BLACK,ll,lr),
2572 :     tree(rk,BLACK,rl,rr))
2573 :     | _ => tree(rk,BLACK,tree(k,RED,l,rl),rr))
2574 :     | r => tree(k,BLACK,l,r)
2575 :     else if k>key
2576 :     then case f l
2577 :     of l as tree(lk,RED,ll, lr as tree(lrk,RED,lrl,lrr)) =>
2578 :     (case r
2579 :     of tree(rk,RED,rl,rr) =>
2580 :     tree(k,RED,tree(lk,BLACK,ll,lr),
2581 :     tree(rk,BLACK,rl,rr))
2582 :     | _ => tree(lrk,BLACK,tree(lk,RED,ll,lrl),
2583 :     tree(k,RED,lrr,r)))
2584 :     | l as tree(lk,RED, ll as tree(llk,RED,lll,llr), lr) =>
2585 :     (case r
2586 :     of tree(rk,RED,rl,rr) =>
2587 :     tree(k,RED,tree(lk,BLACK,ll,lr),
2588 :     tree(rk,BLACK,rl,rr))
2589 :     | _ => tree(lk,BLACK,ll,tree(k,RED,lr,r)))
2590 :     | l => tree(k,BLACK,l,r)
2591 :     else tree(key,BLACK,l,r)
2592 :     | f (tree(k,RED,l,r)) =
2593 :     if key>k then tree(k,RED,l, f r)
2594 :     else if k>key then tree(k,RED, f l, r)
2595 :     else tree(key,RED,l,r)
2596 :     in case f t
2597 :     of tree(k,RED, l as tree(_,RED,_,_), r) => tree(k,BLACK,l,r)
2598 :     | tree(k,RED, l, r as tree(_,RED,_,_)) => tree(k,BLACK,l,r)
2599 :     | t => t
2600 :     end
2601 :    
2602 :    
2603 :     fun lookup (key,t) =
2604 :     let fun look empty = raise (notfound key)
2605 :     | look (tree(k,_,l,r)) =
2606 :     if k>key then look l
2607 :     else if key>k then look r
2608 :     else k
2609 :     in look t
2610 :     end
2611 :    
2612 :     end
2613 :    
2614 :    
2615 :     (*------------------------ Regex.sml ------------------------*)
2616 :    
2617 :    
2618 :     import "Ordinal";
2619 :     import "BitSet";
2620 :     import "RedBlack";
2621 :    
2622 :     signature CHAR_REG_EXP =
2623 :     sig
2624 :     structure Alphabet : ORD_RANGE
2625 :     structure AlphaSet : BITSET
2626 :     structure range : ORD_RANGE
2627 :     structure Set : BITSET
2628 :     sharing type Set.Elem.elem = range.elem = int
2629 :    
2630 :     type pattern
2631 :    
2632 :     datatype Ch_Reg_Exp
2633 :     = CONCAT of Ch_Reg_Exp list
2634 :     | ALTERNATE of Ch_Reg_Exp list
2635 :     | STAR of Ch_Reg_Exp
2636 :     | PLUS of Ch_Reg_Exp
2637 :     | OPTION of Ch_Reg_Exp
2638 :     | LETTER of AlphaSet.bitset
2639 :     | AUG (* For internal use only *)
2640 :    
2641 :     type Aug_Reg_Exp
2642 :    
2643 :     val re_to_Aug : Ch_Reg_Exp -> {aug_re : Aug_Reg_Exp, count : int,
2644 :     leafList : Aug_Reg_Exp list}
2645 :    
2646 :     val Aug_to_Follow : {aug_re : Aug_Reg_Exp, count : int,
2647 :     leafList : Aug_Reg_Exp list} -> Set.bitset array
2648 :    
2649 :     val Build_FSM : {aug_re : Aug_Reg_Exp, count : int,
2650 :     leafList : Aug_Reg_Exp list} * Set.bitset array
2651 :     -> pattern
2652 :    
2653 :     val Print : Aug_Reg_Exp -> unit
2654 :     end
2655 :    
2656 :     functor Reg_ExpFn() (* : CHAR_REG_EXP *) =
2657 :     struct
2658 :     structure Alphabet = CharFn()
2659 :     structure AlphaSet : BITSET = BitSetFn(Alphabet)
2660 :     structure range = NatFn()
2661 :     structure Set : BITSET = BitSetFn(range)
2662 :    
2663 :     type InfoTy =
2664 :     {
2665 :     fp : Set.bitset,
2666 :     lp : Set.bitset,
2667 :     null : bool
2668 :     }
2669 :    
2670 :     datatype pattern = Pat
2671 :    
2672 :     datatype Ch_Reg_Exp
2673 :     = CONCAT of Ch_Reg_Exp list
2674 :     | ALTERNATE of Ch_Reg_Exp list
2675 :     | STAR of Ch_Reg_Exp
2676 :     | PLUS of Ch_Reg_Exp
2677 :     | OPTION of Ch_Reg_Exp
2678 :     | LETTER of AlphaSet.bitset
2679 :     | AUG (* Internal use only *)
2680 :    
2681 :     datatype Aug_Reg_Exp
2682 :     = AugCONCAT of InfoTy * Aug_Reg_Exp list
2683 :     | AugALTERNATE of InfoTy * Aug_Reg_Exp list
2684 :     | AugSTAR of InfoTy * Aug_Reg_Exp
2685 :     | AugPLUS of InfoTy * Aug_Reg_Exp
2686 :     | AugOPTION of InfoTy * Aug_Reg_Exp
2687 :     | AugLETTER of InfoTy * AlphaSet.bitset
2688 :     | AugAUG of InfoTy
2689 :    
2690 :     fun mkInfo () =
2691 :     {
2692 :     Fpos = Set.empty,
2693 :     Lpos = Set.empty,
2694 :     Nullable = false
2695 :     }
2696 :    
2697 :     fun info (AugCONCAT(inf, _)) = inf
2698 :     | info (AugALTERNATE(inf, _)) = inf
2699 :     | info (AugSTAR(inf, _)) = inf
2700 :     | info (AugPLUS(inf, _)) = inf
2701 :     | info (AugOPTION(inf, _)) = inf
2702 :     | info (AugLETTER(inf, _)) = inf
2703 :     | info (AugAUG(inf)) = inf
2704 :    
2705 :     (* type 'a Aug = {aug_re : Aug_Reg_Exp, count : int,
2706 :     leafList : Aug_Reg_Exp list}
2707 :     *)
2708 :     fun re_to_Aug re =
2709 :     let
2710 :     fun app_map cnt nil = (nil : Aug_Reg_Exp list, cnt, nil)
2711 :     | app_map cnt (hd::tl) =
2712 :     let
2713 :     val hd' = pass1(cnt, hd)
2714 :     val {aug_re=ar, count=c, leafList=le} = hd'
2715 :     val (arTl, cntTl, leTl) = app_map c tl
2716 :     in
2717 :     (ar::arTl, cntTl, le@leTl)
2718 :     end
2719 :     and pass1 (counter, CONCAT(re_l)) =
2720 :     let
2721 :     val (ar', cnt', le') = app_map counter re_l
2722 :     fun foldConcat (a, b) =
2723 :     let
2724 :     val {fp = fpA, lp = lpA, null = nuA} = a
2725 :     val {fp = fpB, lp = lpB, null = nuB} = b
2726 :     val n = nuA andalso nuB
2727 :     val fp' = if nuB then Set.union (fpA, fpB) else fpB
2728 :     val lp' = if nuA then Set.union (lpA, lpB) else lpA
2729 :     in
2730 :     print "foldConcat\n";
2731 :     print " given A ";
2732 :     print " fpA="; print (Set.makeString fpA);
2733 :     print " lpA="; print (Set.makeString lpA);
2734 :     print nuA; print "\n";
2735 :     print " given B ";
2736 :     print " fpB="; print (Set.makeString fpB);
2737 :     print " lpB="; print (Set.makeString lpB);
2738 :     print nuB; print "\n";
2739 :     print " results ";
2740 :     print " fp'="; print (Set.makeString fp');
2741 :     print " lp'="; print (Set.makeString lp');
2742 :     print n; print "\n";
2743 :     {fp = fp', lp = lp', null = n}
2744 :     end
2745 :     val base = {fp = Set.empty, lp = Set.empty, null = true}
2746 :     val _ = (print " base ";
2747 :     print " fp'="; print (Set.makeString (#fp base));
2748 :     print " lp'="; print (Set.makeString (#lp base));
2749 :     print (#null base); print "\n")
2750 :     val info = revfold foldConcat (map info ar') base
2751 :     in
2752 :     {aug_re = AugCONCAT(info, ar'), count = cnt',
2753 :     leafList = le'}
2754 :     end
2755 :     | pass1 (counter, ALTERNATE(re_l)) =
2756 :     let
2757 :     val (ar', cnt', le') = app_map counter re_l
2758 :     fun foldAlt (a, b) =
2759 :     let
2760 :     val {fp = hdA, lp = lpA, null = nuA} = a
2761 :     val {fp = hdB, lp = lpB, null = nuB} = b
2762 :     in
2763 :     {fp = Set.union (hdA, hdB),
2764 :     lp = Set.union (lpA, lpB),
2765 :     null = nuA orelse nuB}
2766 :     end
2767 :     val base = {fp = Set.empty, lp = Set.empty, null = false}
2768 :     val info = fold foldAlt (map info ar') base
2769 :     in
2770 :     {aug_re = AugALTERNATE(info, ar'), count = cnt',
2771 :     leafList = le'}
2772 :     end
2773 :     | pass1 (counter, STAR(re)) =
2774 :     let
2775 :     val {aug_re=ar, count=c, leafList=le} = pass1(counter, re)
2776 :     val {fp = fp', lp = lp', null = nu} = info ar
2777 :     val info = {fp = fp', lp = lp', null = true}
2778 :     in
2779 :     {aug_re = AugSTAR(info, ar), count = c, leafList = le}
2780 :     end
2781 :     | pass1 (counter, PLUS(re)) =
2782 :     let
2783 :     val {aug_re=ar, count=c, leafList=le} = pass1(counter, re)
2784 :     val {fp = fp', lp = lp', null = nu} = info ar
2785 :     val info = {fp = fp', lp = lp', null = nu}
2786 :     in
2787 :     {aug_re = AugPLUS(info, ar), count = c, leafList = le}
2788 :     end
2789 :     | pass1 (counter, OPTION(re)) =
2790 :     let
2791 :     val {aug_re=ar, count=c, leafList=le} = pass1(counter, re)
2792 :     val {fp = fp', lp = lp', null = nu} = info ar
2793 :     val info = {fp = fp', lp = lp', null = true}
2794 :     in
2795 :     {aug_re = AugOPTION(info, ar), count = c, leafList = le}
2796 :     end
2797 :     | pass1 (counter, LETTER(a)) =
2798 :     let
2799 :     val c = Set.singleton counter
2800 :     val info = {fp = c, lp = c, null = false}
2801 :     val aug_r = AugLETTER(info, a)
2802 :     in
2803 :     {aug_re = aug_r, count = counter+1, leafList = [aug_r]}
2804 :     end
2805 :     | pass1 (counter, AUG) =
2806 :     let
2807 :     val c = Set.singleton counter
2808 :     val info = {fp = c, lp = c, null = false}
2809 :     val aug_r = AugAUG(info)
2810 :     in
2811 :     {aug_re = aug_r, count = counter+1, leafList = [aug_r]}
2812 :     end
2813 :     in
2814 :     pass1 (0, CONCAT [re, AUG])
2815 :     end
2816 :    
2817 :    
2818 :    
2819 :     fun prFollow fp =
2820 :     let
2821 :     val l = Array.length fp
2822 :     fun prx i = (print i; print " "; print (Set.makeString (fp sub i));
2823 :     print "\n")
2824 :     fun p i = if i < l then (prx i; p (i + 1)) else ()
2825 :     in
2826 :     p 0
2827 :     end
2828 :    
2829 :     fun Aug_to_Follow {aug_re, count, leafList} =
2830 :     let
2831 :     val followPos = array(count, Set.empty)
2832 :     val count = ref 0
2833 :     fun updSet fp i = update(followPos, i,
2834 :     Set.union(followPos sub i, fp))
2835 :     fun pass2 (AugCONCAT(inf, re_l)) =
2836 :     let
2837 :     fun foldConcat (x, y) =
2838 :     let
2839 :     val updList = Set.forall y
2840 :     val {fp, lp, ...} = info x
2841 :     val updSet' = updSet fp
2842 :     fun ms nil = ""
2843 :     | ms (x::y) = (makestring x) ^ (ms y)
2844 :     in
2845 :     print ("[" ^ (ms updList) ^ "]" ^ "\n");
2846 :     print (Set.makeString lp ^ "\n");
2847 :     app updSet' updList;
2848 :     lp
2849 :     end
2850 :     val c = !count
2851 :     in
2852 :     inc count;
2853 :     print "before fold "; print c; print "\n";
2854 :     prFollow followPos; print "\n";
2855 :     revfold foldConcat re_l Set.empty;
2856 :     print "after fold "; print c; print "\n";
2857 :     prFollow followPos; print "\n";
2858 :     app pass2 re_l;
2859 :     print "after app "; print c; print "\n";
2860 :     prFollow followPos; print "\n"
2861 :     end
2862 :     | pass2 (AugALTERNATE(inf, re_l)) = app pass2 re_l
2863 :     | pass2 (AugSTAR(inf, re)) =
2864 :     let
2865 :     val {fp, lp, ...} = info re
2866 :     val updSet' = updSet fp
2867 :     in
2868 :     app updSet' (Set.forall lp);
2869 :     pass2 re
2870 :     end
2871 :     | pass2 (AugPLUS(inf, re)) =
2872 :     let
2873 :     val {fp, lp, ...} = info re
2874 :     val updSet' = updSet fp
2875 :     in
2876 :     app updSet' (Set.forall lp);
2877 :     pass2 re
2878 :     end
2879 :     | pass2 (AugOPTION(inf, re)) = pass2 re
2880 :     | pass2 (AugLETTER(inf, _)) = ()
2881 :     | pass2 (AugAUG(inf)) = ()
2882 :     in
2883 :     pass2 aug_re;
2884 :     followPos
2885 :     end
2886 :    
2887 :     datatype transition = TR of AlphaSet.bitset * state
2888 :     and state = ST of {posSet : Set.bitset,
2889 :     stId : int,
2890 :     trans : transition list}
2891 :     fun le (ST{posSet = pS1,...}, ST{posSet = pS2,...}) =
2892 :     Set.totOrder (pS1, pS2)
2893 :     fun getPosSet (ST{posSet,...}) = posSet
2894 :     structure table = RedBlack(struct type key = state
2895 :     val op > = le end)
2896 :    
2897 :     fun Build_FSM ({aug_re, count, leafList}, followPos) =
2898 :     let
2899 :     (* get character set at position i *)
2900 :     fun cSetAt i =
2901 :     case nth (leafList, i) of
2902 :     AugLETTER(inf, x) => x
2903 :     | AugAUG(_) => AlphaSet.empty
2904 :    
2905 :     (* test to see if character has transition at position i *)
2906 :     fun atPos c i = AlphaSet.exists c (cSetAt i)
2907 :    
2908 :     (* Is this position a final position *)
2909 :     fun final i =
2910 :     case nth (leafList, i) of
2911 :     AugAUG(_) => true
2912 :     | _ => false
2913 :    
2914 :     (* return only those elements which match query *)
2915 :     fun sublist query l =
2916 :     let
2917 :     fun ss nil = nil
2918 :     | ss (hd::tl) =
2919 :     let val x = (ss tl)
2920 :     in if query hd then hd::x else x
2921 :     end
2922 :     in
2923 :     ss l
2924 :     end
2925 :    
2926 :     val cnt = ref 1
2927 :    
2928 :     fun build_auto states unmarked =
2929 :     if unmarked = nil then states else
2930 :     let
2931 :     val T = hd unmarked
2932 :     val _ = print ("build_auto " ^ (Set.makeString T) ^ "\n")
2933 :     val allchar =
2934 :     let
2935 :     fun f (i, x) = AlphaSet.union(cSetAt i, x)
2936 :     in
2937 :     fold f (Set.forall T) AlphaSet.empty
2938 :     end
2939 :     val _ = print (" allchar = " ^ (AlphaSet.makeString allchar)
2940 :     ^ "\n");
2941 :     fun eachChar states unmarked trans allchar =
2942 :     if AlphaSet.isempty allchar then
2943 :     (states, unmarked, trans)
2944 :     else
2945 :     let
2946 :     val _ = print "eachChar\n"
2947 :     fun next cSet =
2948 :     let
2949 :     val x = AlphaSet.lowest cSet
2950 :     val _ = print ("next cSet=" ^
2951 :     (AlphaSet.makeString cSet) ^ " ")
2952 :     val _ = print (makestring (AlphaSet.Elem.ord x)
2953 :     ^ "\n")
2954 :     val posSet = Set.select (T, atPos x)
2955 :     val _ = print "Check\n"
2956 :     fun findSet i ch =
2957 :     if i = count then ch
2958 :     else
2959 :     let val y = if Set.exists i posSet then
2960 :     AlphaSet.intersect(ch, cSetAt i)
2961 :     else
2962 :     AlphaSet.difference(ch, cSetAt i)
2963 :     in
2964 :     findSet (i + 1) y
2965 :     end
2966 :     in
2967 :     (findSet 0 cSet, posSet)
2968 :     end (* next *)
2969 :    
2970 :     val (cSet, posSet) = next allchar
2971 :     val _ = print (" cSet=" ^ (AlphaSet.makeString cSet)
2972 :     ^ ", posSet = " ^ (Set.makeString posSet)
2973 :     ^ "\n")
2974 :    
2975 :     fun makeU s =
2976 :     let
2977 :     fun f (i, x) = Set.union (followPos sub i, x)
2978 :     in
2979 :     fold f (Set.forall posSet) Set.empty
2980 :     end (* makeU *)
2981 :    
2982 :     val U = makeU posSet
2983 :     val _ = print (" U=" ^ (Set.makeString U) ^ "\n")
2984 :    
2985 :    
2986 :     fun FindInsert st u =
2987 :     let
2988 :     val dummy = ST{posSet = u, stId = 0, trans = []}
2989 :     in
2990 :     (table.lookup(dummy, st), st, unmarked)
2991 :     handle table.notfound _ =>
2992 :     let
2993 :     val u' = ST{posSet = u, stId = !cnt, trans=[]}
2994 :     val st' = table.insert(u', st)
2995 :     in
2996 :     inc cnt;
2997 :     (u', st', unmarked@[u])
2998 :     end
2999 :     end (* FindInsert *)
3000 :     val (ToState, states', unmarked') = FindInsert states U
3001 :     val trans' = TR(cSet, ToState)::trans
3002 :     in
3003 :     eachChar states' unmarked' trans'
3004 :     (AlphaSet.difference (allchar, cSet))
3005 :     end (* eachChar *)
3006 :    
3007 :     val (states', unmarked', trans') =
3008 :     eachChar states unmarked [] allchar
3009 :     val dummy = ST{posSet = T, stId = 0, trans = []}
3010 :     val ST{stId = Tid,...} = table.lookup(dummy, states')
3011 :     val s = ST{posSet = T, stId = Tid, trans = trans'}
3012 :     val states2 = table.insert(s, states')
3013 :     in
3014 :     build_auto states' (tl unmarked')
3015 :     end (* build_auto *)
3016 :     val {fp = st',...} = info aug_re
3017 :     val startstate = ST{posSet = st', stId = 0, trans = []}
3018 :     val stTable = table.insert (startstate, table.empty)
3019 :     val autoList = build_auto stTable [st']
3020 :     in
3021 :     autoList
3022 :     end
3023 :    
3024 :     fun Print re =
3025 :     let
3026 :     val depth = ref 0
3027 :     fun printInfo ({fp, lp, null} : InfoTy) =
3028 :     (
3029 :     print "Fpos=";
3030 :     print (Set.makeString (fp));
3031 :     print " Lpos=";
3032 :     print (Set.makeString (lp));
3033 :     if null then
3034 :     print " nullable\n"
3035 :     else
3036 :     print "\n"
3037 :     )
3038 :     fun Pr (AugCONCAT(inf, re_l)) =
3039 :     (
3040 :     print "CONCAT ";
3041 :     printInfo inf;
3042 :     app Pr1 re_l
3043 :     )
3044 :     | Pr (AugALTERNATE(inf, re_l)) =
3045 :     (
3046 :     print "ALTERN ";
3047 :     printInfo inf;
3048 :     app Pr1 re_l
3049 :     )
3050 :     | Pr (AugSTAR(inf, re)) =
3051 :     (
3052 :     print "KLEENE ";
3053 :     printInfo inf;
3054 :     Pr1 re
3055 :     )
3056 :     | Pr (AugPLUS(inf, re)) =
3057 :     (
3058 :     print "POSITV ";
3059 :     printInfo inf;
3060 :     Pr1 re
3061 :     )
3062 :     | Pr (AugOPTION(inf, re)) =
3063 :     (
3064 :     print "OPTION ";
3065 :     printInfo inf;
3066 :     Pr1 re
3067 :     )
3068 :     | Pr (AugLETTER(inf, _)) =
3069 :     (
3070 :     print "LETTER ";
3071 :     printInfo inf
3072 :     )
3073 :     | Pr (AugAUG(inf)) =
3074 :     (
3075 :     print "AUGMEN ";
3076 :     printInfo inf
3077 :     )
3078 :     and
3079 :     Pr1 x =
3080 :     let
3081 :     val i = ref 0;
3082 :     in
3083 :     (
3084 :     while (!i) < (!depth) do
3085 :     (print " "; inc i);
3086 :     inc depth;
3087 :     Pr x;
3088 :     dec depth
3089 :     )
3090 :     end
3091 :     in
3092 :     Pr1 re
3093 :     end;
3094 :     end;
3095 :    
3096 :    
3097 :     structure RRP_Test = Reg_ExpFn();
3098 :    
3099 :     open RRP_Test;
3100 :    
3101 :     val a = LETTER(AlphaSet.singleton "a")
3102 :     val b = LETTER(AlphaSet.singleton "b")
3103 :     val c = LETTER(AlphaSet.singleton "c")
3104 :     val d = LETTER(AlphaSet.singleton "d")
3105 :    
3106 :     val a_b_c = ALTERNATE([a, b, c]);
3107 :     val aug = re_to_Aug a_b_c;
3108 :     Print (#aug_re aug);
3109 :     val fol = Aug_to_Follow aug;
3110 :     prFollow fol;
3111 :     print "Before Build_FSM\n";
3112 :     val t = Build_FSM(aug, fol);
3113 :    
3114 :     print "\n\n\n";
3115 :     val abc = CONCAT([a, b, c]);
3116 :     val aug' = re_to_Aug abc;
3117 :     Print (#aug_re aug');
3118 :     val fol' = Aug_to_Follow aug';
3119 :     prFollow fol';
3120 :     val t' = Build_FSM(aug', fol');
3121 :    
3122 :     Status: fixed in 0.64
3123 :     -------------------------------------------------------------------------------
3124 :     Number: 262
3125 :     Title: Using the LIBRARY with v0.62
3126 :     Keywords:
3127 :     Submitter: "Soren P. Christensen" <schristensen@daimi.aau.dk>
3128 :     Date: 8/8/90
3129 :     Problem:
3130 :     I just tried to build the library found in /dist/ml/LIBRARY.tar.Z and
3131 :     this fails. We are using a spark version of 0.62. I am not dependent
3132 :     on the Library and the reson I report this is only so that you can use
3133 :     it in your testing.
3134 :    
3135 :     I had to make small changes like the definition of the quit function by
3136 :     means of cleanup.
3137 :    
3138 :     1)
3139 :     There seems to be problems with the exceptions.
3140 :    
3141 :     ---------------
3142 :     Transcript:
3143 :     Standard ML of New Jersey, Version 0.62, 1 August 1990
3144 :     val it = () : unit
3145 :     - fn () => (() handle Interrupt=>());
3146 :     val it = fn : unit -> unit
3147 :     - exception xx = Interrupt;
3148 :     std_in:3.16-3.24 Error: unbound exn: Interrupt
3149 :     - raise Interrupt;
3150 :     std_in:1.7-1.15 Error: unbound variable Interrupt
3151 :     std_in:1.1-1.15 Error: argument of raise is not an exception
3152 :     raised: undef
3153 :     in expression:
3154 :     raise Interrupt
3155 :    
3156 :     ----------------
3157 :    
3158 :     2)
3159 :     later on it terminates with a runbind, I think this is related to the
3160 :     exceptions too.
3161 :     Comments:
3162 :     (1) The Interrupt exception constructor has gone away, and Interrupt
3163 :     handling should be replaced by handling the interrupt signal.
3164 :     (2) The runbind exception seems to be a genuine bug.
3165 :     Status: fixed in 0.65
3166 :     -------------------------------------------------------------------------------
3167 :     Number: 263
3168 :     Title: problem with input via datakit con
3169 :     Keywords:
3170 :     Submitter: pjw
3171 :     Date: 8/8/90
3172 :     Transcript:
3173 :     con tempel
3174 :     connected to tempel.mesgdcon on /net/dk/4
3175 :     $ cd /usr/dbm/sml/60/src
3176 :     $ sml
3177 :     Standard ML of New Jersey, Version 0.60, 13 July 1990
3178 :     val it = () : unit
3179 :     - -3;
3180 :     std_in:2.1 Error: nonfix identifier required
3181 :     std_in:2.1-2.2 Error: operator and operand don't agree (tycon mismatch)
3182 :     operator domain: 'Z * 'Z
3183 :     operand: int
3184 :     in expression:
3185 :     - 3
3186 :     std_in:2.1 Error: overloaded variable "-" cannot be resolved
3187 :     uncaught Io exception (Loader): input "<std_in>": negative character count
3188 :     $
3189 :     Status: fixed in 0.65
3190 :     --------------------------------------------------------------------------------
3191 :     Number: 264
3192 :     Title: No type-explicitness check in nj-sml
3193 :     Keywords: modules, signatures, type-explicitness
3194 :     Submitter: David Turner <dnt@lfcs.edinburgh.ac.uk>
3195 :     Date: 7/8/90
3196 :     Version : SML of NJ 0.56 and 0.59
3197 :     System : Sun
3198 :     Severity : Dunno, but its pretty anti-social
3199 :    
3200 :     Problem :
3201 :    
3202 :     The compiler doesn't seem to check for type explicitness in
3203 :     signatures (see section 5.8 and also rule 65 of the ML definition).
3204 :     This means many signatures which can never be matched are still
3205 :     accepted as valid signatures.
3206 :    
3207 :     Transcript :
3208 :    
3209 :     - signature X = sig type t val x : t type t end;
3210 :     signature X =
3211 :     sig
3212 :     type t
3213 :     val x : ?.t
3214 :     end
3215 :    
3216 :     Status: fixed in 0.73
3217 :     --------------------------------------------------------------------------------
3218 :     Number: 265
3219 :     Title: strong type variables accepted in exception declarations
3220 :     Keywords: types, exceptions, weak types
3221 :     Submitter: Dave Berry, db@lfcs.ed.ac.uk
3222 :     Date: 8/7/90
3223 :     Version: 0.56, 0.59
3224 :     Severity: Minor (although it presumably means that the type system
3225 :     can be broken!)
3226 :     Problem: The compiler doesn't reject applicative type variables
3227 :     in exception declarations.
3228 :     Code: val id: 'a -> 'a =
3229 :     let exception dummy of 'a
3230 :     in fn x => x
3231 :     end;
3232 :     Transcript: The above code produces:
3233 :     val id = fn : 'a -> 'a
3234 :    
3235 :     Status: fixed in 0.65
3236 :     --------------------------------------------------------------------------------
3237 :     Number: 266
3238 :     Title: uncaught Io exception in use
3239 :     Keywords:
3240 :     From: John Reppy
3241 :     Date: 8/6/90
3242 :     System: 0.62
3243 :     Problem:
3244 :     I've noticed the following new (I think) bug. An Io error in use results
3245 :     in an uncaught exception.
3246 :    
3247 :     Standard ML of New Jersey, Version 0.62, 1 August 1990
3248 :     val it = () : unit
3249 :     - use "foo";
3250 :     [cannot open foo]
3251 :    
3252 :     uncaught exception Io "open_in "foo": open failed, No such file or directory"
3253 :    
3254 :     The problem is that in "use_file" in build/interact.sml (line 307), the
3255 :     exception Io gets re-raised. Was this changed for the debugger?
3256 :     [dbm, 8/30/90] Fixed so that exceptions are handled even for nonterminal
3257 :     input.
3258 :    
3259 :     Status: fixed in 0.65
3260 :     -------------------------------------------------------------------------------
3261 :     Number: 267
3262 :     Title: sharing again
3263 :     Keywords: modules, functors, signatures, sharing
3264 :     From: Simon Finn <simon@abstract-hardware-ltd.co.uk>
3265 :     Date: 8/2/90
3266 :     Version: d64
3267 :     Problem:
3268 :     The following program breaks Poly/ML v1.88 and NJML v0.44a (the most recent version
3269 :     to which I have access).
3270 :     Code:
3271 :     signature S1 =
3272 :     sig
3273 :     eqtype t
3274 :     val x : t
3275 :     end;
3276 :    
3277 :     signature S2 =
3278 :     sig
3279 :     structure A : sig end
3280 :     structure C : sig structure A : S1 end
3281 :     sharing A = C.A
3282 :     end;
3283 :    
3284 :     functor F(structure A:S1
3285 :     structure B:S2
3286 :     sharing A = B.A) =
3287 :     struct
3288 :     val y = (A.x = B.C.A.x)
3289 :     end;
3290 :    
3291 :     Transcript:
3292 :     Standard ML of New Jersey, Version d64, ? August 1990
3293 :     val it = () : unit
3294 :     - signature S1 =
3295 :     sig
3296 :     eqtype t
3297 :     val x : t
3298 :     end
3299 :     signature S2 =
3300 :     sig
3301 :     structure A : sig...end
3302 :     structure C : sig...end
3303 :     end
3304 :     std_in:21.11-21.25 Error: operator and operand don't agree (tycon mismatch)
3305 :     operator domain: ?.t * ?.t
3306 :     operand: ?.t * ?.t
3307 :     in expression:
3308 :     = (A.x,B.C.A.x)
3309 :    
3310 :     Comment:
3311 :     This program is valid, since structure A shares with B.A which shares with B.C.A,
3312 :     hence A.t and B.C.A.t must be the same (equality) type. However:
3313 :     [dbm, 11/11/97] Not a bug in SML '97.
3314 :    
3315 :     Status: fixed in 0.73
3316 :     --------------------------------------------------------------------------------
3317 :     Number: 268
3318 :     Title: import, equality
3319 :     Keywords: modules, functors, equality
3320 :     Submitter: Jason Fischl <fischl@cpsc.ucalgary.ca>
3321 :     Date: 4/9/90
3322 :     Version: 0.44
3323 :     System: Sparcstation 1
3324 :     Severity: major
3325 :    
3326 :     Problem:
3327 :    
3328 :     The module system has a bug in it with regard to equality types (I think).
3329 :     The following is a pretty concise description of what will cause the bug to
3330 :     occur.
3331 :    
3332 :    
3333 :     Code:
3334 :     (*-----------------FILE: term.sig.sml----------------------*)
3335 :    
3336 :     signature termsig =
3337 :     sig
3338 :    
3339 :     datatype term =
3340 :     Const of string
3341 :     | Var of string
3342 :     | Func of string * term list
3343 :    
3344 :     end;
3345 :    
3346 :     (*--------------FILE: term.sml-------------------------*)
3347 :    
3348 :     import "term.sig";
3349 :    
3350 :     functor termFC ():termsig =
3351 :    
3352 :     struct
3353 :    
3354 :     datatype term =
3355 :     Const of string
3356 :     | Var of string
3357 :     | Func of string * term list
3358 :    
3359 :     end;
3360 :    
3361 :     (*------------FILE: parse_term.sml---------------------------*)
3362 :    
3363 :     import "term.sig";
3364 :    
3365 :     functor parse_termFC (structure TERM:termsig) =
3366 :     struct
3367 :    
3368 :     open TERM
3369 :    
3370 :     fun term_nil x = (x:term list) = []
3371 :    
3372 :     end;
3373 :    
3374 :     (*---------------------------------------*)
3375 :    
3376 :    
3377 :     Transcript:
3378 :    
3379 :     - import "parse_term";
3380 :     [parse_term.bin is out of date; recompiling]
3381 :     [reading parse_term.sml]
3382 :     [reading term.sig.bin... done]
3383 :     parse_term.sml, line 11: Error: Compiler bug: tycStamp
3384 :     equal: type = ?.term list
3385 :     import: code generation failed
3386 :     [closing parse_term.sml]
3387 :     IMPORT failed (codegen)
3388 :     -
3389 :    
3390 :     Comments:
3391 :    
3392 :     I couldn't find any reference to it in the bug reports so I had to assume it
3393 :     was all new. It would have been much nicer if the error message had been a bit
3394 :     more descriptive. All I knew was that it was a type problem. There was no
3395 :     info as to which line the error occurred on or which function or anything
3396 :     really.
3397 :    
3398 :     I would appreciate a reply at some point if you could manage since I am curious
3399 :     as to the nature of my problem. Undoubtedly it will get me again!
3400 :    
3401 :     Fix:
3402 :    
3403 :     In order to fix the problem I had to define the fun term_nil inside the term
3404 :     functor and then also put it in the termsig signature. This took me on the
3405 :     order of 8 hours to figure out!
3406 :    
3407 :     Status: fixed in 0.65 --- (before)
3408 :     -------------------------------------------------------------------------------
3409 :     Number: 269
3410 :     Title: failure in abstractBody with embedded signature
3411 :     Keywords: modules, functors, signatures
3412 :     Submitter: Dave MacQueen
3413 :     Date: 8/29/90
3414 :     Version: 0.63
3415 :     Code:
3416 :     functor F() =
3417 :     struct
3418 :     datatype d = D
3419 :     structure A : sig type s val x : s * d end =
3420 :     struct
3421 :     datatype s = MKs
3422 :     val x = (MKs,D)
3423 :     end
3424 :     end;
3425 :    
3426 :     structure B = F();
3427 :    
3428 :     val (_,B.D) = B.A.x;
3429 :     Transcript:
3430 :     - use "bug269.sml";
3431 :     [opening bug269.sml]
3432 :     functor F : <sig>
3433 :     structure B :
3434 :     sig
3435 :     structure A : sig...end
3436 :     datatype d
3437 :     con D : d
3438 :     end
3439 :     bug269.sml:16.5-16.19 Error: pattern and expression in val dec don't agree (tycon mis
3440 :     match)
3441 :     pattern: B.A.s * B.d
3442 :     expression: B.A.s * ?.d
3443 :     in declaration:
3444 :     (_,D) = B.A.x
3445 :     [closing bug269.sml]
3446 :    
3447 :     Status: fixed in 0.65
3448 :     -------------------------------------------------------------------------------
3449 :     Number: 270
3450 :     Title: Compiler bug: TypesUtil.lookTycPath: NULLstr
3451 :     Keywords: modules, functors
3452 :     Submitter: Dave MacQueen
3453 :     Date: 8/29/90
3454 :     Version: 0.63
3455 :     Problem:
3456 :     failure to interpret path for X.d in embedded signature
3457 :     Formal paramter X was not bound properly.
3458 :     Code:
3459 :     functor F(X: sig datatype d = A end) =
3460 :     struct
3461 :     structure S : sig val x : X.d end =
3462 :     struct val x = X.A end
3463 :     end
3464 :     Status: fixed in 0.65
3465 :     -------------------------------------------------------------------------------
3466 :     Number: 271
3467 :     Title: secondary compiler bug
3468 :     Keywords: modules, functors, error recovery
3469 :     Submitter: Gary T. Leavens leavens@bambam.cs.iastate.edu
3470 :     Date: 8/29/90
3471 :     Version: 0.64
3472 :     System: HP 9000/370, HP-UX 7.0
3473 :     Severity: minor
3474 :     Problem: get compiler bug report
3475 :     Code: the following in a file "report"
3476 :    
3477 :     signature IntMapSig =
3478 :     sig
3479 :     type 'a map
3480 :     val apply: ('a map)*int -> 'a
3481 :     exception NotFound
3482 :     end;
3483 :    
3484 :     signature ValueSig =
3485 :     sig
3486 :     type value
3487 :     end;
3488 :    
3489 :     signature SymbolSig =
3490 :     sig
3491 :     type sym
3492 :     val hash: sym -> int
3493 :     end;
3494 :    
3495 :     functor SymTblFct(structure IntMap: IntMapSig
3496 :     structure Val: ValSig
3497 :     structure Sym: SymSig):
3498 :     sig
3499 :     type table
3500 :     exception Lookup
3501 :     val lookup: table * Sym.sym -> Val.value
3502 :     val update: table * Sym.sym * Val.value -> table
3503 :     end =
3504 :     struct
3505 :     datatype table = TBL of (Sym.sym * Val.value)list IntMap.map
3506 :     exception Lookup
3507 :    
3508 :     fun find(sym,[]) = raise Lookup
3509 :     | find(sym,(sym',v)::rest) =
3510 :     if sym = sym' then v else find(sym,rest);
3511 :    
3512 :     fun lookup(TBL map, s) =
3513 :     let val n = Sym.hash(s)
3514 :     val l = IntMap.apply(map,n)
3515 :     in find(s,l)
3516 :     end handle IntMap.NotFound => raise Lookup
3517 :    
3518 :     (* ... *)
3519 :     end;
3520 :    
3521 :     Transcript: a transcript of session illustrating problem follows
3522 :    
3523 :     Standard ML of New Jersey, Version 0.64, ? August 1990
3524 :     val it = () : unit
3525 :     - [opening report]
3526 :     signature IntMapSig =
3527 :     sig
3528 :     type 'a map
3529 :     exception NotFound
3530 :     val apply : 'a map * int -> 'a
3531 :     end
3532 :     signature ValueSig =
3533 :     sig
3534 :     type value
3535 :     end
3536 :     signature SymbolSig =
3537 :     sig
3538 :     type sym
3539 :     val hash : sym -> int
3540 :     end
3541 :     report:20.20-20.25 Error: unbound signature: ValSig
3542 :     [closing report]
3543 :     std_in:1.1 Compiler Bug: ModUtil.shiftStamps.newEnv - bad arg
3544 :     -
3545 :    
3546 :     Comments: obviously the code has bugs, but I thought you'd want to see
3547 :     the "compiler bug" anyway, since it may be triggered by the bugs
3548 :     in the program.
3549 :     Status: fixed in 0.65
3550 :     -------------------------------------------------------------------------------
3551 :     Number: 272
3552 :     Title: generalizing user bound type variables
3553 :     Keywords: types, polymorphism
3554 :     Submitter: Elsa
3555 :     Date: 9/7/90
3556 :     Version: 0.65
3557 :     Problem: user bound variables are occurring in the final type of a function.
3558 :     Code:
3559 :     fun f(x) = let val y : 'a -> 'a = x in y y end;
3560 :     Transcript: <transcript of session illustrating problem>
3561 :     - fun f(x) = let val y : 'a -> 'a = x in y y end;
3562 :     val f = fn : ('aU -> 'aU) -> 'a -> 'a
3563 :     - f (fn x: 'a => x);
3564 :     std_in:2.1-2.16 Error: operator and operand don't agree (bound type var)
3565 :     operator domain: 'aU -> 'aU
3566 :     operand: 'aU -> 'aU
3567 :     in expression:
3568 :     f ((fn <pat> : 'aU => x))
3569 :     Comments:
3570 :     Error should be detected when function f is defined, rather than when it
3571 :     is applied.
3572 :     Test: bug272.sml
3573 :     Status: fixed in 0.70
3574 :     -------------------------------------------------------------------------------
3575 :     Number: 273
3576 :     Title: generalizing weak variables inside fn abstractions
3577 :     Keywords: types, weak types, polymorphism
3578 :     Submitter: Dave MacQueen
3579 :     Date: 10/3/90
3580 :     Version: 0.52 and earlier
3581 :     Problem:
3582 :     let-bound variables were being generalized with too strong a weak type.
3583 :     Transcript:
3584 :     - val x = fn y => let val f = ref in f end;
3585 :     val x = fn : 'a -> '3b -> '3b ref
3586 :     Comments:
3587 :     Second bound type variable should be '2b instead of '3b.
3588 :     Fix:
3589 :     Added abs field to POLYty constructor to remember abstraction level at
3590 :     point where type generalization took place.
3591 :     Status: fixed in 0.53
3592 :     -------------------------------------------------------------------------------
3593 :     Number: 274
3594 :     Title: weakness lost with flex record pattern
3595 :     Keywords: types, weak types, polymorphism
3596 :     Submitter: Colin Meldrum <colin@harlqn.co.uk>
3597 :     Date: 3/19/90
3598 :     Version: 0.66
3599 :     Problem: flex record patterns can cause weakness to be dropped, resulting in
3600 :     whole in type system.
3601 :     Code:
3602 :     - val a =
3603 :     let val foo = ref nil
3604 :     in
3605 :     (fn x as {...} => foo:=[x] | (y,z) => ();
3606 :     foo)
3607 :     end
3608 :    
3609 :     > val a = ref [] : ('a * 'b) list ref
3610 :     Comment:
3611 :     This is very unsafe and can for example allow the definition of a 'cast'
3612 :     function...
3613 :    
3614 :     fun cast (x) = ((a := (x,0) :: (!a)); #1(hd (!a)));
3615 :     Comment: regression failure. Now results in compiler bug. See also 1066.
3616 :    
3617 :     bug274E.sml:4.7-4.24 Warning: value restriction prevents type variable generalization : 'Z
3618 :     Error: Compiler bug: PickMod: uninstatiated VARty in pickmod
3619 :    
3620 :     Test: bug274.sml
3621 :     Status: fixed in 109.26 [dbm, 3/18/97. see bug 1066]
3622 :     -------------------------------------------------------------------------------
3623 :     Number: 275
3624 :     Title: illegal token with structure named ?
3625 :     Keywords: modules
3626 :     Submitter: Nick Rothwell
3627 :     Date: 3/16/90
3628 :     Version: ?
3629 :     Transcript:
3630 :     - structure ? = struct val x = 3 end;
3631 :     [succeeds]
3632 :    
3633 :     - ?.x;
3634 :     [fails with "illegal token"]
3635 :    
3636 :     - let open ? in x end;
3637 :     [succeeds]
3638 :     Status: fixed in 0.66
3639 :     -------------------------------------------------------------------------------
3640 :     Number: 276
3641 :     Title: overriding included value spec
3642 :     Keywords: modules, signatures, include
3643 :     Submitter: Dave Berry (db@lfcs.ed.ac.uk)
3644 :     Date: 3/22/90
3645 :     Version: 0.66
3646 :     Severity: major
3647 :     Problem:
3648 :     If a value spec in an included signature is redefined in the
3649 :     including signature, the value identifier keeps the type
3650 :     from the included signature, but it is printed as the type
3651 :     from the including signature.
3652 :     Transcript:
3653 :     signature Foo1 =
3654 :     sig
3655 :     val foo: string
3656 :     end;
3657 :    
3658 :     signature Foo2 =
3659 :     sig
3660 :     include Foo1
3661 :     val foo: bool
3662 :     end;
3663 :    
3664 :     structure Foo: Foo2 =
3665 :     struct
3666 :     val foo = true
3667 :     end;
3668 :    
3669 :     Error: value type in structure doesn't match signature spec
3670 :     name: foo
3671 :     spec: string
3672 :     actual: bool
3673 :     Comments:
3674 :     Note: Once I worked out what was going on I was actually grateful,
3675 :     because I hadn't realised that the names clashed. Perhaps it
3676 :     would be useful if implementations could warn about such cases?
3677 :     Test: bug276.1.sml, bug276.2.sml
3678 :     Status: fixed in 0.73
3679 :     -------------------------------------------------------------------------------
3680 :     Number: 277
3681 :     Title: incorrect "inconsistent equality property" error
3682 :     Keywords: modules, functors, equality
3683 :     Submitter: dbm
3684 :     Date: 3/16/90
3685 :     Version: 0.66
3686 :     Severity: major
3687 :     Problem:
3688 :     Code: bug277.sml
3689 :     signature S1 =
3690 :     sig
3691 :     type d
3692 :     end;
3693 :    
3694 :     functor F(X: S1) :
3695 :     sig
3696 :     datatype a = C of X.d
3697 :     end =
3698 :     struct
3699 :     datatype a = C of X.d
3700 :     val f = fn (x : a) => x
3701 :     end;
3702 :     Transcript:
3703 :     bug277.sml: 11.3-11.24 Error: inconsistent equality properties (2)
3704 :     Status: fixed in 0.73
3705 :     -------------------------------------------------------------------------------
3706 :     Number: 278
3707 :     Title: local structure declaration at top level
3708 :     Keywords: modules, top level, local
3709 :     Submitter: R. M. O'Neill (cmp7130@sys.uea.ac.uk)
3710 :     Date: 4/3/90
3711 :     Version: 0.44a
3712 :     System: Sun 3/50 & 3/160S SunOS 3.5
3713 :     Severity: Minor (but, should be easy to fix and I would prefer it fixed)
3714 :    
3715 :     Problem:
3716 :    
3717 :     Using 'local ... in ... end' with structures does not work at the top level,
3718 :     but does work when wrapped in a 'struct ... end' construct
3719 :    
3720 :     Code:
3721 :     local
3722 :     structure Internal = struct val x=1 val y=2 end
3723 :     in
3724 :     structure First : sig val x : int end = Internal
3725 :     structure Second : sig val y : int end = Internal
3726 :     end
3727 :    
3728 :     [** As a TOP-LEVEL declaration **]
3729 :    
3730 :     Transcript:
3731 :    
3732 :     - local
3733 :     = structure Internal = struct val x=1 val y=2 end
3734 :     Error: expected IN, found STRUCTURE
3735 :     Error: expected END, found STRUCTURE
3736 :     = in
3737 :     Error: declaration or expression expected, found IN
3738 :     - structure First : sig val x : int end = Internal
3739 :     = structure Second : sig val y : int end = Internal
3740 :     Error: unbound structure name: Internal
3741 :     Error: unmatched val spec: x
3742 :     = end ;
3743 :     Error: unbound structure name: Internal
3744 :     Error: unmatched val spec: y
3745 :     Error: declaration or expression expected, found END
3746 :     -
3747 :    
3748 :     Compare-With:
3749 :    
3750 :     - structure Kludge = struct
3751 :     = local
3752 :     = structure Internal = struct val x=1 val y=2 end
3753 :     = in
3754 :     = structure First : sig val x : int end = Internal
3755 :     = structure Second : sig val y : int end = Internal
3756 :     = end
3757 :     = end ;
3758 :     structure Kludge :
3759 :     sig
3760 :     structure First : sig...end
3761 :     structure Second : sig...end
3762 :     end
3763 :     -
3764 :    
3765 :     Comments:
3766 :    
3767 :     Parser problem ? ( Expecting an 'ldec' rather than an 'sdec' ? )
3768 :     [ I'm no SML internal workings guru !]
3769 :    
3770 :     Status: fixed in 0.66
3771 :     -------------------------------------------------------------------------------
3772 :     Number: 279
3773 :     Title: big integers causing uncaught exception
3774 :     Keywords:
3775 :     Submitter: John Reppy (jhr@cs.cornell.edu)
3776 :     Date: 4/4/90
3777 :     Version: 0.55
3778 :     System: ?
3779 :     Severity: major
3780 :     Problem:
3781 :     There seems to be a problem in the compiler with integers that are larger
3782 :     than 2^29-1.
3783 :     Transcript:
3784 :     Standard ML of New Jersey, Version 0.55, 1 April 1990
3785 :     val it = () : unit
3786 :     - fun f (i : int, two_i : int) = (
3787 :     = print i; print ": "; print two_i; print "\n"; f(i+1, two_i+two_i));
3788 :     val f = fn : int * int -> 'a
3789 :     - f(0, 1);
3790 :     0: 1
3791 :     1: 2
3792 :     2: 4
3793 :     3: 8
3794 :     ...
3795 :     27: 134217728
3796 :     28: 268435456
3797 :     29: 536870912
3798 :     uncaught exception
3799 :     - 536870912;
3800 :     uncaught exception
3801 :     - 536870911;
3802 :     val it = 536870911 : int
3803 :     Status: fixed in 0.66 on mipsb
3804 :     -------------------------------------------------------------------------------
3805 :     Number: 280
3806 :     Title: included infix specs not printed
3807 :     Keywords: modules, signatures, include, infix
3808 :     Submitter: John Reppy
3809 :     Date: 4/17/90
3810 :     Version: 0.56
3811 :     Severity: minor
3812 :     Problem:
3813 :     I noticed that if you include a signature that contains an infix
3814 :     specification, the infix specification doesn't get printed.
3815 :     Code:
3816 :     Transcript:
3817 :     - signature S1 = sig infix ## end;
3818 :     signature S1 =
3819 :     sig
3820 :     infix 0 ##
3821 :     end
3822 :     - signature S2 = sig include S1 end;
3823 :     signature S2 =
3824 :     sig
3825 :     end
3826 :     Status: fixed in 0.73
3827 :     -------------------------------------------------------------------------------
3828 :     Number: 281
3829 :     Title: Import bombs out when it can't find files.
3830 :     Keywords:
3831 :     Submitter: Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
3832 :     Date: 7/17/90
3833 :     Version: 0.59
3834 :     System: Sun3, SunOS 4.1
3835 :     Severity: You decide...
3836 :     Problem:
3837 :    
3838 :     Importing new files (ones which do not already have a '.bin' file) fails (with
3839 :     an uncaught exception) whilst attempting to import files which do not exist
3840 :     produces the same unfriendly message.
3841 :    
3842 :     Transcript:
3843 :    
3844 :     unix% ls
3845 :     file.sml
3846 :     unix% sml
3847 :     Standard ML of New Jersey, Version 0.59, 4 June 1990
3848 :     - import "file";
3849 :    
3850 :     uncaught exception SystemCall
3851 :     - import "nofile";
3852 :    
3853 :     uncaught exception SystemCall
3854 :     -
3855 :    
3856 :     Perceived Reason:
3857 :    
3858 :     The timeFile function in sepcomp/importer.sml believes that the SysIO.mtime
3859 :     function will raise an Io exeption if it cannot find the file. In fact this
3860 :     exception is never returned by any of the routines in the SysIO module. When
3861 :     they encounter a problem they raise the SystemCall exception.
3862 :    
3863 :     Fix (currently untried):
3864 :    
3865 :     Option 1:
3866 :    
3867 :     Change the code for timeFile to trap the SystemCall exeption instead of the
3868 :     Io exception.
3869 :    
3870 :     e.g.
3871 :    
3872 :     <PATCH BEGIN>
3873 :     *** sepcomp/importer.sml.orig Fri Jun 1 14:08:02 1990
3874 :     --- sepcomp/importer.sml Tue Jul 17 10:29:22 1990
3875 :     ***************
3876 :     *** 159,165 ****
3877 :     in
3878 :     SOME sec
3879 :     end
3880 :     ! handle (Io _) => NONE
3881 :    
3882 :     fun createBinary(indent, filename,
3883 :     statModule: statModule,
3884 :     --- 159,165 ----
3885 :     in
3886 :     SOME sec
3887 :     end
3888 :     ! handle (SystemCall _) => NONE
3889 :    
3890 :     fun createBinary(indent, filename,
3891 :     statModule: statModule,
3892 :    
3893 :     <PATCH END>
3894 :    
3895 :     Option 2:
3896 :    
3897 :     Create a new exception SysIO wich the module SysIO raises on failure and trap
3898 :     that. ( This is to my mind better since SystemCall is a rather wide exception
3899 :     to be trapping ).
3900 :    
3901 :     Status: fixed in 0.73
3902 :     -------------------------------------------------------------------------------
3903 :     Number: 282
3904 :     Title: 'sharable' & 'pervshare' compilers produce different .bin
3905 :     Keywords:
3906 :     Submitter: Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
3907 :     Date: 7/23/90
3908 :     Version: 0.60
3909 :     System: Sun3/50, SunOS 4.1
3910 :     Severity: You decide...
3911 :     Problem:
3912 :    
3913 :     The 'bin' files produced by the normal and the '-pervshare' versions of the
3914 :     compiler are different and each 'version' cannot load the other's '.bin' file
3915 :     reliably.
3916 :    
3917 :     Perhaps I have built the two versions differently, but I cannot see how since
3918 :     they were both built at the same time with the same .mo files (compiled with
3919 :     the 0.59 batch compiler).
3920 :    
3921 :     Below is a comprehensive transcript which should help in reproducing the bug,
3922 :     if it can be reproduced...
3923 :    
3924 :     Transcript:
3925 :    
3926 :     unix% cat > bug.sml
3927 :     functor test () = struct val it = "testing, testing, 1, 2, 3..." end
3928 :     unix% sml.pervshare
3929 :     Standard ML of New Jersey, Version 0.60, 13 July 1990
3930 :     val it = () : unit
3931 :     - import "bug";
3932 :     [reading bug.sml]
3933 :     [writing bug.bin... done]
3934 :     [closing bug.sml]
3935 :     functor test
3936 :     - ^D
3937 :     unix% sml.sharable
3938 :     Standard ML of New Jersey, Version 0.60, 13 July 1990
3939 :     val it = () : unit
3940 :     - import "bug";
3941 :     [reading bug.bin... done]
3942 :    
3943 :     [Major collection... 99% used (530424/535668), 1500 msec]
3944 :    
3945 :     [Increasing heap to 6920k]
3946 :    
3947 :     [Major collection... 100% used (530424/530424), 1400 msec]
3948 :    
3949 :     [Increasing heap to 11160k]
3950 :    
3951 :     [Major collection... 100% used (530424/530424), 1400 msec]
3952 :    
3953 :     [Increasing heap to 17520k]
3954 :    
3955 :     [Major collection... 100% used (530424/530424), 1400 msec]
3956 :    
3957 :     [Increasing heap to 22288k]
3958 :    
3959 :     [Major collection... 100% used (530424/530424), 1400 msec]
3960 :    
3961 :     [Increasing heap to 22656k]
3962 :    
3963 :     [Major collection... 100% used (530424/530424), 1420 msec]
3964 :    
3965 :     [Increasing heap to 22744k]
3966 :    
3967 :     [Major collection... 100% used (530424/530424), 1400 msec]
3968 :    
3969 :     [Increasing heap to 22752k]
3970 :    
3971 :     [Major collection... 100% used (530424/530424), 1400 msec]
3972 :    
3973 :     Warning: can't increase heap
3974 :    
3975 :     Ran out of memory
3976 :     unix% mv bug.bin bug.bin.sharable
3977 :     unix% sml.sharable
3978 :     Standard ML of New Jersey, Version 0.60, 13 July 1990
3979 :     val it = () : unit
3980 :     - import "bug";
3981 :     [reading bug.sml]
3982 :     [writing bug.bin... done]
3983 :     [closing bug.sml]
3984 :     functor test
3985 :     - ^D
3986 :     unix% sml.pervshare
3987 :     Standard ML of New Jersey, Version 0.60, 13 July 1990
3988 :     val it = () : unit
3989 :     - import "bug";
3990 :     [reading bug.bin... done]
3991 :     functor test
3992 :     - structure Test=test ();
3993 :     insttyc: NULLtyc
3994 :     Error: Compiler bug: Functor.applyFunctor.insttyc
3995 :     - ^D
3996 :     unix% mv bug.bin bug.bin.pervshare
3997 :     unix% cmp bug.bin.sharable bug.bin.pervshare
3998 :     bug.bin.sharable bug.bin.pervshare differ: char 62, line 2
3999 :     unix% ll bug.bin.*
4000 :     -rw------- 1 cmp7130 1415 Jul 23 10:21 bug.bin.pervshare
4001 :     -rw------- 1 cmp7130 17331 Jul 23 10:18 bug.bin.sharable
4002 :    
4003 :     Status: not a bug --- (defunct feature)
4004 :     -------------------------------------------------------------------------------
4005 :     Number: 283
4006 :     Title: openread (run.c) checking
4007 :     Keywords:
4008 :     Submitter: Peter Weinberger
4009 :     Date: 8/17/90
4010 :     Version: ?
4011 :     Severity: minor
4012 :     Problem:
4013 :     openread() in run.c does not check to see if it runs off the
4014 :     end of its allowed space.
4015 :     Comments:
4016 :     in practice, this shouldn't be a problem, since openread() only reads
4017 :     the first two or three mo files, which should be smaller than the
4018 :     initial heap size.
4019 :     Status: fixed in 0.74
4020 :     -------------------------------------------------------------------------------
4021 :     Number: 284
4022 :     Title: Poor type specification handling in mutually recursive functions.
4023 :     Keywords: types
4024 :     Submitter: Richard O'Neill (rmo%sys.uea.ac.uk@nsfnet-relay.ac.uk)
4025 :     Date: 8/14/90
4026 :     Version: 0.64, 0.62, 0.56, ...
4027 :     System: Sun3/180, SunOS 4.1
4028 :     Problem:
4029 :    
4030 :     When processing mutually recursive functions, Sml of NJ's current type
4031 :     mechanism prefers its own inferred types of functions to those specifically
4032 :     declared by the user.
4033 :    
4034 :     Code:
4035 :     type 'a foobar = {foo:'a, bar:'a}
4036 :    
4037 :     fun Foo (acc : 'a list foobar) (nil : 'a list) = acc
4038 :     | Foo {foo, bar} (h :: t) = Bar {foo=(h :: foo), bar=bar} t
4039 :    
4040 :     and Bar (acc : 'a list foobar) (nil : 'a list) = acc
4041 :     | Bar {foo, bar} (h :: t) = Foo {foo=foo, bar=(h :: bar)} t
4042 :    
4043 :     Transcript:
4044 :     unix% sml
4045 :     Standard ML of New Jersey, Version 0.64, 24 August 1990
4046 :     val it = () : unit
4047 :     - use "code.sml";
4048 :     [opening code.sml]
4049 :     type 'a foobar = {bar:'a,foo:'a}
4050 :     val Foo = fn : 'a list foobar -> 'a list -> 'a list foobar
4051 :     val Bar = fn : {bar:'a list,foo:'a list} -> 'a list -> 'a list foobar
4052 :     [closing code.sml]
4053 :     -
4054 :     - (* One would expect Foo & Bar to have the SAME type *)
4055 :    
4056 :     Comments:
4057 :    
4058 :     The type system seems to be deciding on the type of 'Bar' when it encounters
4059 :     it in the definition of 'Foo', and then sticking to that. Whilst it checks to
4060 :     see whether the type in the declaration of foo matches the type it has
4061 :     inferred, it does not change the 'Foo's type to be in line with its
4062 :     declaration.
4063 :    
4064 :     One can work around the problem by making sure that 'Bar' has the desired type
4065 :     the first time it is encountered. Thus, if Foo is defined as :-
4066 :    
4067 :     fun Foo (acc : 'a list foobar) (nil : 'a list) = acc
4068 :     | Foo {foo,bar} (h :: t) =
4069 :     Bar ({foo=(h :: foo), bar=bar} : 'a list foobar) t
4070 :    
4071 :     the correct types result :-
4072 :     type 'a foobar = {bar:'a,foo:'a}
4073 :     val Foo = fn : 'a list foobar -> 'a list -> 'a list foobar
4074 :     val Bar = fn : 'a list foobar -> 'a list -> 'a list foobar
4075 :    
4076 :     My (ancient) version of Poly/ML also exhibits the same behaviour.
4077 :    
4078 :     Status: not a bug; type abbreviations are not new types
4079 :     -------------------------------------------------------------------------------
4080 :     Number: 285
4081 :     Title: Bus error
4082 :     Keywords: modules
4083 :     Submitter:
4084 :     Alain Deutsch, Laboratoire d'Informatique, LIX,
4085 :     Ecole Polytechnique, 91128 Palaiseau Cedex, France.
4086 :    
4087 :     Date: 8/30/90
4088 :    
4089 :     Version:
4090 :     Standard ML of New Jersey, Version 0.56, 13 April 1990
4091 :    
4092 :     System:
4093 :     ULTRIX V4.0 (Rev. 174) System #1: Sat Feb 10 01:14:11 MET 1990
4094 :     UWS V4.0 (Rev. 164)
4095 :    
4096 :     Severity:
4097 :     critical
4098 :    
4099 :     Problem:
4100 :     Bus error.
4101 :    
4102 :     Code:
4103 :     use "bug.sml";
4104 :     (see enclosed files below, tarmail format)
4105 :    
4106 :     Transcript:
4107 :     Standard ML of New Jersey, Version 0.56, 13 April 1990
4108 :     Warning: input and output are now uncurried, arithmetic exceptions
4109 :     are re-arranged, div and mod are different; see doc/NEWS
4110 :     val it = () : unit
4111 :     - [opening /usr/users/lix/icsla/deutsch/ModeleSemantique/Bug/bug.sml]
4112 :     [opening Extensions.sml]
4113 :     type 'a printer = outstream * 'a -> unit
4114 :     type 'a transformer = 'a -> 'a
4115 :     [closing Extensions.sml]
4116 :     val it = () : unit
4117 :     [opening Utilities.sig.sml]
4118 :     signature Utilities =
4119 :     sig
4120 :     val assoc : ''a * (''a * 'b) list -> 'b option
4121 :     val butlast : 'a list -> 'a list
4122 :     val cartesian_product : 'a list * 'b list -> ('a * 'b) list
4123 :     val display_list : string * string * string * 'a printer -> 'a list printer
4124 :     val display_pair : string * string * string * 'a printer * 'b printer -> ('a * 'b) printer
4125 :     val error : string * string -> 'a
4126 :     val is_prefix : ''a list * ''a list -> bool
4127 :     val makestring_list : string * string * string * ('a -> string) -> 'a list -> string
4128 :     val member : ''a * ''a list -> bool
4129 :     val replace_prefix : (''a list * ''a list) * ''a list -> ''a list
4130 :     val update_alist : ''a * 'b * (''a * 'b) list -> (''a * 'b) list
4131 :     end
4132 :     [closing Utilities.sig.sml]
4133 :     val it = () : unit
4134 :     [opening Strings.sig.sml]
4135 :     signature Strings =
4136 :     sig
4137 :     type T
4138 :     val < : T * T -> bool
4139 :     val Display : T printer
4140 :     val Hash : T -> int
4141 :     val MakeString : T -> string
4142 :     val New : string -> T
4143 :     end
4144 :     [closing Strings.sig.sml]
4145 :     val it = () : unit
4146 :     [opening Aliases.sig.sml]
4147 :     signature Aliases =
4148 :     sig
4149 :     type Aliases
4150 :     type Path
4151 :     datatype Accessor
4152 :     con IntAcc : int -> Accessor
4153 :     con NamedAcc : string -> Accessor
4154 :     val ++ : Path * Accessor -> Path
4155 :     val Add : Path * Path -> Aliases transformer
4156 :     val Adds : Path list * Path list -> Aliases transformer
4157 :     val Aliased : Path * Path -> Aliases -> bool
4158 :     val Aliases : Path * Aliases -> Path list
4159 :     val DisplayAccessor : Accessor printer
4160 :     val DisplayPath : Path printer
4161 :     val MakeStringAcc : Accessor -> string
4162 :     val MakeStringPath : Path -> string
4163 :     val NewPath : Accessor list -> Path
4164 :     val PathDrop : Path * int -> Path
4165 :     val PathLength : Path -> int
4166 :     val PathNth : Path * int -> Accessor
4167 :     val Remove : Path list -> Aliases transformer
4168 :     val SetVariable : Path * Path -> Aliases transformer
4169 :     end
4170 :     [closing Aliases.sig.sml]
4171 :     val it = () : unit
4172 :     [opening Object.sig.sml]
4173 :     signature Object =
4174 :     sig
4175 :     type T
4176 :     val Display : T printer
4177 :     end
4178 :     [closing Object.sig.sml]
4179 :     val it = () : unit
4180 :     [opening OrderedSet.sig.sml]
4181 :     signature OrderedSet =
4182 :     sig
4183 :     type T
4184 :     val < : T * T -> bool
4185 :     val Display : T printer
4186 :     end
4187 :     [closing OrderedSet.sig.sml]
4188 :     val it = () : unit
4189 :     [opening Map.sml]
4190 :     Map.sml:125.6-127.68 Warning: match not exhaustive
4191 :     tree ((key,_),_,empty,_) => ...
4192 :     tree ((key,_),_,nonempty_subtree,_) => ...
4193 :     pid 4566 (sml) was killed on unaligned access, at pc 0x6016e0
4194 :    
4195 :     Process SML bus error
4196 :    
4197 :     Comments:
4198 :     The files loaded in "use.sml" are indeed necessary to reproduce the
4199 :     bug. Removing any one of them suppresses that particular occurence of
4200 :     the bug, bug, but only shifts the problem.
4201 :    
4202 :     Fix:
4203 :     Perhaps the GC, as suggested by the vanishing nature of
4204 :     the bug.
4205 :    
4206 :     Enclosed files: see bug285.tarmail
4207 :     Status: fixed in 0.73 (approximately)
4208 :     -------------------------------------------------------------------------------
4209 :     Number: 286
4210 :     Title: Compiler bug: inststr NULLstr
4211 :     Keywords:
4212 :     Submitter: Bob Harper (Robert.Harper@cs.cmu.edu)
4213 :     Date: 9/6/90
4214 :     Version: ?
4215 :     Severity: minor
4216 :     Problem:
4217 :     Compiler bug secondary error
4218 :     Code:
4219 :     functor AbsSyn( structure Id : ID and UnOp : UNOP
4220 :     and BinOp : BINOP ): ABSSYN =
4221 :     struct end;
4222 :     structure AbsSyn : ABSSYN = AbsSyn( structure Id = Id );
4223 :    
4224 :     (* because I forgot to add in the extra parameters *)
4225 :    
4226 :     Transcript:
4227 :     The result on execution is:
4228 :    
4229 :     /tmp/sml.tmp.k01743:2.5-2.10 Error: unmatched structure spec: UnOp
4230 :     /tmp/sml.tmp.k01743:2.5-2.10 Error: unmatched structure spec: BinOp
4231 :     Error: Compiler bug: inststr NULLstr
4232 :     Status: fixed in 0.70
4233 :     -------------------------------------------------------------------------------
4234 :     Number: 287
4235 :     Title: cosine function incorrectly defined
4236 :     Keywords:
4237 :     Submitter: Valerio Pinci
4238 :     Date: 9/6/90
4239 :     Version: 0.62
4240 :     System: Sparc Station 1, SUN OS 0.43
4241 :     Severity: major
4242 :     Problem: cos function returns wrong values.
4243 :     Code:
4244 :     cos 0.0;
4245 :     Transcript:
4246 :     - cos 0.0;
4247 :     val it = 0.0 : real
4248 :     Fix:
4249 :     In boot/math.sml, change "fun cos x = sin(PI-x)" to
4250 :     "fun cos x = sin(PIo2-x)".
4251 :     Status: fixed in 0.66
4252 :     -------------------------------------------------------------------------------
4253 :     Number: 288
4254 :     Title: extraneous "match not exhaustive" warning
4255 :     Keywords:
4256 :     Submitter: John (jhr@cs.cornell.edu)
4257 :     Date: 9/8/90
4258 :     Version: 0.64
4259 :     System: sun-4
4260 :     Severity: minor
4261 :     Problem: extraneous "match not exhaustive" warning
4262 :     Code:
4263 :     Transcript: <transcript of session illustrating problem>
4264 :    
4265 :     Standard ML of New Jersey, Version 0.64, 24 August 1990
4266 :     val it = () : unit
4267 :     - fun f 0 = 0 | f i = 1;
4268 :     std_in:1.5-1.21 Warning: match not exhaustive
4269 :     val f = fn : int -> int
4270 :     - fun f 0 = 0 | f _ = 1;
4271 :     std_in:3.5-3.21 Warning: match not exhaustive
4272 :     val f = fn : int -> int
4273 :     - f 5;
4274 :     val it = 1 : int
4275 :    
4276 :     Comments:
4277 :    
4278 :     [Appel] I tried this on version 0.64 on our dec 5810, and it works fine
4279 :     (no extraneous "match not exhaustive" messages). Was yours a profiling
4280 :     version or something like that?
4281 :    
4282 :     I tried it on a sun-4 here (version 0.64) and the bug did not show up,
4283 :     so it's not machine-specific.
4284 :    
4285 :     Status: fixed in 0.69
4286 :     -------------------------------------------------------------------------------
4287 :     Number: 289
4288 :     Title: 0.65 prerelease core dumps
4289 :     Keywords:
4290 :     Submitter: Bob Ballance (ballance@cascade.cs.unm.edu
4291 :     Date: 9/13/90
4292 :     Version: 0.65
4293 :     System: ?
4294 :     Severity: critical
4295 :     Problem: core dump
4296 :     Code:
4297 :     >>>>>>>>>> Sample file --- Causes failure of 0.65. Running "agcd" after
4298 :     failed load causes core dump.<<<<<<<<<
4299 :     (*
4300 :     * Stephen R. Wheat, 9/6/90
4301 :     * CS550 - HW1
4302 :     *)
4303 :    
4304 :     (*
4305 :     * Find the greatest common divisor
4306 :     *)
4307 :     fun gcd(1,b) = 1 (* avoid an endless situation *)
4308 :     | gcd(a,1) = 1 (* avoid an endless situation *)
4309 :     | gcd(0,b) = b (* most likely the one evenly divides the other *)
4310 :     | gcd(a,0) = a (* most likely the one evenly divides the other *)
4311 :     | gcd(a,b) =
4312 :     if (a<b) then
4313 :     gcd(a,b mod a)
4314 :     else
4315 :     (* if they are equal, the next recursion will get the answer *)
4316 :     gcd(a mod b,b);
4317 :    
4318 :     (*
4319 :     * My own absolute value function
4320 :     *)
4321 :     fun abs(a) = if (a<0) then ~a else a;
4322 :    
4323 :     (*
4324 :     * Find the gcd, regardless of the signs of the parameters
4325 :     *)
4326 :     fun agcd(a,b) = gcd(abs(a),abs(b));
4327 :    
4328 :     (*
4329 :     * Convert a rational number (represented as a 2-tuple) into its reduced form
4330 :     *)
4331 :     fun reduce(a,b) =
4332 :     let val c = agcd(a,b)
4333 :     in
4334 :     if (c = 1) then
4335 :     (* this avoids an endless recursion *)
4336 :     (a,b)
4337 :     else
4338 :     reduce((a div c),(b div c))
4339 :     end;
4340 :     Status: fixed in 0.69
4341 :     -------------------------------------------------------------------------------
4342 :     Number: 290
4343 :     Title: bin files of share/noshare versions are incompatible
4344 :     Keywords:
4345 :     Submitter: Eric Cooper (Eric.Cooper@cs.cmu.edu)
4346 :     Date: 9/18/90
4347 :     Version: 0.65
4348 :     System: ?
4349 :     Severity: minor
4350 :     Problem:
4351 :     The one problem I still have is that sml-noshare gets an illegal
4352 :     instruction when it tries to import a .bin file written by the sharable
4353 :     sml, and vice versa. Also, the .bin files produced by sml-noshare are
4354 :     much larger than those produced by sml. For example, compiling
4355 :     stream.sig.sml produces the following .bin files:
4356 :    
4357 :     -rw-r--r-- 1 ecc 2664 Sep 18 13:04 obj/stream.sig.bin
4358 :     -rw-r--r-- 1 ecc 14904 Sep 18 13:17 obj-noshare/stream.sig.bin
4359 :     Code:
4360 :     (* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
4361 :    
4362 :     (* STREAM: signature for a lazy stream.*)
4363 :    
4364 :     signature STREAM =
4365 :     sig type 'xa stream
4366 :     val streamify : (unit -> '_a) -> '_a stream
4367 :     val cons : '_a * '_a stream -> '_a stream
4368 :     val get : '_a stream -> '_a * '_a stream
4369 :     end
4370 :     Comments: same as 282
4371 :     Status: not a bug --- (defunct feature)
4372 :     -------------------------------------------------------------------------------
4373 :     Number: 291
4374 :     Title: floating point on sparc
4375 :     Keywords:
4376 :     Submitter: Bernard Sufrin
4377 :     Date: 9/18/90
4378 :     Version: 0.56
4379 :     System: Sparc
4380 :     Problem:
4381 :     The ``bad'' functions seem to compile incorrectly on Sparc machines
4382 :     but ok on 68020 machines. Looks like >=0.0 is compiled wrongly, but the
4383 :     circumstances are mystifying. Why does the presence of the pair parameter seem
4384 :     to be critical (offset calculation in the machine-specific code-generator?).
4385 :    
4386 :     Code:
4387 :    
4388 :     (* try ??bad(0.0, 0.0) (~0.2) *)
4389 :    
4390 :     fun bad (x, y) l =
4391 :     if l >= 0.0 then x else bad(x+l, y) (~l);
4392 :     fun alsobad (x, y) l =
4393 :     if l>0.0 orelse l=0.0 then x else alsobad(x+l, y) (~l);
4394 :     fun good (x, y) l =
4395 :     if 0.0 <= l then x else good(x+l, y) (~l);
4396 :     fun alsogood x y l =
4397 :     if l >= 0.0 then x else alsogood(x+l) y (~l);
4398 :    
4399 :     Status: fixed in 0.65
4400 :     -------------------------------------------------------------------------------
4401 :     Number: 292
4402 :     Title: debugger and interpreter incompatible
4403 :     Keywords: debugger
4404 :     Submitter: Todd Knoblock
4405 :     Todd@eecs.umich.edu
4406 :     Date: 9/24/90
4407 :    
4408 :     Version: 0.65
4409 :     System: Decstation 3100 under bsd AND Sun4/sparc under sunos
4410 :     Severity: Very Minor
4411 :     Problem: Compilation of sml with interpretor and debug packages fails
4412 :    
4413 :     Transcript: command: makeml -decstation bsd -i -debug
4414 :     or makeml -sun4 sunos -i -debug
4415 :     appears to progress normally until
4416 :    
4417 :    
4418 :     [closing dbguser/hio.sml]
4419 :     val it = () : unit
4420 :     [opening dbguser/hstore.sml]
4421 :     [opening debug/weak.sml]
4422 :     Error: Compiler bug: bad primop in interp
4423 :     [closing debug/weak.sml]
4424 :     [closing dbguser/hstore.sml]
4425 :     [closing dbguser/userlevel.sml]
4426 :    
4427 :    
4428 :     Comments:
4429 :    
4430 :     Running the compilation without the -i works on both platforms.
4431 :     If the interpretor and debugger are truly incompatible, then
4432 :     makeml should flag it.
4433 :     (apt) They aren't incompatible: the interpreter was broken.
4434 :    
4435 :     Status: fixed in 0.88, but interpreter breaks elsewhere on debugger code.
4436 :     -------------------------------------------------------------------------------
4437 :     Number: 293
4438 :     Title: debug problems
4439 :     Keywords: debugger, emacs
4440 :     Submitter: Todd Knoblock, todd@eecs.umich.edu
4441 :     Date: 9/26/90
4442 :     Version: SML 0.65, emacs 18.55.1
4443 :     System: Decstation under ultrix and Sun sparc under sunos
4444 :     Severity: error message: minor, no output: critical
4445 :    
4446 :     Synopsis:
4447 :    
4448 :     I am having two problems with the emacs debug package.
4449 :    
4450 :     The first is quite minor: on start-up on a non-x-display (like my
4451 :     terminal at home), emacs reports the following error when loading
4452 :     sml-init: file mode specification error:
4453 :     (void-variable-x-button-m-left).
4454 :    
4455 :     The second is more serious. When sending to the sml process, I do not
4456 :     get output until I move (c-x o/c-x b) into the process buffer. For example,
4457 :     if I have this in a buffer
4458 :    
4459 :     fun f(0) = 1
4460 :     | f(x) = x*(f (x-1));
4461 :    
4462 :     and type c-c c-c, then if sml has not been run before, emacs
4463 :     will bring up a window, and start it properly. However, the
4464 :     only output is
4465 :    
4466 :     Standard ML of New Jersey, Version 0.65, 10 September 1990
4467 :     val it = () : unit
4468 :     - emacsInit (); cd "/afs/engin.umich.edu/user/t/o/todd/";
4469 :     [opening /tmp/sml.tmp.a02351]
4470 :    
4471 :    
4472 :     Once I move into the buffer, then I get the rest of the output:
4473 :    
4474 :    
4475 :     val f = fn : int -> int
4476 :     [closing /tmp/sml.tmp.a02351]
4477 :    
4478 :     If sml is already running, and the window is not visible, then
4479 :     sending to the buffer does not cause it to become visible.
4480 :    
4481 :     Comments:
4482 :    
4483 :     If I disable the debugging code, by removing the two "hooks"
4484 :     in sml-init, then the interface works as in the past. I am
4485 :     running emacs version 18.55.1, and have tried it on two platforms:
4486 :     decstation under ultrix, and a sparc under sunos. Finally, it
4487 :     appears that the file outdent.el is redundant now, and could be
4488 :     removed from the distribution.
4489 :    
4490 :     Comments: [apt, 2/1/93]
4491 :     These bugs aren't fixed.
4492 :     The first is just a trivial error message.
4493 :     As to the second: we don't really guarantee that c-c c-c and similar
4494 :     emacs interface tricks will work with the debugger.
4495 :    
4496 :     You could "not a bug" these if you want, though they should get addressed
4497 :     eventually -- I deliberately didn't spend time on minor emacs-related
4498 :     problems last summer.
4499 :    
4500 :     Owner:
4501 :     Status: open
4502 :     -------------------------------------------------------------------------------
4503 :     Number: 294
4504 :     Title: weak polymorphic types
4505 :     Keywords: types, weak types, polymorphism
4506 :     Submitter: David Berry
4507 :     Date: 9/24/90
4508 :     Version: 0.65
4509 :     Severity: major
4510 :     Problem:
4511 :     The Memo structure in the Library still doesn't compile under SML-NJ 0.65
4512 :     It compiles under Poly/ML, and is based on a version for Edinburgh ML.
4513 :     Transcript:
4514 :     - use "memo.sml";
4515 :     [opening memo.sml]
4516 :     [opening ../signatures/Memo.sml]
4517 :     signature Memo =
4518 :     sig
4519 :     val memo : (Nat -> Nat) -> ('a -> Nat) -> (('a -> '_b) -> 'a -> '_b) -> ('a
4520 :     -> '_b) * ('a -> '_b)
4521 :     val memo2 : (Nat -> Nat) -> ('a -> Nat) -> ('_b -> Nat) -> (('a -> '_b -> '_
4522 :     c) -> 'a -> '_b -> '_c) -> ('a -> '_b -> '_c) * ('a -> '_b -> '_c)
4523 :     val memo3 : (Nat -> Nat) -> ('a -> Nat) -> ('_b -> Nat) -> ('_c -> Nat) -> (
4524 :     ('a -> '_b -> '_c -> '_d) -> 'a -> '_b -> '_c -> '_d) -> ('a -> '_b -> '_c -> '_
4525 :     d) * ('a -> '_b -> '_c -> '_d)
4526 :     val version : real
4527 :     end
4528 :     [closing ../signatures/Memo.sml]
4529 :     val it = () : unit
4530 :     memo.sml:41.7-53.33 Error: nongeneric weak type variable
4531 :     memo : (Nat -> Nat) -> ('aU -> Nat) -> (('aU -> '~3Z) -> 'aU -> '~3Z) -> ('aU
4532 :     -> '~3Z) * ('aU -> '~3Z)
4533 :     memo.sml:41.7-53.33 Error: nongeneric weak type variable
4534 :     memo : (Nat -> Nat) -> ('aU -> Nat) -> (('aU -> '~3Z) -> 'aU -> '~3Z) -> ('aU
4535 :     -> '~3Z) * ('aU -> '~3Z)
4536 :     memo.sml:41.7-53.33 Error: nongeneric weak type variable
4537 :     memo : (Nat -> Nat) -> ('aU -> Nat) -> (('aU -> '~3Z) -> 'aU -> '~3Z) -> ('aU
4538 :     -> '~3Z) * ('aU -> '~3Z)
4539 :     memo.sml:41.7-53.33 Error: nongeneric weak type variable
4540 :     memo : (Nat -> Nat) -> ('aU -> Nat) -> (('aU -> '~3Z) -> 'aU -> '~3Z) -> ('aU
4541 :     -> '~3Z) * ('aU -> '~3Z)
4542 :     memo.sml:58.5-58.76 Error: operator and operand don't agree (circularity)
4543 :     operator domain: ('Z -> '~3Y) -> 'Z -> '~3Y
4544 :     operand: ('Z -> '~3Y) -> 'Z -> '~3X -> '~3Y
4545 :     in expression:
4546 :     memo expfn injy ((fn _ => (fn <rule>)))
4547 :     memo.sml:60.5-63.43 Error: nongeneric weak type variable
4548 :     memo3 : (Nat -> Nat) -> ('W -> Nat) -> ('Z -> Nat) -> ('~3X -> Nat) -> (('W ->
4549 :     '~3V) -> 'W -> 'Z -> '~3X -> '~3V) -> ('W -> '~3V) * ('W -> '~3V)
4550 :     memo.sml:60.5-63.43 Error: nongeneric weak type variable
4551 :     memo3 : (Nat -> Nat) -> ('W -> Nat) -> ('Z -> Nat) -> ('~3X -> Nat) -> (('W ->
4552 :     '~3V) -> 'W -> 'Z -> '~3X -> '~3V) -> ('W -> '~3V) * ('W -> '~3V)
4553 :     memo.sml:60.5-63.43 Error: nongeneric weak type variable
4554 :     memo3 : (Nat -> Nat) -> ('W -> Nat) -> ('Z -> Nat) -> ('~3X -> Nat) -> (('W ->
4555 :     '~3V) -> 'W -> 'Z -> '~3X -> '~3V) -> ('W -> '~3V) * ('W -> '~3V)
4556 :     memo.sml:60.5-63.43 Error: nongeneric weak type variable
4557 :     memo3 : (Nat -> Nat) -> ('W -> Nat) -> ('Z -> Nat) -> ('~3X -> Nat) -> (('W ->
4558 :     '~3V) -> 'W -> 'Z -> '~3X -> '~3V) -> ('W -> '~3V) * ('W -> '~3V)
4559 :     memo.sml:60.5-63.43 Error: nongeneric weak type variable
4560 :     memo3 : (Nat -> Nat) -> ('W -> Nat) -> ('Z -> Nat) -> ('~3X -> Nat) -> (('W ->
4561 :     '~3V) -> 'W -> 'Z -> '~3X -> '~3V) -> ('W -> '~3V) * ('W -> '~3V)
4562 :     memo.sml:60.5-63.43 Error: nongeneric weak type variable
4563 :     memo3 : (Nat -> Nat) -> ('W -> Nat) -> ('Z -> Nat) -> ('~3X -> Nat) -> (('W ->
4564 :     '~3V) -> 'W -> 'Z -> '~3X -> '~3V) -> ('W -> '~3V) * ('W -> '~3V)
4565 :     memo.sml:15.1-65.3 Error: value type in structure doesn't match signature spec
4566 :     name: memo
4567 :     spec: (Nat -> Nat) -> ('a -> Nat) -> (('a -> '_b) -> 'a -> '_b) -> ('a -> '_
4568 :     b) * ('a -> '_b)
4569 :     actual: (Nat -> Nat) -> ('a -> Nat) -> (('a -> '~3Z) -> 'a -> '~3Z) -> ('a ->
4570 :     '~3Z) * ('a -> '~3Z)
4571 :     memo.sml:15.1-65.3 Error: value type in structure doesn't match signature spec
4572 :     name: memo2
4573 :     spec: (Nat -> Nat) -> ('a -> Nat) -> ('_b -> Nat) -> (('a -> '_b -> '_c) ->
4574 :     'a -> '_b -> '_c) -> ('a -> '_b -> '_c) * ('a -> '_b -> '_c)
4575 :     actual: (Nat -> Nat) -> ('a -> Nat) -> ('~3Z -> Nat) -> (('a -> '~3Y) -> 'a ->
4576 :     '~3Z -> '~3Y) -> error
4577 :     memo.sml:15.1-65.3 Error: value type in structure doesn't match signature spec
4578 :     name: memo3
4579 :     spec: (Nat -> Nat) -> ('a -> Nat) -> ('_b -> Nat) -> ('_c -> Nat) -> (('a ->
4580 :     '_b -> '_c -> '_d) -> 'a -> '_b -> '_c -> '_d) -> ('a -> '_b -> '_c -> '_d) * (
4581 :     'a -> '_b -> '_c -> '_d)
4582 :     actual: (Nat -> Nat) -> ('a -> Nat) -> ('b -> Nat) -> ('~3Z -> Nat) -> (('a ->
4583 :     '~3Y) -> 'a -> 'b -> '~3Z -> '~3Y) -> ('a -> '~3Y) * ('a -> '~3Y)
4584 :     [closing memo.sml]
4585 :     -
4586 :     Comment: for Memo.sml to compile, the name of structure Array in Bytearray.sml
4587 :     has to be changed.
4588 :     Status: fixed in 0.74
4589 :     -------------------------------------------------------------------------------
4590 :     Number: 295
4591 :     Title: Compiler bug: r_o in mcopt
4592 :     Keywords:
4593 :     Submitter: Kung Chen
4594 :     Date: 9/30/90
4595 :     Version: 0.56
4596 :     System: Sparc, Sun OS
4597 :     Problem: the optimization phase of pattern-mtaching dies
4598 :     Code:
4599 :     (* Categorical Abstract Machine simulator*)
4600 :     (* D. Rabin, 5-aug-90, translated to SML by K. Chen, 10-sept-90*)
4601 :    
4602 :     structure Cam = struct
4603 :    
4604 :     (* CAM instructions*)
4605 :    
4606 :     datatype 'val CAMinstr = QuoteInstr of 'val
4607 :     | PrimInstr of int * string
4608 :     | AccInstr of int
4609 :     | ConsInstr
4610 :     | CdrInstr
4611 :     | CarInstr
4612 :     | PushInstr
4613 :     | SwapInstr
4614 :     | BranchInstr of 'val CAMinstr list * 'val CAMinstr list
4615 :     | CurInstr of 'val CAMinstr list
4616 :     | AppInstr
4617 :     | ReturnInstr
4618 :     | UpdInstr
4619 :     | IdInstr
4620 :    
4621 :     type 'val Code = 'val CAMinstr list
4622 :    
4623 :     datatype 'const Val = Simple of 'const
4624 :     | Close of 'const Val * 'const Val CAMinstr list
4625 :     | Pair of 'const Val * 'const Val
4626 :     | Truth of bool
4627 :     | Save of 'const Val CAMinstr list
4628 :    
4629 :     (* CAM state*)
4630 :    
4631 :     datatype 'const CAMstate =
4632 :     CAMst of 'const Val * 'const Val list * (('const Val) CAMinstr) list
4633 :     | Halt
4634 :    
4635 :     (* CAM state transition function*)
4636 :    
4637 :     (* fun step : 'const CAMstate -> 'const CAMstate *)
4638 :    
4639 :     fun step CAMst(x, s, []) = Halt
4640 :     |step CAMst(x, s, IdInstr::is) = CAMst(x, s, is)
4641 :     |step CAMst(Pair(x, y), s, CarInstr::is) = CAMst(x ,s, is)
4642 :     |step CAMst(Pair(x, y), s, CdrInstr::is) = CAMst(y, s, is)
4643 :     |step CAMst(x, s , PushInstr::is) = CAMst(x, (x :: s), is)
4644 :     |step CAMst(x, (y :: s), SwapInstr::is) = CAMst(y ,(x :: s), is)
4645 :     |step CAMst(x, (y :: s), ConsInstr::is) = CAMst(Pair(x, y), (x :: s), is)
4646 :     |step CAMst(x, s, CurInstr(code)::is) = CAMst(Close(x, code), s ,is)
4647 :     |step CAMst(Pair(Close(x, code), y), s, AppInstr :: is)
4648 :     = CAMst(Pair(x, y), Save(is)::s, code)
4649 :     |step CAMst(x, Save(code)::s, ReturnInstr::is) = CAMst(x, s, code)
4650 :     |step CAMst(x, s, QuoteInstr(c)::is) = CAMst(c, s, is)
4651 :     |step CAMst(Pair(x,Truth(true)), s, BranchInstr(ifTrue, ifFalse)::is)
4652 :     = CAMst(x, s, ifTrue)
4653 :     |step CAMst(Pair(x, Truth(false)), s, BranchInstr(ifTrue, ifFalse)::is)
4654 :     = CAMst(x, s, ifFalse)
4655 :     |step CAMst(x, (y :: s), UpdInstr::is) = CAMst(y, s, is)
4656 :    
4657 :     end
4658 :    
4659 :     Transcript:
4660 :     - use "cam.sml";
4661 :     [opening cam.sml]
4662 :     Error: Compiler bug: r_o in mcopt
4663 :     [closing cam.sml]
4664 :    
4665 :     Status: fixed in 0.69
4666 :     -------------------------------------------------------------------------------
4667 :     Number: 296
4668 :     Title: patch for HP/MORE
4669 :     Keywords:
4670 :     Submitter: Brian Boutel (brian@comp.vuw.ac.nz)
4671 :     Date: 10/11/90
4672 :     Version: 0.66
4673 :     System: m68020 (H-P workstation) more/bsd
4674 :     Severity:
4675 :     Problem: source error in src/runtime/ml_os.h. Will not
4676 :     compile.
4677 :     Code: n/a
4678 :     Transcript: n/a
4679 :     Comments: I reported this for 0.56, the first version in which
4680 :     my patches for more/bsd on H-P workstations were included. The line
4681 :     in the source has been changed, but only to include the same fix for
4682 :     NeXT machines.
4683 :