1
1

A workaround for a bug in the PGI 6.2 compiler series. This bug has

been fixed in the 7.0 PGI series, but is unlikely to be fixed in the
6.2 series:

 * Add a configure test looking for the bad behavior (the PGI compiler
   chokes on C code where structs containing bool's are copied by
   value)
 * Set OMPI_BOOL_STRUCT_COPY to 1 if it's ok, 0 if it's not (i.e., PGI
   6.2 series will have this value set to 0)
 * In two places in the code base -- orte-clean and btl_openib_ini.h,
   we have a struct that contains a bool that is copied by value.  In
   these two places, check OMPI_BOOL_STRUCT_COPY and if it's 1, use
   the "int" type instead of "bool".

Fixes trac:739

This commit was SVN r13076.

The following Trac tickets were found above:
  Ticket 739 --> https://svn.open-mpi.org/trac/ompi/ticket/739
Этот коммит содержится в:
Jeff Squyres 2007-01-11 02:21:26 +00:00
родитель 0f68bb0bc0
Коммит f0932a0701
6 изменённых файлов: 82 добавлений и 8 удалений

Просмотреть файл

@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved. dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved. dnl All rights reserved.
dnl Copyright (c) 2006 Cisco Systems, Inc. dnl Copyright (c) 2006-2007 Cisco Systems, Inc.
dnl Copyright (c) 2006 Los Alamos National Security, LLC. All rights dnl Copyright (c) 2006 Los Alamos National Security, LLC. All rights
dnl reserved. dnl reserved.
dnl $COPYRIGHT$ dnl $COPYRIGHT$
@ -56,6 +56,7 @@ m4_include(config/ompi_objc.m4)
m4_include(config/ompi_try_assemble.m4) m4_include(config/ompi_try_assemble.m4)
m4_include(config/ompi_config_asm.m4) m4_include(config/ompi_config_asm.m4)
m4_include(config/ompi_check_bool_struct_copy.m4)
m4_include(config/ompi_case_sensitive_fs_setup.m4) m4_include(config/ompi_case_sensitive_fs_setup.m4)
m4_include(config/ompi_check_broken_qsort.m4) m4_include(config/ompi_check_broken_qsort.m4)
m4_include(config/ompi_check_compiler_works.m4) m4_include(config/ompi_check_compiler_works.m4)

Просмотреть файл

@ -9,7 +9,7 @@
# University of Stuttgart. All rights reserved. # University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -39,6 +39,7 @@ EXTRA_DIST = \
mca_make_configure.pl \ mca_make_configure.pl \
mca_no_configure_components.m4 \ mca_no_configure_components.m4 \
ompi_case_sensitive_fs_setup.m4 \ ompi_case_sensitive_fs_setup.m4 \
ompi_check_bool_struct_copy.m4 \
ompi_check_optflags.m4 \ ompi_check_optflags.m4 \
ompi_check_pthread_pids.m4 \ ompi_check_pthread_pids.m4 \
ompi_config_subdir.m4 \ ompi_config_subdir.m4 \

51
config/ompi_check_bool_struct_copy.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,51 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_CHECK_BOOL_STRUCT_COPY],[
dnl
dnl Portland PGI 6.2.x will choke when compiling a C code that copies
dnl a struct by value that contains bool members. This bug was fixed in
dnl PGI 7.0.
dnl
AC_MSG_CHECKING([whether structs containing bools can be copied by value])
AC_TRY_COMPILE([
/* If we do not have bool, just provide some test that will trivially
compile (because OMPI will set its own type for bool later) */
#if !defined(SIZEOF_BOOL)
int foo(void) { return 1; }
#else
#if OMPI_USE_STDBOOL_H
#include <stdbool.h>
#endif
struct bar_t {
bool a;
};
void foo(void) {
struct bar_t c, d;
c = d; /* this is where the error occurs */
}
#endif
],[],[ompi_ac_sbc=1 ompi_ac_sbc_msg=yes],[ompi_ac_sbc=0 ompi_ac_sbc_msg=no])
AC_DEFINE_UNQUOTED([OPAL_BOOL_STRUCT_COPY], [$ompi_ac_sbc],
[Whether the compiler supports copying structs by value that contain bool members (PGI 6.2.x had a bug such that this would choke the compiler)])
AC_MSG_RESULT([$ompi_ac_sbc_msg])])dnl

Просмотреть файл

@ -10,7 +10,7 @@
# University of Stuttgart. All rights reserved. # University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. # Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2006 Los Alamos National Security, LLC. All rights # Copyright (c) 2006 Los Alamos National Security, LLC. All rights
# reserved. # reserved.
@ -687,6 +687,12 @@ AC_CHECK_MEMBERS([struct dirent.d_type], [], [], [
AC_CHECK_MEMBERS([siginfo_t.si_fd],,,[#include <signal.h>]) AC_CHECK_MEMBERS([siginfo_t.si_fd],,,[#include <signal.h>])
AC_CHECK_MEMBERS([siginfo_t.si_band],,,[#include <signal.h>]) AC_CHECK_MEMBERS([siginfo_t.si_band],,,[#include <signal.h>])
# Portland PGI 6.2.x has a bug that it will choke when compiling .c
# files that have structs copied by value that contain bool members.
# PGI fixed this problem in the 7.0 series. This is a characteristic
# of the C compiler, but we can't do it until after we check for
# <stdbool.h>.
OMPI_CHECK_BOOL_STRUCT_COPY
# checkpoint results # checkpoint results
AC_CACHE_SAVE AC_CACHE_SAVE

Просмотреть файл

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -19,12 +19,19 @@
* Struct to hold the settable values that may be specified in the INI * Struct to hold the settable values that may be specified in the INI
* file * file
*/ */
/* PGI 6.2.x has a bug where it will fail to compile structs that are
copied by value that contain bool members. */
#if OMPI_BOOL_STRUCT_COPY
typedef bool boi_bool_t;
#else
typedef int boi_bool_t;
#endif
typedef struct ompi_btl_openib_ini_values_t { typedef struct ompi_btl_openib_ini_values_t {
uint32_t mtu; uint32_t mtu;
bool mtu_set; boi_bool_t mtu_set;
uint32_t use_eager_rdma; uint32_t use_eager_rdma;
bool use_eager_rdma_set; boi_bool_t use_eager_rdma_set;
} ompi_btl_openib_ini_values_t; } ompi_btl_openib_ini_values_t;

Просмотреть файл

@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -78,9 +79,16 @@ static int orte_clean_universe(orte_universe_t *universe);
/***************************************** /*****************************************
* Global Vars for Command line Arguments * Global Vars for Command line Arguments
*****************************************/ *****************************************/
/* PGI 6.2.x has a bug where it will fail to compile structs that are
copied by value that contain bool members. */
#if OMPI_BOOL_STRUCT_COPY
typedef bool oc_bool_t;
#else
typedef int oc_bool_t;
#endif
typedef struct { typedef struct {
bool help; oc_bool_t help;
bool verbose; oc_bool_t verbose;
} orte_clean_globals_t; } orte_clean_globals_t;
orte_clean_globals_t orte_clean_globals; orte_clean_globals_t orte_clean_globals;