[llvm-commits] [llvm-gcc-4.2] r85303 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Jim Grosbach grosbach at apple.com
Wed Oct 28 09:15:41 PDT 2009


Hi Dale,

I'm seeing the following when building Apple-style:
cc1plus: warnings being treated as errors
/Volumes/Home/grosbaj/nightly-llvm/build/llvmgcc.roots/llvmgcc~obj/src/ 
gcc/llvm-convert.cpp: In static member function 'static  
llvm::Constant* TreeConstantToLLVM::ConvertRecordCONSTRUCTOR 
(tree_node*)':/Volumes/Home/grosbaj/nightly-llvm/build/llvmgcc.roots/ 
llvmgcc~obj/src/gcc/llvm-convert.cpp:7777: warning: 'FieldSizeInBits'  
may be used uninitialized in this function

It seems that might be the case in the conditional starting on 7800.  
That's just a quick look at the code, though, so very possible I'm  
missing something.

The warning is causing the nightly tester llvm-gcc builds to fail  
since we're building llvm-gcc with -Werror, so it'd be nice to get  
that fixed anyway.

-Jim

On Oct 27, 2009, at 1:56 PM, Dale Johannesen wrote:

> Author: johannes
> Date: Tue Oct 27 15:56:49 2009
> New Revision: 85303
>
> URL: http://llvm.org/viewvc/llvm-project?rev=85303&view=rev
> Log:
> Make previous change not crash when size of object is unknown.
>
>
> Modified:
>    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
>
> Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=85303&r1=85302&r2=85303&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
> +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Oct 27 15:56:49 2009
> @@ -7774,10 +7774,12 @@
>     uint64_t GCCFieldOffsetInBits = getFieldOffsetInBits(Field);
>     NextField = TREE_CHAIN(Field);
>
> -    uint64_t FieldSizeInBits = getInt64(DECL_SIZE(Field), true);
> +    uint64_t FieldSizeInBits;
> +    if (DECL_SIZE(Field))
> +      FieldSizeInBits = getInt64(DECL_SIZE(Field), true);
>     uint64_t ValueSizeInBits = Val->getType()->getPrimitiveSizeInBits 
> ();
>     ConstantInt *ValC = dyn_cast<ConstantInt>(Val);
> -    if (ValC && ValC->isZero()) {
> +    if (ValC && ValC->isZero() && DECL_SIZE(Field)) {
>       // G++ has various bugs handling {} initializers where it  
> doesn't
>       // synthesize a zero node of the right type.  Instead of  
> figuring out G++,
>       // just hack around it by special casing zero and allowing it  
> to be the
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list