[llvm] r355590 - Fix & re-enable test that intermittently failed in debug mode.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 13:55:53 PDT 2019


On Thu, Mar 7, 2019 at 3:54 AM Michael Platings via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: michaelplatings
> Date: Thu Mar  7 03:55:26 2019
> New Revision: 355590
>
> URL: http://llvm.org/viewvc/llvm-project?rev=355590&view=rev
> Log:
> Fix & re-enable test that intermittently failed in debug mode.
>
> The Value class and derivates will have uninitialized member variables if
> not created via operator new.
>

Perhaps this ^ should be fixed instead?


>
> Modified:
>     llvm/trunk/unittests/IR/ConstantsTest.cpp
>
> Modified: llvm/trunk/unittests/IR/ConstantsTest.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/ConstantsTest.cpp?rev=355590&r1=355589&r2=355590&view=diff
>
> ==============================================================================
> --- llvm/trunk/unittests/IR/ConstantsTest.cpp (original)
> +++ llvm/trunk/unittests/IR/ConstantsTest.cpp Thu Mar  7 03:55:26 2019
> @@ -556,20 +556,21 @@ TEST(ConstantsTest, DontFoldFunctionPtrI
>    ASSERT_FALSE(foldFuncPtrAndConstToNull(Context, nullptr, 2, 4));
>  }
>
> -TEST(ConstantsTest, DISABLED_FoldGlobalVariablePtr) {
> +TEST(ConstantsTest, FoldGlobalVariablePtr) {
>    LLVMContext Context;
>
>
>    IntegerType *IntType(Type::getInt32Ty(Context));
>
> -  GlobalVariable Global(IntType, true, GlobalValue::ExternalLinkage);
> +  std::unique_ptr<GlobalVariable> Global(
> +      new GlobalVariable(IntType, true, GlobalValue::ExternalLinkage));
>
> -  Global.setAlignment(4);
> +  Global->setAlignment(4);
>
>    ConstantInt *TheConstant(ConstantInt::get(IntType, 2));
>
>    Constant *TheConstantExpr(
> -      ConstantExpr::getPtrToInt(&Global, IntType));
> +      ConstantExpr::getPtrToInt(Global.get(), IntType));
>
>    ASSERT_TRUE(ConstantExpr::get( \
>        Instruction::And, TheConstantExpr, TheConstant)->isNullValue());
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190311/c0de5ae2/attachment.html>


More information about the llvm-commits mailing list