Skip to content

Commit ae68f6c

Browse files
committed
feat: refine transparent alignment handling
1 parent 084f880 commit ae68f6c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

kmir/src/kmir/kdist/mir-semantics/rt/numbers.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ This truncation function is instrumental in the implementation of Integer arithm
148148

149149
```k
150150
// FIXME: Alignment is platform specific
151+
// TODO: Extend #alignOf to be total by handling aggregate layouts (structs, arrays, unions).
151152
syntax Int ::= #alignOf( TypeInfo ) [function]
152153
rule #alignOf( typeInfoPrimitiveType(primTypeBool) ) => 1
153154
rule #alignOf( typeInfoPrimitiveType(primTypeChar) ) => 4
@@ -167,6 +168,16 @@ rule #alignOf( typeInfoPrimitiveType(primTypeFloat(floatTyF16)) ) => 2
167168
rule #alignOf( typeInfoPrimitiveType(primTypeFloat(floatTyF32)) ) => 4
168169
rule #alignOf( typeInfoPrimitiveType(primTypeFloat(floatTyF64)) ) => 8
169170
rule #alignOf( typeInfoPrimitiveType(primTypeFloat(floatTyF128)) ) => 16
171+
172+
rule #alignOf(
173+
typeInfoStructType(
174+
_,
175+
_,
176+
_,
177+
someLayoutShape(layoutShape(_, _, _, align(ALIGN), _))
178+
)
179+
)
180+
=> ALIGN
170181
```
171182

172183
```k

kmir/src/tests/integration/test_integration.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
'offset-u8-fail',
5050
'pointer-cast-length-test-fail',
5151
'pointer-cast-struct-field-fail',
52-
'pointer-cast-transparent-wrapper',
5352
'niche-enum',
5453
'assume-cheatcode-conflict-fail',
5554
]

0 commit comments

Comments
 (0)