diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-02-15 02:44:58 +0100 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-02-22 04:12:46 +0100 |
| commit | fc7a0c4878dac2d721ec18cafe1b6bcff7faa771 (patch) | |
| tree | 5b9e4ef2d18e3daaf4bee34ae1bfe5af97916e8a /src/Type.zig | |
| parent | d31bda13cb1ece7dd2ba22339172a8704a84823c (diff) | |
| download | zig-fc7a0c4878dac2d721ec18cafe1b6bcff7faa771.tar.gz zig-fc7a0c4878dac2d721ec18cafe1b6bcff7faa771.zip | |
Sema: Fix fnptr alignment safety checks to account for potential ISA tag.
As seen on e.g. Arm/Thumb and MIPS (MIPS16/microMIPS).
Fixes #22888.
Diffstat (limited to 'src/Type.zig')
| -rw-r--r-- | src/Type.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Type.zig b/src/Type.zig index 7ddd43b034..883c752ef1 100644 --- a/src/Type.zig +++ b/src/Type.zig @@ -2541,6 +2541,13 @@ pub fn fnIsVarArgs(ty: Type, zcu: *const Zcu) bool { return zcu.intern_pool.indexToKey(ty.toIntern()).func_type.is_var_args; } +pub fn fnPtrMaskOrNull(ty: Type, zcu: *const Zcu) ?u64 { + return switch (ty.zigTypeTag(zcu)) { + .@"fn" => target_util.functionPointerMask(zcu.getTarget()), + else => null, + }; +} + pub fn isNumeric(ty: Type, zcu: *const Zcu) bool { return switch (ty.toIntern()) { .f16_type, |
