Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproduce #3057 #3058

Merged
merged 5 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,31 @@ function normalize () {
if [ -e "$1" ]
then
grep -a -E -v '^Raised by|^Raised at|^Re-raised at|^Re-Raised at|^Called from|^ +at ' $1 |
sed 's/\x00//g' |
sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' |
sed 's/^.*[IW], hypervisor:/hypervisor:/g' |
sed 's/wasm:0x[a-f0-9]*:/wasm:0x___:/g' |
sed 's/prelude:[^:]*:/prelude:___:/g' |
sed 's/prim:[^:]*:/prim:___:/g' |
sed 's/ calling func\$[0-9]*/ calling func$NNN/g' |
sed 's/rip_addr: [0-9]*/rip_addr: XXX/g' |
sed 's,/private/tmp/,/tmp/,g' |
sed 's,/tmp/.*ic.[^/]*,/tmp/ic.XXX,g' |
sed 's,/build/.*ic.[^/]*,/tmp/ic.XXX,g' |
sed 's,^.*/idl/_out/,..../idl/_out/,g' | # node puts full paths in error messages
sed 's,\([a-zA-Z0-9.-]*\).mo.mangled,\1.mo,g' |
sed 's/trap at 0x[a-f0-9]*/trap at 0x___:/g' |
sed 's/^\( [0-9]\+:\).*!/\1 /g' | # wasmtime backtrace locations
sed 's/Ignore Diff:.*/Ignore Diff: (ignored)/ig' |
sed 's/compiler (source .*)/compiler (source XXX)/ig' |
sed -e 's/\x00//g' \
-e 's/\x1b\[[0-9;]*[a-zA-Z]//g' \
-e 's/^.*[IW], hypervisor:/hypervisor:/g' \
-e 's/wasm:0x[a-f0-9]*:/wasm:0x___:/g' \
-e 's/prelude:[^:]*:/prelude:___:/g' \
-e 's/prim:[^:]*:/prim:___:/g' \
-e 's/ calling func\$[0-9]*/ calling func$NNN/g' \
-e 's/rip_addr: [0-9]*/rip_addr: XXX/g' \
-e 's,/private/tmp/,/tmp/,g' \
-e 's,/tmp/.*ic.[^/]*,/tmp/ic.XXX,g' \
-e 's,/build/.*ic.[^/]*,/tmp/ic.XXX,g' \
-e 's,^.*/idl/_out/,..../idl/_out/,g' | # node puts full paths in error messages
sed -e 's,\([a-zA-Z0-9.-]*\).mo.mangled,\1.mo,g' \
-e 's/trap at 0x[a-f0-9]*/trap at 0x___:/g' \
-e 's/^\( [0-9]\+:\).*!/\1 /g' | # wasmtime backtrace locations
sed -e 's/Ignore Diff:.*/Ignore Diff: (ignored)/ig' \
-e 's/Motoko (source .*)/Motoko (source XXX)/ig' \
-e 's/compiler (source .*)/compiler (source XXX)/ig' |
# Normalize canister id prefixes in debug prints
sed 's/\[Canister [0-9a-z\-]*\]/debug.print:/g' |
# Normalize instruction locations on traps, added by ic-ref ad6ea9e
sed 's/region:0x[0-9a-fA-F]\+-0x[0-9a-fA-F]\+/region:0xXXX-0xXXX/g' |
sed -e 's/region:0x[0-9a-fA-F]\+-0x[0-9a-fA-F]\+/region:0xXXX-0xXXX/g' |
# Delete everything after Oom
sed '/RTS error: Cannot grow memory/q' |
cat > $1.norm
sed -e '/RTS error: Cannot grow memory/q' \
> $1.norm
mv $1.norm $1
fi
}
Expand Down Expand Up @@ -300,7 +301,7 @@ do
#
# which actually works on the IC platform

# needs to be in the same directory to preserve relative paths :-(
# needs to be in the same directory to preserve relative paths :-(
mangled=$base.mo.mangled
sed 's,^.*//OR-CALL,//CALL,g' $base.mo > $mangled

Expand All @@ -310,10 +311,10 @@ do
then
run comp $moc_with_flags $FLAGS_drun --hide-warnings --map -c $mangled -o $out/$base.wasm
run comp-ref $moc_with_flags $FLAGS_ic_ref_run --hide-warnings --map -c $mangled -o $out/$base.ref.wasm
elif [ $PERF = yes ]
then
elif [ $PERF = yes ]
then
run comp $moc_with_flags --hide-warnings --map -c $mangled -o $out/$base.wasm
else
else
run comp $moc_with_flags -g -wasi-system-api --hide-warnings --map -c $mangled -o $out/$base.wasm
fi

Expand Down Expand Up @@ -363,14 +364,14 @@ do
# collect size stats
if [ "$PERF" = yes -a -e "$out/$base.wasm" ]
then
if [ -n "$PERF_OUT" ]
if [ -n "$PERF_OUT" ]
then
wasm-strip $out/$base.wasm
echo "size/$base;$(stat --format=%s $out/$base.wasm)" >> $PERF_OUT
fi
fi

rm -f $mangled
rm -f $mangled
fi
fi
;;
Expand Down
6 changes: 6 additions & 0 deletions test/run/3057.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module {
public class Id<A>(x : A) {
public func map<B>(f : A -> B) : Id<B> = Id(f x)
}
}

6 changes: 6 additions & 0 deletions test/run/ok/3057.tc.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
OOPS! You've triggered a compiler bug.
Please report this at https://github.com/dfinity/motoko/issues/new with the following details:

Motoko (source XXX)

Fatal error: exception Stack overflow
1 change: 1 addition & 0 deletions test/run/ok/3057.tc.ret.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Return code 2