Skip to content

Commit

Permalink
Type: handle typeof and attributed types in integerRank
Browse files Browse the repository at this point in the history
  • Loading branch information
ehaas authored and Vexu committed Mar 7, 2024
1 parent 02353ad commit dbcd2c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/aro/Type.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,10 @@ pub fn integerRank(ty: Type, comp: *const Compilation) usize {
.long_long, .ulong_long => 6 + (ty.bitSizeof(comp).? << 3),
.int128, .uint128 => 7 + (ty.bitSizeof(comp).? << 3),

.typeof_type => ty.data.sub_type.integerRank(comp),
.typeof_expr => ty.data.expr.ty.integerRank(comp),
.attributed => ty.data.attributed.base.integerRank(comp),

else => unreachable,
});
}
Expand Down
6 changes: 6 additions & 0 deletions test/cases/typeof pointer wrong size.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define NO_ERROR_VALIDATION

void foo(void) {
char arr[10];
typeof(const int) *p = arr;
}

0 comments on commit dbcd2c9

Please sign in to comment.