From 69dd10144fc723d8006f2e563fc3edd82ee4b368 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Fri, 17 Jul 2026 11:33:42 -0400 Subject: [PATCH] Type: make `f80` not extern compatible on targets lacking such a type Closes #35802 --- src/Sema.zig | 2 +- src/Type.zig | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Sema.zig b/src/Sema.zig index 129b9104d385499e8443b4fc45dcf6c2e26497e8..bb2cd4eff32547c659ec0e7f14fddf3cc4b07d18 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -25675,7 +25675,6 @@ pub fn explainWhyTypeIsNotExtern( .@"opaque", .bool, - .float, .@"anyframe", => unreachable, // these *are* allowed @@ -25684,6 +25683,7 @@ pub fn explainWhyTypeIsNotExtern( try sema.errNote(src_loc, msg, "SPIR-V runtime arrays must be the last field of an extern struct", .{}); }, + .float => try sema.errNote(src_loc, msg, "'{f}' is not extern compatible on this target", .{ty.fmt(pt)}), .pointer => if (ty.isSlice(zcu)) { try sema.errNote(src_loc, msg, "slices have no guaranteed in-memory representation", .{}); } else { diff --git a/src/Type.zig b/src/Type.zig index 32e49a05c26a8ee5459164c02f987c92704f0f65..56b2388710b2b919a2a429fd3afa0dfa515bcf66 100644 --- a/src/Type.zig +++ b/src/Type.zig @@ -3122,7 +3122,6 @@ pub fn validateExtern(ty: Type, position: ExternPosition, zcu: *const Zcu) bool .@"opaque", .bool, - .float, .@"anyframe", => true, @@ -3144,6 +3143,10 @@ pub fn validateExtern(ty: Type, position: ExternPosition, zcu: *const Zcu) bool 24, 48 => zcu.getTarget().cpu.arch == .ez80, else => false, }, + .float => switch (ty.floatBits(zcu.getTarget())) { + else => true, + 80 => zcu.getTarget().cTypeBitSize(.longdouble) == 80, + }, .@"fn" => { if (position != .other) return false; return validateExternCallconv(ty.fnCallingConvention(zcu)); -- 2.54.0