Skip to content

Commit 938de3d

Browse files
committed
[clang] use ArrayTypeTraitExpr::getType as value type
Fixed: #113044
1 parent ec08c11 commit 938de3d

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ Bug Fixes in This Version
374374
- Fixed a crash when trying to transform a dependent address space type. Fixes #GH101685.
375375
- Fixed a crash when diagnosing format strings and encountering an empty
376376
delimited escape sequence (e.g., ``"\o{}"``). #GH102218
377+
- Fixed a crash when the result of ``__array_rank`` is used as operand for bit operation. (#GH113044).
377378

378379
Bug Fixes to Compiler Builtins
379380
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ class ScalarExprEmitter
718718
}
719719

720720
Value *VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *E) {
721-
return llvm::ConstantInt::get(Builder.getInt32Ty(), E->getValue());
721+
return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());
722722
}
723723

724724
Value *VisitExpressionTraitExpr(const ExpressionTraitExpr *E) {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %clang_cc1 -triple aarch64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2+
3+
unsigned long array_rank_binary_operator(void) {
4+
// CHECK: ret i64 3
5+
return __array_rank(int[10]) | 2;
6+
}

0 commit comments

Comments
 (0)