0
0
mirror of https://gcc.gnu.org/git/gcc.git synced 2024-12-14 14:33:40 +08:00
gcc/libgomp/configure.tgt
Thomas Schwinge 8168338684 [gcn] Work-around libgomp 'error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' some more [PR101484]
With yesterday's commit 9f2bc5077d "[gcn]
Work-around libgomp 'error: array subscript 0 is outside array bounds of
‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' [PR101484]",
I did defuse the "unexpected" '-Werror=array-bounds' diagnostics that we see
as of commit a110855667 "Correct handling of
variable offset minus constant in -Warray-bounds [PR100137]".  However, these
'#pragma GCC diagnostic [...]' directives cause some code generation changes
(that seems unexpected, problematic!), which results in a lot (ten thousands)
of 'GCN team arena exhausted' run-time diagnostics, also leading to a few
FAILs:

    PASS: libgomp.c/../libgomp.c-c++-common/for-11.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-11.c execution test

    PASS: libgomp.c/../libgomp.c-c++-common/for-12.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-12.c execution test

    PASS: libgomp.c/../libgomp.c-c++-common/for-3.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-3.c execution test

    PASS: libgomp.c/../libgomp.c-c++-common/for-5.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-5.c execution test

    PASS: libgomp.c/../libgomp.c-c++-common/for-6.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-6.c execution test

    PASS: libgomp.c/../libgomp.c-c++-common/for-9.c (test for excess errors)
    [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/for-9.c execution test

Same for 'libgomp.c++'.

It remains to be analyzed how '#pragma GCC diagnostic [...]' directives can
cause code generation changes; for now I'm working around the "unexpected"
'-Werror=array-bounds' diagnostics differently.

Overall, still awaiting a different solution, of course.

	libgomp/
	PR target/101484
	* configure.tgt [amdgcn*-*-*] (XCFLAGS): Add
	'-Wno-error=array-bounds'.
	* config/gcn/team.c: Remove '-Werror=array-bounds' work-around.
	* libgomp.h [__AMDGCN__]: Likewise.
2021-07-20 09:14:28 +02:00

185 lines
3.9 KiB
Plaintext

# This is the target specific configuration file. This is invoked by the
# autoconf generated configure script. Putting it in a separate shell file
# lets us skip running autoconf when modifying target specific information.
# This file switches on the shell variable ${target}, and sets the
# following shell variables:
# config_path An ordered list of directories to search for
# sources and headers. This is relative to the
# config subdirectory of the source tree.
# XCFLAGS Add extra compile flags to use.
# XLDFLAGS Add extra link flags to use.
# tmake_file A list of machine-description-specific
# makefile fragments.
# Optimize TLS usage by avoiding the overhead of dynamic allocation.
if test $gcc_cv_have_tls = yes ; then
case "${target}" in
*-*-k*bsd*-gnu*)
;;
*-*-musl*)
;;
*-*-linux* | *-*-gnu*)
XCFLAGS="${XCFLAGS} -ftls-model=initial-exec -DUSING_INITIAL_EXEC_TLS"
;;
*-*-rtems*)
XCFLAGS="${XCFLAGS} -ftls-model=local-exec"
;;
esac
fi
tmake_file=
# Since we require POSIX threads, assume a POSIX system by default.
config_path="posix"
# Check for futex enabled all at once.
if test x$enable_linux_futex = xyes; then
case "${target}" in
aarch64*-*-linux*)
config_path="linux posix"
;;
alpha*-*-linux*)
config_path="linux/alpha linux posix"
;;
arm*-*-linux*)
config_path="linux posix"
;;
ia64*-*-linux*)
config_path="linux/ia64 linux posix"
;;
mips*-*-linux*)
config_path="linux/mips linux posix"
;;
powerpc*-*-linux*)
config_path="linux/powerpc linux posix"
;;
riscv64*-*-linux*)
config_path="linux posix"
;;
s390*-*-linux*)
config_path="linux/s390 linux posix"
;;
tile*-*-linux*)
config_path="linux/tile linux posix"
;;
# Note that bare i386 is not included here. We need cmpxchg.
i[456]86-*-linux* | x86_64-*-linux*)
config_path="linux/x86 linux posix"
cat > conftestx.c <<EOF
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
#error need -march=i486
#endif
EOF
if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
:
else
if test "${target_cpu}" = x86_64; then
XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
else
XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
fi
fi
rm -f conftestx.c
;;
# Note that sparcv7 and sparcv8 is not included here. We need cas.
sparcv9-*-linux* | sparc64-*-linux*)
echo "int i;" > conftestx.c
if ${CC} ${CFLAGS} -c -o conftestx.o conftestx.c > /dev/null 2>&1; then
config_path="linux/sparc linux posix"
case "`/usr/bin/file conftestx.o`" in
*32-bit*)
case " ${CC} ${CFLAGS}" in
*" -mcpu=ultrasparc"*)
;;
*)
XCFLAGS="${XCFLAGS} -mcpu=v9"
;;
esac
;;
esac
fi
rm -f conftestx.c conftestx.o
;;
esac
fi
# Other system configury
case "${target}" in
*-*-hpux*)
config_path="hpux posix"
case "${target}" in
*-*-hpux11*)
# HPUX v11.x requires -lrt to resolve sem_init in libgomp.la
XLDFLAGS="${XLDFLAGS} -lrt"
;;
esac
case "${target}" in
hppa[12]*-*-hpux*)
# PA 32 HP-UX needs -frandom-seed for bootstrap compare.
XCFLAGS="${XCFLAGS} -frandom-seed=fixed-seed"
;;
esac
;;
*-*-mingw32*)
config_path="mingw32 posix"
;;
*-*-darwin*)
config_path="bsd darwin posix"
;;
*-*-freebsd*)
# Need to link with -lpthread so libgomp.so is self-contained.
XLDFLAGS="${XLDFLAGS} -lpthread"
;;
*-*-aix*)
config_path="posix"
# Need to link with -lpthread so libgomp.so is self-contained.
XLDFLAGS="${XLDFLAGS} -lpthread"
# AIX needs -frandom-seed for bootstrap compare.
XCFLAGS="${XCFLAGS} -frandom-seed=\$@"
# Create AIX-style "FAT" libraries.
tmake_file="t-aix"
;;
nvptx*-*-*)
config_path="nvptx accel"
;;
*-*-rtems*)
# Use self-contained synchronization objects if provided by Newlib
if test "x$ac_cv_type_struct__Mutex_Control" = xyes ; then
config_path="rtems posix"
fi
;;
amdgcn*-*-*)
config_path="gcn accel"
#TODO PR101484
XCFLAGS="$XCFLAGS -Wno-error=array-bounds"
;;
*)
;;
esac