[petsc-dev] 32 bit compilers and PETSc

Satish Balay balay at mcs.anl.gov
Thu Mar 4 08:58:46 CST 2021


On Wed, 3 Mar 2021, Barry Smith wrote:

> 
>    I just wasted an enormous amount of time "debugging"my additions to BAIJ on the solaris test machines. Turns out there was no bug at all just that the compilers default to 32 bit and we have no possible way of detecting size_t overflow; so smallish test cases can become a debugging nightmare. 
> 
>    Can we make ./configure ban 32 bit compilers unless a special flag is used? And just have one CI test that uses 32 bit where we turn off examples that overflow 32 bits?

We could add another linux test where 32bit part is more obvious.

And we have "requires: defined(FLAG)" but not sure if we can check for "PETSC_SIZEOF_VOID_P 8" this way. Perhaps we can add to configure:

requires: defined(PETSC_USING_64BIT_PTR)
or
requires: !defined(PETSC_USING_32BIT_PTR)

Satish

---
diff --git a/config/BuildSystem/config/types.py b/config/BuildSystem/config/types.py
index 39eda33099..d35adae503 100644
--- a/config/BuildSystem/config/types.py
+++ b/config/BuildSystem/config/types.py
@@ -268,6 +268,8 @@ char petsc_max_path_len[] = xstr(PETSC_MAX_PATH_LEN);
                      'enum': (4, 8),
                      'size_t': (8, 4)}.items():
       self.executeTest(self.checkSizeof, args=[t, sizes])
+    if self.sizes['void-p'] == 8:
+      self.addDefine('USING_64BIT_PTR',1)
     self.executeTest(self.checkVisibility)
     self.executeTest(self.checkMaxPathLen)
     return


./configure CFLAGS=-m32 CXXFLAGS=-m32 FFLAGS=-m32 --with-mpi=0 && make && make check



More information about the petsc-dev mailing list