Commit Graph

2 Commits

Author SHA1 Message Date
Zoltan Somogyi
fdd141bf77 Clean up the tests in the other test directories.
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the tests
    that check compiler error messages, expect the new line numbers.

browser/cterm.m:
browser/tree234_cc.m:
    Import only one module per line.

tests/hard_coded/boyer.m:
    Fix something I missed.
2015-02-16 12:32:18 +11:00
Julien Fischer
acc6161006 Fix a bug in the termination analysis that causes a software error
Estimated hours taken: 10
Branches: main

Fix a bug in the termination analysis that causes a software error
during pass 2.  This is due to a sanity check failing.

The bug in pass 1 occurred when the analyser detected a call to a procedure
that had an infinite change constant.  If the call affected the size
of any of the variables in the caller then the analyser marked it as an
error and aborted the remainder of pass 1.  Any other procedures in the
SCC were not checked and their change constant was set to infinite.

The analyser did not (correctly) consider a infinite change constant to be a
fatal error, ie. one that would result in nontermination, so it ran pass 2.
However, since the remainder of the SCC had not been analysed during pass 1
it had not been determined if any of those procedures made calls to
procedures that had been marked as nonterminating.  Pass 2 assumes the
opposite, namely that any SCC that is analysing will contain no calls
to procedures that have been marked as nonterminating since pass 1
should have detected this.

This diff fixes that problem by checking the remainder of the SCC for
nonterminating calls if the usual pass 1 is aborted.

compiler/term_pass1.m:
	Make sure that all of the SCC is checked for calls to nonterminating
	procedures when the analysis is abandoned due to a non-fatal error.

	Add a comment about why this is necessary.

	Add an end_module declaration.

compiler/term_pass2.m:
	Document some assumptions that this module makes.

compiler/term_traversal:
	Fix some formatting.

tests/term/Mmakefile:
tests/term/Mercury.options:
tests/term/inf_const_bug.m:
tests/term/inf_const_bug.trans_opt_exp
	Add a new test case.
2003-12-15 07:11:06 +00:00