[m-rev.] for post-commit review: fix crash while adding pragmas
Julien Fischer
jfischer at opturion.com
Tue Dec 21 11:42:15 AEDT 2021
On Sun, 19 Dec 2021, Zoltan Somogyi wrote:
> Fix compiler abort adding pragmas for unknown procs.
>
> compiler/add_pragma.m:
> The code that added gen_pragmas (pragmas that are generated
> *only* by the compiler, and which hold the analysis results)
> to the HLDS checked whether the *predicate* named by the pragma
> existed, and was prepared for the case where it did not.
> However, it was NOT prepared for the case where the predicate
> did exist, but the *procedure* whose mode number the pragma also named
> did not exist. It called module_info_pred_proc_info, which did a map.lookup
> in the predicate's procedure table, which crashed the compiler
> when the lookup failed.
>
> The code that puts these pragmas into .opt files does not check
> whether the pragma is for a predicate whose declaration will be visible
> to the readers of the .opt file, either by being contained in the
> module's .int file (for exported predicates) or in the .opt file itself
> (for nonexported predicates). Fixing that will be next.
>
> To help with that fix, change how we handle pragmas whose target
> predicate/procedure is not uniquely determined, i.e. either unknown
> or ambiguous. Before, we always ignored the error. Now, we still do that
> by default, but a developmer can now specify a new option
> which will cause add_pragma.m to generate an informational message
> for each such pragma.
>
> compiler/options.m:
> Add the new option, --inform-ignored-pragma-errors.
>
> doc/user_guide.texi:
> Document the new option, as well as an old one whose documentation
> was missing.
That's fine.
Julien.
More information about the reviews
mailing list