Skip to content
  • Jed Brown's avatar
    Fix gcc-14 -Warray-bounds warnings for hypothetical negative sizes · a748edf9
    Jed Brown authored
    These warnings arise because we use (signed int32) PetscInt for sizes
    that must be nonnegative, then cast to size_t. This leads to warnings
    when the compiler doesn't know that the integers can't be negative.
    
    In function ‘PetscMemzero’,
        inlined from ‘TSARKIMEXRegister’ at /home/jed/petsc/src/ts/impls/arkimex/arkimex.c:1182:10:
    /home/jed/petsc/include/petscstring.h:758:3: warning: ‘memset’ pointer overflow between offset 0 and size [-17179869184, -8] [-Warray-bounds=]
      758 |   memset(a, 0, n);
          |   ^~~~~~~~~~~~~~~
    
    Compare commit 095c51fa from 2023:
      Fix gcc-13 -Warray-bounds warnings involving hypothetical negative sizes
    a748edf9
Loading