On Mon, Oct 14, 2013 at 12:02 AM, Andy Gibbs <[email protected]>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
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to