[m-rev.] for review: Support building with AddressSanitizer and UndefinedBehaviorSanitizer.

Julien Fischer jfischer at opturion.com
Wed Oct 12 12:48:51 AEDT 2016


Hi Peter,

On Tue, 11 Oct 2016, Peter Wang wrote:

> configure.ac:
>    Add configure option --enable-sanitizers.
>

...

> diff --git a/README.sanitizers b/README.sanitizers
> new file mode 100644
> index 0000000..003c133
> --- /dev/null
> +++ b/README.sanitizers
> @@ -0,0 +1,27 @@
> +The configure option `--enable-sanitizers' will enable AddressSanitizer
> +and UndefinedBehaviorSanitizer when building with gcc. The built Mercury
> +compiler will also enable the same sanitizers when building user programs.
> +
> +AddressSanitizer and UndefinedBehaviorSanitizer are included in gcc 4.9
> +and above. We have tested with gcc 5.8.0.
> +
> +Only high-level C grades work with the sanitizers enabled.
> +
> +For best results, add these options to Mmake.params before building Mercury:
> +
> +    EXTRA_MCFLAGS += --c-debug
> +    EXTRA_MGNUCFLAGS += --c-debug
> +    EXTRA_MLFLAGS += --c-debug
> +
> +Likewise, pass --c-debug when building user programs.

Just using an .ll_debug grade would have the same effect and is less
fiddly.

Julien.


More information about the reviews mailing list