P3596R0 — Undefined Behavior and IFNDR Annexes
(18 items)
CWG
This paper provides wording to add two new informative annexes to the C++ Standard: one cataloging all instances of core undefined behavior (Annex E) and one cataloging all instances of ill-formed, no diagnostic required (IFNDR) behavior (Annex F). Each entry includes a title, a cross-reference to the normative text, a summary, and a code example. The annexes also introduce stable identifiers for each kind of undefined or IFNDR behavior to serve as common vocabulary for future mitigation efforts.
- Section (D+a).2.1 [ub.intro.object], paragraph 4, page 54 — Function declaration *make_y() is missing its return type; should be Y* make_y() since the function returns a Y*. [4] [1]
- Section (D+b).6.6.3 [ifndr.dcl.attr.noreturn], paragraph 2, page 91 — TU#1 declares void f() (zero parameters) while TU#2 declares void f(int i) (one parameter); these are different functions, so the example does not demonstrate the IFNDR condition (same function declared with and without [[noreturn]] across TUs). TU#2 should declare void f(). [2]
- Section (D+a).4.2 [ub.return.coroutine], paragraph 2, page 74 — Example mixes std::coroutine_handle (in resumable) with std::experimental::coroutine_handle and std::experimental::suspend_always (in promise_type); these are from different headers and namespaces and the code does not compile as written. [8] [3]
- Section (D+a).3.2 [ub.basic.lval], paragraph 1, page 63 — Cross-reference [conv.rval] does not exist as a stable name; the correct reference for the similar relation is [conv.qual], consistent with the paper's own normative wording on page 22. [5] [4]
- Section (D+a).3.18 [ub.expr.add], paragraph 5, page 72 — Same erroneous cross-reference [conv.rval]; should be [conv.qual], consistent with the paper's own normative text on page 31. [5]
- Section 7.6.1.9 [expr.static.cast], paragraph 11, page 27 — Stable name contains orignal (misspelling of original): [expr.static.cast.does.not.contain.orignal.member]. [7] [6]
- Section (D+b).3.1 [ifndr.basic.link], paragraph 2, page 85 — Code example uses moodule (not a C++ keyword); should be module. As written the example does not declare a module interface unit. [7]
- Sections (D+b).6.1.1, (D+b).6.1.2, (D+b).6.2.1, (D+b).6.3.1, (D+b).6.4.1, (D+b).6.5, (D+b).6.6.2, (D+b).7.2, (D+b).10.8.1, (D+b).10.8.2.2, (D+b).10.8.4, pages 89-99 — At least 12 IFNDR annex sections contain empty examples ([Example: immediately followed by end example]) with unresolved TODO notes. [8]
- Section (D+a).2.12 [ub.basic.start.term], paragraph 4, page 62 — UB annex entry for signal handler UB contains an empty example with no code content. [9]
- Section 1, page 2 — Subject-verb disagreement: Calls ... was made should be Calls ... were made. [10]
- Section (D+a).2.7, page 59 — implemention-defined is misspelled; should be implementation-defined. [11]
- Section (D+b).6.6.3 [ifndr.dcl.attr.noreturn], paragraph 1, page 91 — requried is misspelled; should be required. [12]
- Section (D+a).3.6 [ub.conv.fpint], paragraph 4, page 65 — represetable is misspelled; should be representable. [6] [13]
- Section (D+b).11.2 [ifndr.cpp.include], paragraph 2, page 100 — diagnoatic in code comment is misspelled; should be diagnostic. [14]
- Section 1, page 2 — atempted is misspelled; should be attempted. [1] [15]
- Section 2, page 3 — lke in editorial note is misspelled; should be like. [2] [16]
- Section 2, page 3 — margines is misspelled; should be margins. [3] [17]
References — Anthropic Citations API
[1]
"We have atempted to follow some basic guidance on what is and is not appropriate to include in this annex: • In general the annex examples must be correct and provide an example of the specific..."
"We have atempted to follow some basic guidance on what is and is not appropriate to include in this annex: • In general the annex examples must be correct and provide an example of the specific..."
[1]
"We have atempted to follow some basic guidance on what is and is not appropriate to include in this annex: • In general the annex examples must be correct and provide an example of the specific..."
"We have atempted to follow some basic guidance on what is and is not appropriate to include in this annex: • In general the annex examples must be correct and provide an example of the specific..."
[2]
"JMB: Such comments will appear in the text in a box lke this one, and must be resolved prior to the completion of wording review. "
"JMB: Such comments will appear in the text in a box lke this one, and must be resolved prior to the completion of wording review. "
[3]
"In the final rendered standard these will be annexes E and F. Annexes that come after will then have their values increased, and so the current Annex E (Conformance with UAX #31) will become..."
"In the final rendered standard these will be annexes E and F. Annexes that come after will then have their values increased, and so the current Annex E (Conformance with UAX #31) will become..."
[4]
"Calls to formalize this data into an annex within the C++ Standard itself was made in [P2234R0]"
"Calls to formalize this data into an annex within the C++ Standard itself was made in [P2234R0]"
[5]
"Most other uses of such a pointer have implemention-defined behavior."
"Most other uses of such a pointer have implemention-defined behavior."
[6]
"X* p = (X*)std::malloc(sizeof(struct X)); p->a = 1; // undefined behavior, no set of objects give us defined behavior return p; } — end example] [Example: #include
struct X {
int..."
"X* p = (X*)std::malloc(sizeof(struct X)); p->a = 1; // undefined behavior, no set of objects give us defined behavior return p; } — end example] [Example: #include
[7]
"module; export moodule M; export int h(); // #1, attached to M"
"module; export moodule M; export int h(); // #1, attached to M"
[8]
"1 Specified in: [expr.basic.lvalue.strict.aliasing.violation] If a program attempts to access([defns.access]) the stored value of an object whose dynamic type is T through a glvalue whose type..."
"1 Specified in: [expr.basic.lvalue.strict.aliasing.violation] If a program attempts to access([defns.access]) the stored value of an object whose dynamic type is T through a glvalue whose type..."
[9]
"where T and the array element type are not similar([conv.rval]), the behavior is undefined."
"where T and the array element type are not similar([conv.rval]), the behavior is undefined."
[10]
"No diagnostic is requried if a function is declared in one translation unit with the noreturn attribute"
"No diagnostic is requried if a function is declared in one translation unit with the noreturn attribute"
[11]
"// Ill-formed no diagnoatic required"
"// Ill-formed no diagnoatic required"
[12]
"4 [Example: int main() { __uint128_t x2 = -1; float f = x2; // undefined behavior on systems where the range of // representable values of float is [-max,+max] on system where // represetable..."
"4 [Example: int main() { __uint128_t x2 = -1; float f = x2; // undefined behavior on systems where the range of // representable values of float is [-max,+max] on system where // represetable..."
[13]
"Otherwise, the behavior is undefined([expr.static.cast.does.not.contain.orignal.member]). "
"Otherwise, the behavior is undefined([expr.static.cast.does.not.contain.orignal.member]). "
[14]
"Translation unit #1 [[noreturn]] void f() {} Translation unit #2 void f(int i); // ill-formed no diagnostic required, declared without noreturn"
"Translation unit #1 [[noreturn]] void f() {} Translation unit #2 void f(int i); // ill-formed no diagnostic required, declared without noreturn"
[15]
"2 [Example: #include
#include
#include
#include
class resumable {
public:
struct promise_type;
using coro_handle =..."
"2 [Example: #include
[16]
"[Example: — end example] JMB: produce an example"
"[Example: — end example] JMB: produce an example"
[17]
"[Example: — end example] JMB/TD: This is really a general precondition imposed on the Standard Library, not a piece of core language undefined behavior. It is also currently missing an example."
"[Example: — end example] JMB/TD: This is really a general precondition imposed on the Standard Library, not a piece of core language undefined behavior. It is also currently missing an example."
Summary: P3596R0 proposes two new informative annexes for the C++ standard: one cataloguing every instance of undefined behavior with cross-references and examples, and one doing the same for ill-formed, no diagnostic required (IFNDR) cases. The paper includes proposed normative wording changes to tag each UB and IFNDR site with a stable name, plus draft annex content with explanatory examples.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.