jhammond / xltop

continuous Lustre load monitor
GNU General Public License v2.0
21 stars 7 forks source link

GCC throws an error for an 'uninitialized' value #2

Closed mtds closed 8 years ago

mtds commented 8 years ago

Hello.

As stated in the subject, I am facing a problem while compiling xltop from the sources. I stumbled upon the following error after using make:

clus.c: In function "domains_get_cb":
clus.c:34:36: error: "c" may be used uninitialized in this function [-Werror=maybe-uninitialized]

I can probably force the compiler to use '-Wno-uninitialized' but I don't think it's a good idea.

Is there anything else (apart from relaxing the compiler warnings) that I can try to fix this error? Should the configure options '--with-clus' or '--with-domain' help in this case? From the README is not clear to me if these options have to be used.

My platform details:

Debian Wheezy (7.9) x86_64 gcc 4.7.2

Thanks in advance!

Best regards, Matteo

mtds commented 8 years ago

Actually the fix should be pretty easy, I just initialized the 'c' pointer to the struct 'clus_node' in the 'domains_get_cb' function in clus.c:

struct clus_node *c = NULL;

I cannot say yet if this will affect xltop but at least now the compiler is able to make the executables (without warnings/errors).

jhammond commented 8 years ago

Initializing c to NULL is fine. Would you like to submit a PR?

mtds commented 8 years ago

Sure! I have just submitted it.

jhammond commented 8 years ago

Merged. Thanks!