[Trilinos-Users] Some Trilinos compilation warnings
Devine, Karen D
kddevin at sandia.gov
Tue Aug 28 15:25:37 MDT 2012
Andrey: Thanks for sharing this output. See comments on Zoltan issues
below. --Karen
On 8/25/12 12:11 AM, "Andrey Prokopenko" <prok at math.uh.edu> wrote:
>Hi everyone,
>
>Late at night, nitpicking at Trilinos, i.e. some compilation warnings
>that could be potential bugs. Maybe, it is a good idea to include
>"-Wall -Wextra" to CXX_FLAGS.
>
>
>(1) trilinos/packages/zoltan/src/hier/hier.c:1780:43: warning: array
>subscript is above array bounds [-Warray-bounds]
>
>seems like an obvious misprint
>
>- for (i=1; i <= ZOLTAN_HIER_LAST_PLATFORM; i++){
>+ for (i=0; i < ZOLTAN_HIER_LAST_PLATFORM; i++) {
Yes, this is a bug. I will push a fixed to the development branch.
>(2) trilinos/packages/zoltan/src/rcb/shared.c:2121:7: warning:
>Œcurrent_candidate¹ may be used uninitialized in this function
>[-Wuninitialized]
>
>the code in question does have potentially uninitalized pointer which
>is then dereferenced
>
>ZOLTAN_ID_PTR current candidate;
>[...]
>if (dindx) {
> int prevpart = -1;
> /* there is more than one part on this proc. */
> /* use dindx to access dots grouped by part */
> for (i = 0; i < dotnum; i++) {
> if (dotpt->Part[dindx[i]] != prevpart) {
> /* Assuming dots are grouped according to part number. */
> /* Then candidate is first dot in new part */
> current_candidate = &(gidpt[dindx[i]*num_gid_entries]);
> prevpart = dotpt->Part[dindx[i]];
> }
> ZOLTAN_SET_GID(zz, &(dot_candidates[dindx[i]*num_gid_entries]),
>current_candidate);
> }
>}
Reviewing the code and knowing the data values, I know that
current_candidate will not be used uninitialized. The compiler can't know
that, though, and we dislike warnings, so I will fix this issue as well.
More information about the Trilinos-Users
mailing list