swift
b3d5d97b - [IRGen] Reject value types whose spare bit masks can't be represented (#93694)

Commit
8 days ago
[IRGen] Reject value types whose spare bit masks can't be represented (#93694) IRGen keeps a spare bit mask with one bit per bit of a fixed-layout value as a single APInt, whose width must fit in 32 bits. A value of 512 MiB or more got a truncated or overflowing mask, which could miscompile (an enum with a 512 MiB payload got 1-byte storage) or crash the compiler. Diagnose fixed- size arrays, structs, tuples and enums whose masks would not fit. Boxes and closure contexts are heap allocated and never use their masks, so they skip them instead. This rejects only types whose spare bit masks were overflowing or truncated. This leaves options open to support value types of 512 MiB or more in the future, for example with wider spare bit masks. rdar://185661661
Author
Parents
Loading