## MLton 20241230

# Bugs20041109

Here are the known bugs in MLton 20041109, listed in reverse chronological order of date reported.

- `MLton.Finalizable.touch` doesn’t necessarily keep values alive long enough. Our SVN has a patch to the compiler. You must rebuild the compiler in order for the patch to take effect.

  Thanks to Florian Weimer for reporting this bug.

- A bug in an optimization pass may incorrectly transform a program to flatten ref cells into their containing data structure, yielding a type-error in the transformed program. Our CVS has a patch to the compiler. You must rebuild the compiler in order for the patch to take effect.

  Thanks to VesaKarvonen for reporting this bug.

- A bug in the front end mistakenly allows unary constructors to be used without an argument in patterns. For example, the following program is accepted, and triggers a large internal error.

      fun f x = case x of SOME => true | _ => false

  We have fixed the problem in our CVS.

  Thanks to William Lovas for reporting this bug.

- A bug in `Posix.IO.{getlk,setlk,setlkw}` causes a link-time error: `undefined reference to Posix_IO_FLock_typ` Our CVS has a patch to the Basis Library implementation.

  Thanks to Adam Chlipala for reporting this bug.

- A bug can cause programs compiled with `-profile alloc` to segfault. Our CVS has a patch to the compiler. You must rebuild the compiler in order for the patch to take effect.

  Thanks to John Reppy for reporting this bug.

- A bug in an optimization pass may incorrectly flatten ref cells into their containing data structure, breaking the sharing between the cells. Our CVS has a patch to the compiler. You must rebuild the compiler in order for the patch to take effect.

  Thanks to Paul Govereau for reporting this bug.

- Some arrays or vectors, such as `(char * char) vector`, are incorrectly implemented, and will conflate the first and second components of each element. Our CVS has a patch to the compiler. You must rebuild the compiler in order for the patch to take effect.

  Thanks to Scott Cruzen for reporting this bug.

- `Socket.Ctl.getLINGER` and `Socket.Ctl.setLINGER` mistakenly raise `Subscript`. Our CVS has a patch to the Basis Library implementation.

  Thanks to Ray Racine for reporting the bug.

- CML `Mailbox.send` makes a call in the wrong atomic context. Our CVS has a patch to the CML implementation.

- `OS.Path.joinDirFile` and `OS.Path.toString` did not raise `InvalidArc` when they were supposed to. They now do. Our CVS has a patch to the Basis Library implementation.

  Thanks to Andreas Rossberg for reporting the bug.

- The front end incorrectly disallows sequences of expressions (separated by semicolons) after a topdec has already been processed. For example, the following is incorrectly rejected.

      val x = 0;
      ignore x;
      ignore x;

  We have fixed the problem in our CVS.

  Thanks to Andreas Rossberg for reporting the bug.

- The front end incorrectly disallows expansive `val` declarations that bind a type variable that doesn’t occur in the type of the value being bound. For example, the following is incorrectly rejected.

      val 'a x = let exception E of 'a in () end

  We have fixed the problem in our CVS.

  Thanks to Andreas Rossberg for reporting this bug.

- The x86 codegen fails to account for the possibility that a 64-bit move could interfere with itself (as simulated by 32-bit moves). We have fixed the problem in our CVS.

  Thanks to Scott Cruzen for reporting this bug.

- `NetHostDB.scan` and `NetHostDB.fromString` incorrectly raise an exception on internet addresses whose last component is a zero, e.g `0.0.0.0`. Our CVS has a patch to the Basis Library implementation.

  Thanks to Scott Cruzen for reporting this bug.

- `StreamIO.inputLine` has an off-by-one error causing it to drop the first character after a newline in some situations. Our CVS has a patch. to the Basis Library implementation.

  Thanks to Scott Cruzen for reporting this bug.

- `BinIO.getInstream` and `TextIO.getInstream` are implemented incorrectly. This also impacts the behavior of `BinIO.scanStream` and `TextIO.scanStream`. If you (directly or indirectly) realize a `TextIO.StreamIO.instream` and do not (directly or indirectly) call `TextIO.setInstream` with a derived stream, you may lose input data. We have fixed the problem in our CVS.

  Thanks to WesleyTerpstra for reporting this bug.

- `Posix.ProcEnv.setpgid` doesn’t work. If you compile a program that uses it, you will get a link time error

      undefined reference to `Posix_ProcEnv_setpgid'

  The bug is due to `Posix_ProcEnv_setpgid` being omitted from the MLton runtime. We fixed the problem in our CVS by adding the following definition to `runtime/Posix/ProcEnv/ProcEnv.c`

      Int Posix_ProcEnv_setpgid (Pid p, Gid g) {
              return setpgid (p, g);
      }

  Thanks to Tom Murphy for reporting this bug.