[cfe-commits] r146482 - /cfe/trunk/lib/AST/ASTContext.cpp

Peter Cooper peter_cooper at apple.com
Tue Dec 13 09:37:42 PST 2011


Hi Abramo

We're getting some buildbot failures on the gcc test suite since this change.  The test has a very large union in it which must be triggering your new assert.

Can you please have a look and see if your assert is correct on this test?

The test in question is gcc.c-torture/execute/991014-1.c

Thanks,
Pete

On Dec 13, 2011, at 3:23 AM, Abramo Bagnara wrote:

> Author: abramo
> Date: Tue Dec 13 05:23:52 2011
> New Revision: 146482
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=146482&view=rev
> Log:
> Added an assertion about overflow in sizeof evaluation. This does not solve the underlying structural issue that is waiting for a proper solution.
> 
> Modified:
>    cfe/trunk/lib/AST/ASTContext.cpp
> 
> Modified: cfe/trunk/lib/AST/ASTContext.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=146482&r1=146481&r2=146482&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTContext.cpp (original)
> +++ cfe/trunk/lib/AST/ASTContext.cpp Tue Dec 13 05:23:52 2011
> @@ -852,7 +852,9 @@
>     const ConstantArrayType *CAT = cast<ConstantArrayType>(T);
> 
>     std::pair<uint64_t, unsigned> EltInfo = getTypeInfo(CAT->getElementType());
> -    Width = EltInfo.first*CAT->getSize().getZExtValue();
> +    uint64_t Size = CAT->getSize().getZExtValue();
> +    assert((Size == 0 || EltInfo.first <= (uint64_t)(-1)/Size) && "Overflow in array type bit size evaluation");
> +    Width = EltInfo.first*Size;
>     Align = EltInfo.second;
>     Width = llvm::RoundUpToAlignment(Width, Align);
>     break;
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list