[m-rev.] Compiler bug found

Volker Wysk post at volker-wysk.de
Tue Nov 25 04:39:44 AEDT 2025


Hi

I found a compiler bug. I've tried with the latest ROTD release. The bug
occurs here:

:- pred umbenennen_1(
    list(pair(iosupp.path, iosupp.path))::in,  
    pair(iosupp.path, iosupp.path)::in,        
    io::di, io::uo
) is det.

umbenennen_1(Symlinks, PfadAlt - PfadNeu, !IO) :-

    !( iosupp.path_exists_p(no, PfadNeu), Existiert1, !IO ),
    (
        Existiert1 = yes,
        write_string("-1-\n", !IO),             % <-- HERE
        throw("Zielpfad " ++ quote(unslice_path(PfadNeu)) ++ 
            " gibt es schon. Kann " ++
            quote(unslice_path(PfadAltEcht)) ++ " nicht umbenennen.")
    ;
        Existiert1 = no
    ),

    !( iosupp.path_exists_p(no, PfadAlt), Existiert2, !IO ),
    (
        Existiert2 = yes
    ;
        Existiert2 = no,
        throw("Quellpfad " ++ quote(unslice_path(PfadAlt)) ++ 
              " gibt es nicht. Kann " ++
              "nicht umbenennen.")
    ),

    !( posix.realpath_p(PfadAlt), PfadAltEcht, !IO ),
    datei_verschieben(PfadAlt, PfadNeu, !IO),
    !( posix.realpath_p(PfadNeu), PfadNeuEcht, !IO ),
    
    foldl(symlink_berichtigen(PfadAltEcht, PfadNeuEcht), Symlinks, !IO).


When the line marked with "<-- HERE" is commented out, all is fine. When it
is included, a whole bunch of errors are reported (all part of one mode
error in conjunction). 

I've made a small example to reproduce the bug (see attachment). I've
included all dependencies. Compile and trigger the bug with make.sh. The
"!/4" predicate is in iosupp.m.
 
Cheers,
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.tar.gz
Type: application/x-compressed-tar
Size: 21220 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20251124/bb1f9ef7/attachment-0001.bin>


More information about the reviews mailing list