From: Benjamin Kramer Date: Wed, 3 Oct 2012 14:15:39 +0000 (+0000) Subject: CodeGen: Fix a silly typo when emitting subs of block addresses. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=daa0961244fd077d136d5c52b66f5d5e42bbe609;p=platform%2Fupstream%2Fllvm.git CodeGen: Fix a silly typo when emitting subs of block addresses. Part of PR14005. llvm-svn: 165117 --- diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 05912fc..e21c83b 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -4919,7 +4919,7 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) { if (!LHSValue.Offset.isZero() || !RHSValue.Offset.isZero()) return false; const Expr *LHSExpr = LHSValue.Base.dyn_cast(); - const Expr *RHSExpr = LHSValue.Base.dyn_cast(); + const Expr *RHSExpr = RHSValue.Base.dyn_cast(); if (!LHSExpr || !RHSExpr) return false; const AddrLabelExpr *LHSAddrExpr = dyn_cast(LHSExpr); diff --git a/clang/test/CodeGen/const-label-addr.c b/clang/test/CodeGen/const-label-addr.c index 9d99f88..e2fe387 100644 --- a/clang/test/CodeGen/const-label-addr.c +++ b/clang/test/CodeGen/const-label-addr.c @@ -1,4 +1,16 @@ -// RUN: %clang_cc1 %s -emit-llvm -o %t +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +// CHECK: @a.a = internal global i8* blockaddress(@a, %A) int a() { A:;static void* a = &&A; } + +// PR14005 +// CHECK: @b.ar = internal global {{.*}} sub (i{{..}} ptrtoint (i8* blockaddress(@b, %l2) to i{{..}}), i{{..}} ptrtoint (i8* blockaddress(@b, %l1) to i{{..}})) +int b() { + static int ar = &&l2 - &&l1; +l1: + return 10; +l2: + return 11; +}