You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
C migrator: enumeration constants typed c_uint (the enum's type) instead of int; pcre2's escapes table overflows #1774
C11 6.7.2.2p3: "The identifiers in an enumerator list are declared as constants that have type int."
The C migrator types every enumeration constant with the enum's integer type — pcre2's enum { ESC_A = 1, ESC_G, ... } becomes pub let ESC_A: c_uint = 1 (lib/std/re/defs.w; also ucp_*, PCRE2_MATCHEDBY_*, …). C's -ESC_A is int -1; the migrated (0 - ESC_A) is c_uint 0 - 1, a checked overflow (§4.2.3). lib/std/re/pcre2_compile.w's let escapes: [75]c_short = [..., (0 - ESC_A), ...] has 26 of them; the LLVM backend's constant folder wraps them silently (issue filed beside this one), and the C backend with #1484's startup initializers panics before main in every program that carries the prelude.
Expected: enumerators are c_int (the enum type itself may stay the implementation's integer type), and the corpora are re-migrated (std.re, and any other corpus whose enumerators feed arithmetic). Blocks #1484.
Activity
C migrator: an enumeration constant is `int` (C11 6.7.2.2p3), not the…
std.re: re-migrated with `int` enumerators, so pcre2's escapes table …
Sema records an arithmetic node's type; the LLVM constant folder fold…
emit-c: a global whose initializer is not a C constant runs before main
C migrator: an enumeration constant is `int` (C11 6.7.2.2p3), not the…
std.re: re-migrated with `int` enumerators, so pcre2's escapes table …
Sema records an arithmetic node's type; the LLVM constant folder fold…
emit-c: a global whose initializer is not a C constant runs before main
Sema/Codegen/migrator: unsuffixed literal arithmetic takes its contex…