Skip to content

Commit ef4c47d

Browse files
committed
configure: disable short float with Intel compiler
`short float` support of the Intel C++ Compiler (group of C and C++ compilers), at least versions 18.0 and 19.0, is half-baked. It can compile declarations of `short float` variables and expressions of `sizeof(short float)` but cannot compile operations of `short float` variables. In this situation, `AC_CHECK_TYPES(short float)` defines `HAVE_SHORT_FLOAT` as 1 and compilation errors occur in `ompi/mca/op/base/op_base_functions.c`. To avoid this error tentatively, we disable `short float` support when using the Intel C++ Compiler. Signed-off-by: KAWASHIMA Takahiro <[email protected]>
1 parent 9b54967 commit ef4c47d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

configure.ac

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,27 @@ OPAL_CHECK_IDENT([CC], [CFLAGS], [c], [C])
374374
# Check for some types
375375
#
376376

377+
# 'short float' support of the Intel C++ Compiler (group of C and C++
378+
# compilers), at least versions 18.0 and 19.0, is half-baked. It can
379+
# compile declarations of 'short float' variables and expressions of
380+
# 'sizeof(short float)' but cannot compile casts and operations of
381+
# 'short float' variables. In this situation, 'AC_CHECK_TYPES(short float)'
382+
# defines 'HAVE_SHORT_FLOAT' as 1 and compilation errors occur in
383+
# ompi/mca/op/base/op_base_functions.c. To avoid this error, check it
384+
# using 'AC_COMPILE_IFELSE' and set Autoconf cache variables before
385+
# 'AC_CHECK_TYPES(short float)'. This check can be removed when all
386+
# OMPI-supported Intel C++ Compilers support 'short float' completely
387+
# (or drop it completely).
388+
if test "$opal_cv_c_compiler_vendor" = "intel"; then
389+
AC_MSG_CHECKING([if Intel compiler supports "short float" properly])
390+
AC_COMPILE_IFELSE(
391+
[AC_LANG_SOURCE([float f(short float a, short float b) { return (float)(a + b); }])],
392+
[AC_MSG_RESULT([yes])],
393+
[ac_cv_type_short_float="no"
394+
ac_cv_type_short_float__Complex="no"]
395+
AC_MSG_RESULT([no]))
396+
fi
397+
377398
AC_CHECK_TYPES(int8_t)
378399
AC_CHECK_TYPES(uint8_t)
379400
AC_CHECK_TYPES(int16_t)

0 commit comments

Comments
 (0)