<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 dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><blockquote type="cite" class=""><div dir="ltr" class="">It did seem to be non-deterministic. (how is that possible?).</div></blockquote><div class=""><br class=""></div>It can be a combination of the following:<div class=""><br class=""></div><div class="">1. U<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">ndefined behavior.</span></div><div class=""><font color="#000000" class=""><span style="caret-color: rgb(0, 0, 0);" class="">2. Dragons leaked from the undefined behavior.</span></font></div><div class="">3. In order to have 100% accuracy for detecting variable initializations the compiler must solve the halting problem, so compilers just silently give up after a certain point.</div><div class=""><br class=""></div><div class="">For an example of UB skipping those checks, suppose you have the following:</div><div class=""><br class=""></div><div class="">int func(int x)<br class=""><div class="">{</div><div class=""> int y;</div> If (x) return y;<br class=""> return 0;</div><div class="">}</div><div class=""><div class=""><br class=""></div><div class="">For reasonable optimization levels this function will __always__ return 0, see for yourself <a href="https://godbolt.org/z/z4bxTa43x" class="">https://godbolt.org/z/z4bxTa43x</a> this is done on the same compiler and relevant options as the CI job you had. And best part is, gcc never complains about uninitialized y!</div><div class=""><br class=""></div><div class="">Now if such a piece was thousands of lines deep, and obfuscated by many different optimization transformations (such as arbitrary branch predictions, etc), then the compiler may or may not get around to determining whether this value was initialized. </div><div class=""><br class=""><div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div>Best regards,<br class=""><br class="">Jacob Faibussowitsch<br class="">(Jacob Fai - booss - oh - vitch)<br class="">Cell: (312) 694-3391</div></div>
</div>
<div><br class=""><blockquote type="cite" class=""><div class="">On Apr 11, 2021, at 20:10, 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></div></div></body></html>