Skip to content

[BUG] error: passing argument 4 of ‘SNESMonitorSet’ from incompatible pointer type #903

@sagitter

Description

@sagitter

Current Behavior:

examples/cvode/petsc/cv_petsc_ex7.c is not compiled because of following error

/usr/lib64/openmpi/bin/mpicc  -I/builddir/build/BUILD/sundials-7.6.0-build/sundials-7.6.0/buildopenmpi_dir/include -I/builddir/build/BUILD/sundials-7.6.0-build/sundials-7.6.0/buildopenmpi_dir/build/include -I/builddir/build/BUILD/sundials-7.6.0-build/sundials-7.6.0/buildopenmpi_dir/src/sundials -I/builddir/build/BUILD/sundials-7.6.0-build/sundials-7.6.0/buildopenmpi_dir/build/src/sundials -isystem /usr/include/openmpi-x86_64/petsc -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/include/flexiblas -std=gnu99 -MD -MT examples/cvode/petsc/CMakeFiles/cv_petsc_ex7.dir/cv_petsc_ex7.c.o -MF examples/cvode/petsc/CMakeFiles/cv_petsc_ex7.dir/cv_petsc_ex7.c.o.d -o examples/cvode/petsc/CMakeFiles/cv_petsc_ex7.dir/cv_petsc_ex7.c.o -c /builddir/build/BUILD/sundials-7.6.0-build/sundials-7.6.0/buildopenmpi_dir/examples/cvode/petsc/cv_petsc_ex7.c
/builddir/build/BUILD/sundials-7.6.0-build/sundials-7.6.0/buildopenmpi_dir/examples/cvode/petsc/cv_petsc_ex7.c: In function ‘main’:
/builddir/build/BUILD/sundials-7.6.0-build/sundials-7.6.0/buildopenmpi_dir/examples/cvode/petsc/cv_petsc_ex7.c:157:25: error: passing argument 4 of ‘SNESMonitorSet’ from incompatible pointer type [-Wincompatible-pointer-types]
  157 |                         (PetscErrorCode(*)(void**))PetscViewerAndFormatDestroy);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                         |
      |                         PetscErrorCode (*)(void **) {aka int (*)(void **)}
In file included from /builddir/build/BUILD/sundials-7.6.0-build/sundials-7.6.0/buildopenmpi_dir/include/sunnonlinsol/sunnonlinsol_petscsnes.h:28,
                 from /builddir/build/BUILD/sundials-7.6.0-build/sundials-7.6.0/buildopenmpi_dir/examples/cvode/petsc/cv_petsc_ex7.c:38:
/usr/include/openmpi-x86_64/petsc/petscsnes.h:61:117: note: expected ‘PetscErrorCode (*)(void *)’ {aka ‘int (*)(void *)’} but argument is of type ‘PetscErrorCode (*)(void **)’ {aka ‘int (*)(void **)’}
   61 | PETSC_EXTERN PetscErrorCode SNESMonitorSet(SNES, PetscErrorCode (*)(SNES, PetscInt, PetscReal, PetscCtx), PetscCtx, PetscCtxDestroyFn *);
      |                                                                                                                     ^~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.

Environment:

  • SUNDIALS version: 7.6.0
  • OS: Fedora 45
  • Compiler: OpenMPI-5.0.10
  • petsc-9.25.0

Anything else:

Build log: https://download.copr.fedorainfracloud.org/results/sagitter/Petsc-3.25/fedora-rawhide-x86_64/10295289-sundials/builder-live.log.gz

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