https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87111
Bug ID: 87111 Summary: erroneous builtin snprintf transformations Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: bugdal at aerifal dot cx Target Milestone: --- Even at -O0, gcc transforms the call snprintf(buf, (size_t)INT_MAX+1, "") to the value 0, with a side effect storing a zero byte at *buf, despite the (disputed) POSIX requirement that snprintf fail when the n exceeds INT_MAX. This transformation is reported to cause failure of the official POSIX conformance tests, even when the library implementation for snprintf is conforming to the requirement.