[m-rev.] for review: Avoid require_tailrec_N failures at higher optimisation levels.
Peter Wang
novalazy at gmail.com
Wed Nov 11 16:26:01 AEDT 2020
tests/invalid/require_tailrec_1.m:
tests/invalid/require_tailrec_2.m:
tests/invalid/require_tailrec_3.m:
Suppress some inlining that occurs at higher optimisation levels,
that changes the warnings produced for require_tail_recursion
pragmas.
tests/invalid/require_tailrec_1.err_exp:
tests/invalid/require_tailrec_1.err_exp2:
tests/invalid/require_tailrec_1.err_exp3:
tests/invalid/require_tailrec_2.err_exp:
tests/invalid/require_tailrec_2.err_exp2:
tests/invalid/require_tailrec_2.err_exp3:
Update expected outputs for changed line numbers.
diff --git a/tests/invalid/require_tailrec_1.err_exp b/tests/invalid/require_tailrec_1.err_exp
index b3bec36f6..b819e84c2 100644
--- a/tests/invalid/require_tailrec_1.err_exp
+++ b/tests/invalid/require_tailrec_1.err_exp
@@ -5,17 +5,17 @@ require_tailrec_1.m:057: warning: self-recursive call is not tail recursive.
require_tailrec_1.m:065: In mode number 1 of function `even1'/1:
require_tailrec_1.m:065: warning: mutually recursive call to function
require_tailrec_1.m:065: `odd1'/1 is not tail recursive.
-require_tailrec_1.m:085: In mode number 1 of predicate `qsortapp_1'/2:
-require_tailrec_1.m:085: warning: self-recursive call is not tail recursive.
-require_tailrec_1.m:103: In mode number 1 of predicate `qsortapp_3'/2:
-require_tailrec_1.m:103: warning: self-recursive call is not tail recursive.
-require_tailrec_1.m:112: In mode number 1 of predicate `qsortapp_4'/2:
-require_tailrec_1.m:112: error: self-recursive call is not tail recursive.
-require_tailrec_1.m:121: In mode number 1 of predicate `qsortapp_5'/2:
-require_tailrec_1.m:121: warning: self-recursive call is not tail recursive.
-require_tailrec_1.m:130: In mode number 1 of predicate `qsortapp_6'/2:
-require_tailrec_1.m:130: warning: self-recursive call is not tail recursive.
-require_tailrec_1.m:137: In `:- pragma require_tail_recursion' for function
-require_tailrec_1.m:137: `cons'/2:
-require_tailrec_1.m:137: warning: the code defining this function contains no
-require_tailrec_1.m:137: recursive calls at all, tail-recursive or otherwise.
+require_tailrec_1.m:090: In mode number 1 of predicate `qsortapp_1'/2:
+require_tailrec_1.m:090: warning: self-recursive call is not tail recursive.
+require_tailrec_1.m:108: In mode number 1 of predicate `qsortapp_3'/2:
+require_tailrec_1.m:108: warning: self-recursive call is not tail recursive.
+require_tailrec_1.m:117: In mode number 1 of predicate `qsortapp_4'/2:
+require_tailrec_1.m:117: error: self-recursive call is not tail recursive.
+require_tailrec_1.m:126: In mode number 1 of predicate `qsortapp_5'/2:
+require_tailrec_1.m:126: warning: self-recursive call is not tail recursive.
+require_tailrec_1.m:135: In mode number 1 of predicate `qsortapp_6'/2:
+require_tailrec_1.m:135: warning: self-recursive call is not tail recursive.
+require_tailrec_1.m:142: In `:- pragma require_tail_recursion' for function
+require_tailrec_1.m:142: `cons'/2:
+require_tailrec_1.m:142: warning: the code defining this function contains no
+require_tailrec_1.m:142: recursive calls at all, tail-recursive or otherwise.
diff --git a/tests/invalid/require_tailrec_1.err_exp2 b/tests/invalid/require_tailrec_1.err_exp2
index 908d386a7..c968ebcd7 100644
--- a/tests/invalid/require_tailrec_1.err_exp2
+++ b/tests/invalid/require_tailrec_1.err_exp2
@@ -11,18 +11,18 @@ require_tailrec_1.m:074: `even1'/1 is tail recursive, but tail recursion
require_tailrec_1.m:074: optimization cannot be applied to it, because the
require_tailrec_1.m:074: *callee* cannot reach the caller via tail calls
require_tailrec_1.m:074: only.
-require_tailrec_1.m:085: In mode number 1 of predicate `qsortapp_1'/2:
-require_tailrec_1.m:085: warning: self-recursive call is not tail recursive.
-require_tailrec_1.m:103: In mode number 1 of predicate `qsortapp_3'/2:
-require_tailrec_1.m:103: warning: self-recursive call is not tail recursive.
-require_tailrec_1.m:112: In mode number 1 of predicate `qsortapp_4'/2:
-require_tailrec_1.m:112: error: self-recursive call is not tail recursive.
-require_tailrec_1.m:121: In mode number 1 of predicate `qsortapp_5'/2:
-require_tailrec_1.m:121: warning: self-recursive call is not tail recursive.
-require_tailrec_1.m:130: In mode number 1 of predicate `qsortapp_6'/2:
-require_tailrec_1.m:130: warning: self-recursive call is not tail recursive.
-require_tailrec_1.m:137: In `:- pragma require_tail_recursion' for function
-require_tailrec_1.m:137: `cons'/2:
-require_tailrec_1.m:137: warning: the code defining this function contains no
-require_tailrec_1.m:137: recursive calls at all, tail-recursive or otherwise.
+require_tailrec_1.m:090: In mode number 1 of predicate `qsortapp_1'/2:
+require_tailrec_1.m:090: warning: self-recursive call is not tail recursive.
+require_tailrec_1.m:108: In mode number 1 of predicate `qsortapp_3'/2:
+require_tailrec_1.m:108: warning: self-recursive call is not tail recursive.
+require_tailrec_1.m:117: In mode number 1 of predicate `qsortapp_4'/2:
+require_tailrec_1.m:117: error: self-recursive call is not tail recursive.
+require_tailrec_1.m:126: In mode number 1 of predicate `qsortapp_5'/2:
+require_tailrec_1.m:126: warning: self-recursive call is not tail recursive.
+require_tailrec_1.m:135: In mode number 1 of predicate `qsortapp_6'/2:
+require_tailrec_1.m:135: warning: self-recursive call is not tail recursive.
+require_tailrec_1.m:142: In `:- pragma require_tail_recursion' for function
+require_tailrec_1.m:142: `cons'/2:
+require_tailrec_1.m:142: warning: the code defining this function contains no
+require_tailrec_1.m:142: recursive calls at all, tail-recursive or otherwise.
For more information, recompile with `-E'.
diff --git a/tests/invalid/require_tailrec_1.err_exp3 b/tests/invalid/require_tailrec_1.err_exp3
index f647d11fd..7068b5d99 100644
--- a/tests/invalid/require_tailrec_1.err_exp3
+++ b/tests/invalid/require_tailrec_1.err_exp3
@@ -8,17 +8,17 @@ require_tailrec_1.m:065: `odd1'/1 is not tail recursive.
require_tailrec_1.m:074: In mode number 1 of function `odd1'/1:
require_tailrec_1.m:074: warning: mutually recursive call to function
require_tailrec_1.m:074: `even1'/1 is not tail recursive.
-require_tailrec_1.m:085: In mode number 1 of predicate `qsortapp_1'/2:
-require_tailrec_1.m:085: warning: self-recursive call is not tail recursive.
-require_tailrec_1.m:103: In mode number 1 of predicate `qsortapp_3'/2:
-require_tailrec_1.m:103: warning: self-recursive call is not tail recursive.
-require_tailrec_1.m:112: In mode number 1 of predicate `qsortapp_4'/2:
-require_tailrec_1.m:112: error: self-recursive call is not tail recursive.
-require_tailrec_1.m:121: In mode number 1 of predicate `qsortapp_5'/2:
-require_tailrec_1.m:121: warning: self-recursive call is not tail recursive.
-require_tailrec_1.m:130: In mode number 1 of predicate `qsortapp_6'/2:
-require_tailrec_1.m:130: warning: self-recursive call is not tail recursive.
-require_tailrec_1.m:137: In `:- pragma require_tail_recursion' for function
-require_tailrec_1.m:137: `cons'/2:
-require_tailrec_1.m:137: warning: the code defining this function contains no
-require_tailrec_1.m:137: recursive calls at all, tail-recursive or otherwise.
+require_tailrec_1.m:090: In mode number 1 of predicate `qsortapp_1'/2:
+require_tailrec_1.m:090: warning: self-recursive call is not tail recursive.
+require_tailrec_1.m:108: In mode number 1 of predicate `qsortapp_3'/2:
+require_tailrec_1.m:108: warning: self-recursive call is not tail recursive.
+require_tailrec_1.m:117: In mode number 1 of predicate `qsortapp_4'/2:
+require_tailrec_1.m:117: error: self-recursive call is not tail recursive.
+require_tailrec_1.m:126: In mode number 1 of predicate `qsortapp_5'/2:
+require_tailrec_1.m:126: warning: self-recursive call is not tail recursive.
+require_tailrec_1.m:135: In mode number 1 of predicate `qsortapp_6'/2:
+require_tailrec_1.m:135: warning: self-recursive call is not tail recursive.
+require_tailrec_1.m:142: In `:- pragma require_tail_recursion' for function
+require_tailrec_1.m:142: `cons'/2:
+require_tailrec_1.m:142: warning: the code defining this function contains no
+require_tailrec_1.m:142: recursive calls at all, tail-recursive or otherwise.
diff --git a/tests/invalid/require_tailrec_1.m b/tests/invalid/require_tailrec_1.m
index 11f3f8043..fb07cc863 100644
--- a/tests/invalid/require_tailrec_1.m
+++ b/tests/invalid/require_tailrec_1.m
@@ -74,6 +74,11 @@ odd1(N) =
even1(N - 1)
).
+% Suppress inlining of calls to even1 into odd1 and vice versa at higher
+% optimisation levels, as that would affect the warning messages produced.
+:- pragma no_inline(even1/1).
+:- pragma no_inline(odd1/1).
+
%---------------------------------------------------------------------------%
:- pragma require_tail_recursion(qsortapp_1/2).
diff --git a/tests/invalid/require_tailrec_2.err_exp b/tests/invalid/require_tailrec_2.err_exp
index a7e797ebf..e233f88af 100644
--- a/tests/invalid/require_tailrec_2.err_exp
+++ b/tests/invalid/require_tailrec_2.err_exp
@@ -5,19 +5,19 @@ require_tailrec_2.m:056: warning: self-recursive call is not tail recursive.
require_tailrec_2.m:064: In mode number 1 of function `even1'/1:
require_tailrec_2.m:064: warning: mutually recursive call to function
require_tailrec_2.m:064: `odd1'/1 is not tail recursive.
-require_tailrec_2.m:084: In mode number 1 of predicate `qsortapp_1'/2:
-require_tailrec_2.m:084: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:093: In mode number 1 of predicate `qsortapp_2'/2:
-require_tailrec_2.m:093: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:102: In mode number 1 of predicate `qsortapp_3'/2:
-require_tailrec_2.m:102: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:111: In mode number 1 of predicate `qsortapp_4'/2:
-require_tailrec_2.m:111: error: self-recursive call is not tail recursive.
-require_tailrec_2.m:120: In mode number 1 of predicate `qsortapp_5'/2:
-require_tailrec_2.m:120: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:129: In mode number 1 of predicate `qsortapp_6'/2:
-require_tailrec_2.m:129: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:136: In `:- pragma require_tail_recursion' for function
-require_tailrec_2.m:136: `cons'/2:
-require_tailrec_2.m:136: warning: the code defining this function contains no
-require_tailrec_2.m:136: recursive calls at all, tail-recursive or otherwise.
+require_tailrec_2.m:089: In mode number 1 of predicate `qsortapp_1'/2:
+require_tailrec_2.m:089: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:098: In mode number 1 of predicate `qsortapp_2'/2:
+require_tailrec_2.m:098: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:107: In mode number 1 of predicate `qsortapp_3'/2:
+require_tailrec_2.m:107: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:116: In mode number 1 of predicate `qsortapp_4'/2:
+require_tailrec_2.m:116: error: self-recursive call is not tail recursive.
+require_tailrec_2.m:125: In mode number 1 of predicate `qsortapp_5'/2:
+require_tailrec_2.m:125: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:134: In mode number 1 of predicate `qsortapp_6'/2:
+require_tailrec_2.m:134: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:141: In `:- pragma require_tail_recursion' for function
+require_tailrec_2.m:141: `cons'/2:
+require_tailrec_2.m:141: warning: the code defining this function contains no
+require_tailrec_2.m:141: recursive calls at all, tail-recursive or otherwise.
diff --git a/tests/invalid/require_tailrec_2.err_exp2 b/tests/invalid/require_tailrec_2.err_exp2
index 982591a70..1ae23c2a8 100644
--- a/tests/invalid/require_tailrec_2.err_exp2
+++ b/tests/invalid/require_tailrec_2.err_exp2
@@ -14,19 +14,19 @@ require_tailrec_2.m:073: only.
require_tailrec_2.m:073: The MLDS backend can optimize only *mutual* tail
require_tailrec_2.m:073: recursion; it cannot optimize tail recursion if it
require_tailrec_2.m:073: goes only one way between two procedures.
-require_tailrec_2.m:084: In mode number 1 of predicate `qsortapp_1'/2:
-require_tailrec_2.m:084: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:093: In mode number 1 of predicate `qsortapp_2'/2:
-require_tailrec_2.m:093: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:102: In mode number 1 of predicate `qsortapp_3'/2:
-require_tailrec_2.m:102: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:111: In mode number 1 of predicate `qsortapp_4'/2:
-require_tailrec_2.m:111: error: self-recursive call is not tail recursive.
-require_tailrec_2.m:120: In mode number 1 of predicate `qsortapp_5'/2:
-require_tailrec_2.m:120: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:129: In mode number 1 of predicate `qsortapp_6'/2:
-require_tailrec_2.m:129: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:136: In `:- pragma require_tail_recursion' for function
-require_tailrec_2.m:136: `cons'/2:
-require_tailrec_2.m:136: warning: the code defining this function contains no
-require_tailrec_2.m:136: recursive calls at all, tail-recursive or otherwise.
+require_tailrec_2.m:089: In mode number 1 of predicate `qsortapp_1'/2:
+require_tailrec_2.m:089: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:098: In mode number 1 of predicate `qsortapp_2'/2:
+require_tailrec_2.m:098: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:107: In mode number 1 of predicate `qsortapp_3'/2:
+require_tailrec_2.m:107: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:116: In mode number 1 of predicate `qsortapp_4'/2:
+require_tailrec_2.m:116: error: self-recursive call is not tail recursive.
+require_tailrec_2.m:125: In mode number 1 of predicate `qsortapp_5'/2:
+require_tailrec_2.m:125: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:134: In mode number 1 of predicate `qsortapp_6'/2:
+require_tailrec_2.m:134: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:141: In `:- pragma require_tail_recursion' for function
+require_tailrec_2.m:141: `cons'/2:
+require_tailrec_2.m:141: warning: the code defining this function contains no
+require_tailrec_2.m:141: recursive calls at all, tail-recursive or otherwise.
diff --git a/tests/invalid/require_tailrec_2.err_exp3 b/tests/invalid/require_tailrec_2.err_exp3
index c8c2e42a8..887068f7c 100644
--- a/tests/invalid/require_tailrec_2.err_exp3
+++ b/tests/invalid/require_tailrec_2.err_exp3
@@ -8,23 +8,23 @@ require_tailrec_2.m:064: `odd1'/1 is not tail recursive.
require_tailrec_2.m:073: In mode number 1 of function `odd1'/1:
require_tailrec_2.m:073: warning: mutually recursive call to function
require_tailrec_2.m:073: `even1'/1 is not tail recursive.
-require_tailrec_2.m:084: In mode number 1 of predicate `qsortapp_1'/2:
-require_tailrec_2.m:084: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:093: In mode number 1 of predicate `qsortapp_2'/2:
-require_tailrec_2.m:093: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:102: In mode number 1 of predicate `qsortapp_3'/2:
-require_tailrec_2.m:102: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:111: In mode number 1 of predicate `qsortapp_4'/2:
-require_tailrec_2.m:111: error: self-recursive call is not tail recursive.
-require_tailrec_2.m:120: In mode number 1 of predicate `qsortapp_5'/2:
-require_tailrec_2.m:120: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:129: In mode number 1 of predicate `qsortapp_6'/2:
-require_tailrec_2.m:129: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:136: In `:- pragma require_tail_recursion' for function
-require_tailrec_2.m:136: `cons'/2:
-require_tailrec_2.m:136: warning: the code defining this function contains no
-require_tailrec_2.m:136: recursive calls at all, tail-recursive or otherwise.
-require_tailrec_2.m:147: In mode number 1 of predicate `partition'/6:
-require_tailrec_2.m:147: warning: self-recursive call is not tail recursive.
-require_tailrec_2.m:149: In mode number 1 of predicate `partition'/6:
-require_tailrec_2.m:149: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:089: In mode number 1 of predicate `qsortapp_1'/2:
+require_tailrec_2.m:089: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:098: In mode number 1 of predicate `qsortapp_2'/2:
+require_tailrec_2.m:098: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:107: In mode number 1 of predicate `qsortapp_3'/2:
+require_tailrec_2.m:107: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:116: In mode number 1 of predicate `qsortapp_4'/2:
+require_tailrec_2.m:116: error: self-recursive call is not tail recursive.
+require_tailrec_2.m:125: In mode number 1 of predicate `qsortapp_5'/2:
+require_tailrec_2.m:125: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:134: In mode number 1 of predicate `qsortapp_6'/2:
+require_tailrec_2.m:134: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:141: In `:- pragma require_tail_recursion' for function
+require_tailrec_2.m:141: `cons'/2:
+require_tailrec_2.m:141: warning: the code defining this function contains no
+require_tailrec_2.m:141: recursive calls at all, tail-recursive or otherwise.
+require_tailrec_2.m:152: In mode number 1 of predicate `partition'/6:
+require_tailrec_2.m:152: warning: self-recursive call is not tail recursive.
+require_tailrec_2.m:154: In mode number 1 of predicate `partition'/6:
+require_tailrec_2.m:154: warning: self-recursive call is not tail recursive.
diff --git a/tests/invalid/require_tailrec_2.m b/tests/invalid/require_tailrec_2.m
index a6a92e78c..c0d9e1be7 100644
--- a/tests/invalid/require_tailrec_2.m
+++ b/tests/invalid/require_tailrec_2.m
@@ -73,6 +73,11 @@ odd1(N) =
even1(N - 1)
).
+% Suppress inlining of calls to even1 into odd1 and vice versa at higher
+% optimisation levels, as that would affect the warning messages produced.
+:- pragma no_inline(even1/1).
+:- pragma no_inline(odd1/1).
+
%---------------------------------------------------------------------------%
:- pragma require_tail_recursion(qsortapp_1/2).
diff --git a/tests/invalid/require_tailrec_3.m b/tests/invalid/require_tailrec_3.m
index 41f054197..02e7d8072 100644
--- a/tests/invalid/require_tailrec_3.m
+++ b/tests/invalid/require_tailrec_3.m
@@ -74,3 +74,13 @@ odd3(N) =
even3(N - 1)
).
+% Suppress inlining of calls to evenN into oddN and vice versa at higher
+% optimisation levels, as that would affect the warning messages produced.
+:- pragma no_inline(even1/1).
+:- pragma no_inline(odd1/1).
+
+:- pragma no_inline(even2/1).
+:- pragma no_inline(odd2/1).
+
+:- pragma no_inline(even3/1).
+:- pragma no_inline(odd3/1).
--
2.29.2
More information about the reviews
mailing list