You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following program segfaults if you change -fno-strict-aliasing to -fstrict-aliasing in the command patscc -DATS_MEMALLOC_LIBC -O2 -finline-functions -fno-strict-aliasing strict-aliasing-problem.dats && ./a.out
#include "share/atspre_define.hats"
#include "share/atspre_staload.hats"
staload UN = "prelude/SATS/unsafe.sats"
fun
count_down {n : nat} (n : int n) : stream int =
if n = 0 then
stream_make_nil ()
else
$delay (stream_cons (n, (print! ("{", n, "}");
count_down (pred n))))
implement
main0 () =
{
val lst = count_down 5
val () = print! ("(", $UN.cast {int} lst[0], ")")
val () = print! ("(", $UN.cast {int} lst[1], ")")
val () = print! ("(", $UN.cast {int} lst[2], ")")
val () = print! ("(", $UN.cast {int} lst[3], ")")
val () = print! ("(", $UN.cast {int} lst[4], ")")
val () = print! "|"
val lst = count_down 5
val () = print! ("(", $UN.cast {int} lst[4], ")")
val () = print! ("(", $UN.cast {int} lst[3], ")")
val () = print! ("(", $UN.cast {int} lst[2], ")")
val () = print! ("(", $UN.cast {int} lst[1], ")")
val () = print! ("(", $UN.cast {int} lst[0], ")")
}
The text was updated successfully, but these errors were encountered:
The following program segfaults if you change
-fno-strict-aliasing
to-fstrict-aliasing
in the commandpatscc -DATS_MEMALLOC_LIBC -O2 -finline-functions -fno-strict-aliasing strict-aliasing-problem.dats && ./a.out
The text was updated successfully, but these errors were encountered: