r192570 - Fixed "ArgSize may be used uninitialised" error when compiling with gcc.

David Blaikie dblaikie at gmail.com
Mon Oct 14 09:16:08 PDT 2013


On Mon, Oct 14, 2013 at 12:02 AM, Andy Gibbs <andyg1001 at hotmail.co.uk>wrote:

> Author: andyg
> Date: Mon Oct 14 02:02:04 2013
> New Revision: 192570
>
> URL: http://llvm.org/viewvc/llvm-project?rev=192570&view=rev
> Log:
> Fixed "ArgSize may be used uninitialised" error when compiling with gcc.
>
> Modified:
>     cfe/trunk/lib/CodeGen/TargetInfo.cpp
>
> Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=192570&r1=192569&r2=192570&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon Oct 14 02:02:04 2013
> @@ -5444,7 +5444,7 @@ llvm::Value *XCoreABIInfo::EmitVAArg(llv
>      AI.setCoerceToType(ArgTy);
>    llvm::Type *ArgPtrTy = llvm::PointerType::getUnqual(ArgTy);
>    llvm::Value *Val;
> -  uint64_t ArgSize;
> +  uint64_t ArgSize = 0;
>

Generally I believe we would prefer to disable the warning than needlessly
initialize the variable (is this needless initialization? I haven't looked
at the rest of the code, but I assume it is). That way dynamic tools (MSan,
Valgrind, etc) can properly diagnose when the algorithm has bugs that fail
to initialize this variable.


>    switch (AI.getKind()) {
>    case ABIArgInfo::Expand:
>      llvm_unreachable("Unsupported ABI kind for va_arg");
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131014/c00ce07a/attachment.html>


More information about the cfe-commits mailing list