Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: [OMPI devel] the dangers of configure probing argument counts
From: Paul H. Hargrove (PHHargrove_at_[hidden])
Date: 2012-02-14 19:23:43


There was recently a fair amount of work done in hwloc to get configure
to work correctly for a probe that was intended to determine how many
arguments appear in a specific function prototype. The "issue" was that
the C spec doesn't require that the C compiler issue an error for either
too-many or too-few arguments. While gcc and most other compilers make
both cases an error, there are two compilers of non-trivial importance
which do NOT:
+ By default the IBM (xlc) C compiler warns for the case of too many
argument.
+ By default the Intel (icc) C compiler warns for the case of too few
arguments.

This renders configure-time tests that want to check argument counts
unreliable unless one takes special care to add something "special" to
CFLAGS. While hacking on hwloc we determined that is was NOT safe for
configure to add to CFLAGS in general, nor to ask the user to do so. It
was only safe to /temporarily/ add to CFLAGS for the duration of the
argument count probe.

So, WHY am I tell you all this?
Because of the following in
openmpi-1.7a1r25865/ompi/config/ompi_check_openib.m4:
> [AC_CACHE_CHECK(
> [number of arguments to ibv_create_cq],
which performs exactly the sort of test I am warning against.

So, I would encourage somebody to make the effort to reuse the configure
logic Jeff and I developed for hwloc.
In particular look for setting and use of HWLOC_STRICT_ARGS_CFLAGS in
config/hwloc.m4

-Paul

-- 
Paul H. Hargrove                          PHHargrove_at_[hidden]
Future Technologies Group
HPC Research Department                   Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900