[petsc-dev] crap in next in dm.c

Satish Balay balay at mcs.anl.gov
Mon Feb 16 15:46:41 CST 2015


On Mon, 16 Feb 2015, Jed Brown wrote:

> Matthew Knepley <knepley at gmail.com> writes:
> 
> > On Mon, Feb 16, 2015 at 3:13 PM, Satish Balay <balay at mcs.anl.gov> wrote:
> >
> >> Matt,
> >>
> >> There are some clang stuff here..
> >>
> >>
> >> ftp://ftp.mcs.anl.gov/pub/petsc/nightlylogs/archive/2015/02/16/filtered-make_next_arch-linux-pkgs-dbg-ftn-interfaces_crank.log
> >
> >
> > That is not my fault. Jed needs to disable to test.
> 
> Just now back from Singapore...
> 
> This is tremendously frustrating because the warnings are useful (have
> detected and continue to detect true bugs, especially with 64-bit
> indices), but the crappy dependence on const needs to be fixed in Clang.

The following worarround compiles without warnings.

Satish

diff --git a/src/dm/interface/dm.c b/src/dm/interface/dm.c
index 5bfb42c..7c2985e 100644
--- a/src/dm/interface/dm.c
+++ b/src/dm/interface/dm.c
@@ -1689,7 +1689,7 @@ PetscErrorCode  DMGlobalToLocalBegin(DM dm,Vec g,InsertMode mode,Vec l)
     if (mode == ADD_VALUES) SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Invalid insertion mode %D", mode);
     ierr = VecGetArray(l, &lArray);CHKERRQ(ierr);
     ierr = VecGetArrayRead(g, &gArray);CHKERRQ(ierr);
-    ierr = PetscSFBcastBegin(sf, MPIU_SCALAR, gArray, lArray);CHKERRQ(ierr);
+    ierr = PetscSFBcastBegin(sf, MPIU_SCALAR, (PetscScalar*) gArray, lArray);CHKERRQ(ierr);
     ierr = VecRestoreArray(l, &lArray);CHKERRQ(ierr);
     ierr = VecRestoreArrayRead(g, &gArray);CHKERRQ(ierr);
   } else {
@@ -1733,7 +1733,7 @@ PetscErrorCode  DMGlobalToLocalEnd(DM dm,Vec g,InsertMode mode,Vec l)
 
     ierr = VecGetArray(l, &lArray);CHKERRQ(ierr);
     ierr = VecGetArrayRead(g, &gArray);CHKERRQ(ierr);
-    ierr = PetscSFBcastEnd(sf, MPIU_SCALAR, gArray, lArray);CHKERRQ(ierr);
+    ierr = PetscSFBcastEnd(sf, MPIU_SCALAR, (PetscScalar*) gArray, lArray);CHKERRQ(ierr);
     ierr = VecRestoreArray(l, &lArray);CHKERRQ(ierr);
     ierr = VecRestoreArrayRead(g, &gArray);CHKERRQ(ierr);
   } else {
@@ -1890,7 +1890,7 @@ PetscErrorCode  DMLocalToGlobalBegin(DM dm,Vec l,InsertMode mode,Vec g)
   if (sf && !isInsert) {
     ierr = VecGetArrayRead(l, &lArray);CHKERRQ(ierr);
     ierr = VecGetArray(g, &gArray);CHKERRQ(ierr);
-    ierr = PetscSFReduceBegin(sf, MPIU_SCALAR, lArray, gArray, MPI_SUM);CHKERRQ(ierr);
+    ierr = PetscSFReduceBegin(sf, MPIU_SCALAR, (PetscScalar*)lArray, gArray, MPI_SUM);CHKERRQ(ierr);
     ierr = VecRestoreArrayRead(l, &lArray);CHKERRQ(ierr);
     ierr = VecRestoreArray(g, &gArray);CHKERRQ(ierr);
   } else if (s && isInsert) {
@@ -1983,7 +1983,7 @@ PetscErrorCode  DMLocalToGlobalEnd(DM dm,Vec l,InsertMode mode,Vec g)
 
     ierr = VecGetArrayRead(l, &lArray);CHKERRQ(ierr);
     ierr = VecGetArray(g, &gArray);CHKERRQ(ierr);
-    ierr = PetscSFReduceEnd(sf, MPIU_SCALAR, lArray, gArray, MPI_SUM);CHKERRQ(ierr);
+    ierr = PetscSFReduceEnd(sf, MPIU_SCALAR, (PetscScalar*)lArray, gArray, MPI_SUM);CHKERRQ(ierr);
     ierr = VecRestoreArrayRead(l, &lArray);CHKERRQ(ierr);
     ierr = VecRestoreArray(g, &gArray);CHKERRQ(ierr);
   } else if (s && isInsert) {

> 




More information about the petsc-dev mailing list