-
Notifications
You must be signed in to change notification settings - Fork 165
[BUG] error: passing argument 4 of ‘SNESMonitorSet’ from incompatible pointer type #903
Copy link
Copy link
Open
Description
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:
Reactions are currently unavailable