mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-08 10:23:03 +00:00
Add a workaround for Mantis bug #492.
In debug grades that use global register variables, the generated C code is
triggering an internal error in GCC 9 on x86_64 machines. Force GCC to compile
at -O0 in this case as that seems to be the only workaround for the issue.
scripts/mgnuc.in:
Force GCC to use -O0 in the above case.
compiler/compile_target_code.m:
Do the same when GCC is invoked directly by the Mercury compiler.
Re-arrange some of the code that applies C compiler bug workarounds
to make this possible.
Add an XXX about an overly broad bug workaround on darwin; I'll look
into that separately.
This commit is contained in:
@@ -594,6 +594,21 @@ case "$FULLARCH" in
|
||||
;;
|
||||
esac
|
||||
|
||||
# Using global register variables triggers an internal error in the LRA pass of
|
||||
# GCC 9.1 and 9.2 on x86_64 systems in debug grades unless we compile at -O0.
|
||||
# See: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91430>
|
||||
#
|
||||
# Changes to this need to be reflected in the predicate
|
||||
# gather_c_compiler_flags/3 in compiler/compile_target_code.m.
|
||||
|
||||
case "$FULLARCH" in x86_64*)
|
||||
case $global_regs,$debug in true,true)
|
||||
case "$C_COMPILER_TYPE" in gcc_9_[12]*)
|
||||
ARCH_OPTS="$ARCH_OPTS -O0" ;;
|
||||
esac ;;
|
||||
esac ;;
|
||||
esac
|
||||
|
||||
# The -floop-optimize option is incompatible with the global register code
|
||||
# we generated on Darwin PowerPC. See the hard_coded/ppc_bug test case
|
||||
# for an example program which fails with this optimization.
|
||||
|
||||
Reference in New Issue
Block a user