Skip to content

Non-compliant C90 comments at mpi.h file leads to compilation failure for codes compiled with gcc -ansi or -std=c90 flags #12710

Closed
@bcmundim

Description

@bcmundim

Background information

What version of Open MPI are you using? (e.g., v4.1.6, v5.0.1, git branch name and hash, etc.)

v5.0.2

Describe how Open MPI was installed (e.g., from a source/distribution tarball, from a git clone, from an operating system distribution package, etc.)

From a source/distribution tarball

Please describe the system on which you are running

  • Operating system/version: Linux CentOS/7.9
  • Computer hardware: Lenovo SR630 server
  • Network type: Infiniband

Details of the problem

While trying to compile one of Visit software dependencies, IceT, the compilation was interrupted with an error while parsing OpenMPI mpi.h file included in one of their files. I tracked the problem down to non C90 compliant comments in the mpi.h. IceT uses the gcc -ansi flag and that triggers this bug. You can easily reproduce it by trying to compile the hello_c example you ship with the OpenMPI source code:

me@somewhere:~/src/openmpi/openmpi-5.0.5/examples$ CFLAGS=-ansi make hello_c
mpicc -ansi -g  hello_c.c  -o hello_c
In file included from /path/to/software/2022a/opt/gcc-11.3.0/openmpi/5.0.2+ucx-1.15.0/include/mpi.h:285,
                 from hello_c.c:11:
/path/to/software/2022a/opt/gcc-11.3.0/openmpi/5.0.2+ucx-1.15.0/include/mpi_portable_platform.h:294:30: error: operator '/' has no right operand
  294 | #elif defined(__NVCOMPILER) // Must occur prior to PGI and CLANG
      |                              ^
make: *** [hello_c] Error 1

This could be tracked down further at two comments on the header file ./opal/include/opal/opal_portable_platform_real.h at lines 294 and 593. I am not sure if there are other places that eventually will end up in the public facing mpi.h file though. Would it be possible to replace those comments with the C90 ones? At least on the public facing header files such as mpi.h?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions