[petsc-users] Unconditional jump or move depends on uninitialised value(s)
Tu, Jiannan
Jiannan_Tu at uml.edu
Fri Jun 9 15:31:38 CDT 2023
Jacob,
Thank you very much. I did use -Wall compiler option. Nevertheless, declaring the variables in the smallest scope is a very good way to avoid uninitialized usage of the variables.
Jiannan
________________________________
From: Jacob Faibussowitsch <jacob.fai at gmail.com>
Sent: Friday, June 9, 2023 3:55 PM
To: Tu, Jiannan <Jiannan_Tu at uml.edu>
Cc: Barry Smith <bsmith at petsc.dev>; petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] Unconditional jump or move depends on uninitialised value(s)
You don't often get email from jacob.fai at gmail.com. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
CAUTION: This email was sent from outside the UMass Lowell network.
> I'll see what gcc complier options I should use to detect the use of declared variables that are not initialized
The flag you are looking for is -Wall. Please fix all the warnings that it may raise.
Generally speaking, it is also much easier to ensure your variables are initialized if you restrict them to the smallest scope possible. That is, declare the variable immediately before you use it. If you only use it within a loop, then only declare it inside that loop. If you only use it in an if branch, then only declare it inside that branch.
Best regards,
Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)
On May 10, 2023, at 12:38, Tu, Jiannan <Jiannan_Tu at uml.edu> wrote:
I'll see what gcc complier options I should use to detect the use of declared variables that are not initialized
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230609/99156ff2/attachment.html>
More information about the petsc-users
mailing list