[llvm] r198131 - Uninitialized variable (in never taken path) after factoring.
dblaikie at gmail.com
dblaikie at gmail.com
Mon Jan 6 13:06:05 PST 2014
On Mon Jan 06 2014 at 12:59:40 PM, Andrew Trick <atrick at apple.com> wrote:
>
> On Jan 6, 2014, at 12:31 PM, "dblaikie at gmail.com" <dblaikie at gmail.com>
> wrote:
>
>
>
> On Sat Dec 28 2013 at 2:32:19 PM, Andrew Trick <atrick at apple.com> wrote:
>
> Author: atrick
> Date: Sat Dec 28 16:25:57 2013
> New Revision: 198131
>
> URL: http://llvm.org/viewvc/llvm-project?rev=198131&view=rev
> Log:
> Uninitialized variable (in never taken path) after factoring.
>
>
> Generally we prefer not to initialize variables just to satisfy bad
> compiler warnings. Chandler especially has voiced strong opinions (that I
> tend to agree with) that initializing variables to satisfy compiler
> warnings when the code has a known invariant that makes the initialization
> unnecessary is counterproductive as it thwarts dynamic checkers like
> MSan/Valgrind/etc.
>
>
> Got it. In this case the warning is legit. The path was only never taken
> by chance because we weren't testing with a flag enabled. I've since added
> a test.
>
Ah, great!
>
> Andy
>
>
> Modified:
> llvm/trunk/lib/CodeGen/MachineScheduler.cpp
>
> Modified: llvm/trunk/lib/CodeGen/MachineScheduler.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> CodeGen/MachineScheduler.cpp?rev=198131&r1=198130&r2=198131&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/CodeGen/MachineScheduler.cpp (original)
> +++ llvm/trunk/lib/CodeGen/MachineScheduler.cpp Sat Dec 28 16:25:57 2013
> @@ -2248,7 +2248,7 @@ void GenericSchedulerBase::setPolicy(Can
> CurrZone.findMaxLatency(
> CurrZone.Pending.elements()));
>
> // Compute the critical resource outside the zone.
> - unsigned OtherCritIdx;
> + unsigned OtherCritIdx = 0;
> unsigned OtherCount =
> OtherZone ? OtherZone->getOtherResourceCount(OtherCritIdx) : 0;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140106/e246413b/attachment.html>
More information about the llvm-commits
mailing list