<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div> With PETSc, since we don't like having any warning messages while compiling for users (how can they know if the warning is meaningful or not), we try to initialize anything that any compiler at any optimization level complains about. So lots of initializations are not technically needed but are good for PR.<div class=""><br class=""></div><div class=""> Mark's case is kind of annoying because the size of the array is configure dependent and so initializing "all entries" depends on the size of the array which for other people may be different. This is why it would be nice (I don't know if possible) to have a standard C99 way of initializing arrays.</div><div class=""><br class=""></div><div class=""> My rule is, if it every complains (wrongly) about initialized values then initialize them.</div><div class=""><br class=""></div><div class=""> Barry</div><div class=""><br class=""></div><div class=""> <br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Apr 11, 2021, at 8:10 PM, Mark Adams <<a href="mailto:mfadams@lbl.gov" class="">mfadams@lbl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">It did seem to be non-deterministic. (how is that possible?).<div class="">I got this error, sent my message.</div><div class="">Tried Barry's idea and initialized them all (5) by hand.</div><div class="">It worked!</div><div class="">I tried initializing just one.</div><div class="">It worked.</div><div class="">I tried initializing none (yes, back to where I started)</div><div class="">And it worked :o</div><div class=""><br class=""></div><div class="">I guess this error is another try-it-again CI error.</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 11, 2021 at 8:06 PM <<a href="mailto:jacob.fai@gmail.com" class="">jacob.fai@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US" style="overflow-wrap: break-word;" class=""><div class="gmail-m_-3389592443684829519WordSection1"><p class="MsoNormal">I ran into a similar problem months ago and the long and short of it is that any compilers uninitialized variable detection is incredibly dependent on optimization level, which the higher you go becomes non-deterministic.<u class=""></u><u class=""></u></p><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p><p class="MsoNormal">That being said, gcc is pretty terrible at getting this particular warning right :) <a href="https://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=may%20be%20uninitialized" target="_blank" class="">https://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=may%20be%20uninitialized</a><u class=""></u><u class=""></u></p><p class="MsoNormal"><u class=""></u> <u class=""></u></p><p class="MsoNormal">Best regards,<u class=""></u><u class=""></u></p><p class="MsoNormal"><u class=""></u> <u class=""></u></p><p class="MsoNormal">Jacob Faibussowitsch<u class=""></u><u class=""></u></p><p class="MsoNormal">(Jacob Fai - booss - oh - vitch)<u class=""></u><u class=""></u></p><p class="MsoNormal">Cell: (312) 694-3391<span style="" class=""><u class=""></u><u class=""></u></span></p></div><p class="MsoNormal"><u class=""></u> <u class=""></u></p><div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt" class=""><div class=""><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in" class=""><p class="MsoNormal"><b class="">From:</b> petsc-dev <<a href="mailto:petsc-dev-bounces@mcs.anl.gov" target="_blank" class="">petsc-dev-bounces@mcs.anl.gov</a>> <b class="">On Behalf Of </b>Barry Smith<br class=""><b class="">Sent:</b> Sunday, April 11, 2021 17:51<br class=""><b class="">To:</b> Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank" class="">mfadams@lbl.gov</a>><br class=""><b class="">Cc:</b> For users of the development version of PETSc <<a href="mailto:petsc-dev@mcs.anl.gov" target="_blank" class="">petsc-dev@mcs.anl.gov</a>><br class=""><b class="">Subject:</b> Re: [petsc-dev] CI error<u class=""></u><u class=""></u></p></div></div><p class="MsoNormal"><u class=""></u> <u class=""></u></p><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><p class="MsoNormal"> You might be able to do:<u class=""></u><u class=""></u></p><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><blockquote style="margin-top:5pt;margin-bottom:5pt" class=""><div class=""><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in" class=""><div class=""><div class=""><div class=""><p class="MsoNormal" style="background:rgb(17,17,17)"><span style="font-size:10pt;font-family:Menlo,serif;color:white" class="">col_scale[LANDAU_MAX_Q_FACE = {0};<u class=""></u><u class=""></u></span></p></div></div></div></blockquote></div></blockquote><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><p class="MsoNormal">but then the compiler may complain about not initializing enough values. Googling this type of initialization might help, something C initialize arrays "<span style="font-size:10pt;font-family:Menlo,serif;color:white;background:rgb(17,17,17)" class="">may be used uninitialized"</span><u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><span style="font-size:10pt;font-family:Menlo,serif;color:white;background:rgb(17,17,17)" class=""><br class=""><br class=""></span><u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><span style="font-size:10pt;font-family:Menlo,serif;color:white;background:rgb(17,17,17)" class=""><br class=""><br class=""></span><u class=""></u><u class=""></u></p><div class=""><p class="MsoNormal"><br class=""><br class=""><u class=""></u><u class=""></u></p><blockquote style="margin-top:5pt;margin-bottom:5pt" class=""><div class=""><p class="MsoNormal">On Apr 11, 2021, at 2:05 PM, Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank" class="">mfadams@lbl.gov</a>> wrote:<u class=""></u><u class=""></u></p></div><p class="MsoNormal"><u class=""></u> <u class=""></u></p><div class=""><div class=""><p class="MsoNormal">This warning went away. i don't know why.<u class=""></u><u class=""></u></p></div><p class="MsoNormal"><u class=""></u> <u class=""></u></p><div class=""><div class=""><p class="MsoNormal">On Sun, Apr 11, 2021 at 2:10 PM Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank" class="">mfadams@lbl.gov</a>> wrote:<u class=""></u><u class=""></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in" class=""><div class=""><p class="MsoNormal">I get this error in CI with complex float: <a href="https://gitlab.com/petsc/petsc/-/jobs/1170144554" target="_blank" class="">https://gitlab.com/petsc/petsc/-/jobs/1170144554</a><u class=""></u><u class=""></u></p><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal">I put in code earlier to fix this warning about uninitialized vars, but now it does not seem to work:<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><div class=""><p class="MsoNormal" style="background:rgb(17,17,17)"><span style="font-size:10pt;font-family:Menlo,serif;color:white" class="">/home/glci/builds-stage1/AbTGp5-t/0/petsc/petsc/src/ts/utils/dmplexlandau/plexland.c:414:94: error: ‘col_scale[4]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]<u class=""></u><u class=""></u></span></p></div><div class=""><p class="MsoNormal" style="background:rgb(17,17,17)"><span style="font-size:10pt;font-family:Menlo,serif;color:white" class=""><a href="https://gitlab.com/petsc/petsc/-/jobs/1170144554#L2251" target="_blank" class=""><span style="color:rgb(102,102,102)" class="">2251</span></a> PetscScalar vals[LANDAU_MAX_Q_FACE*LANDAU_MAX_Q_FACE],row_scale[LANDAU_MAX_Q_FACE],col_scale[LANDAU_MAX_Q_FACE];<u class=""></u><u class=""></u></span></p></div></div><p class="MsoNormal"><br class="">Yet I have code to initialize col_scale:<u class=""></u><u class=""></u></p><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal"> for (q = 0; q < LANDAU_MAX_Q_FACE; q++) col_scale[q] = 0.0; // suppress warnings<u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal">I get a similar error with an integer array. <u class=""></u><u class=""></u></p></div><div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div><div class=""><p class="MsoNormal">Any suggestions?<u class=""></u><u class=""></u></p></div></div></blockquote></div></div></blockquote></div><p class="MsoNormal"><u class=""></u> <u class=""></u></p></div></div></div></div></blockquote></div>
</div></blockquote></div><br class=""></div></body></html>