[petsc-dev] Fwd: [petsc-maint #75297] Issue when saving an MPI dense matrix

Jed Brown jed at 59A2.org
Fri Jun 3 11:50:33 CDT 2011


On Fri, Jun 3, 2011 at 18:34, Barry Smith <bsmith at mcs.anl.gov> wrote:

> So it turns out that gcc has an option -Wconversion that warns one about
> ALL implicit conversions of sizes it does. This could be used to find all
> the places we pass PetscInt to MPI calls that require int but unfortunately
> it reports so much other stuff that it seems unusable. For example, see
> below.
>

I think this other stuff can be dealt with. I use -Wconversion in Dohp and
my builds are all clean [1]. It does report some things that really are not
errors (e.g. positive integer literal becomes size_t and then is put back in
int, but should be known at compile time to fit), but it has not been an
inordinate amount of work to keep the builds clean. In the output you
showed, it looks like most of the errors are coming through macros. The
macros can probably be modified to silence them.

Clang also has -Wconversion. You could try building with a recent clang to
see if it's as noisy.


[1] Except for a couple places where I use VALGRIND_MAKE_MEM_UNDEFINED()
which has a bad conversion buried deep inside it's macro bowels. I work
around this with the annotation

 PragmaGCC(diagnostic ignored "-Wconversion")

which expands in terms of _Pragma() on systems that support it. Old versions
of GCC don't support pragmas inside of function bodies, so they generate
warnings if -Wconversion is turned on. Everything else works fine.

This pragma solution to selectively disable -Wconversion works for both GCC
and Clang. It might also work for Intel and any other compilers that claim
to be gcc-compatible-ish. On other compilers, you don't have to worry about
-Wconversion because you just won't turn it on.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110603/c71e3835/attachment.html>


More information about the petsc-dev mailing list