Path: csiph.com!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.std.c Subject: Re: Does reading an uninitialized object have undefined behavior? Date: Fri, 18 Aug 2023 20:20:05 -0700 Organization: A noiseless patient Spider Lines: 17 Message-ID: <86wmxr4t22.fsf@linuxsc.com> References: <87zg3pq1ym.fsf@nosuchdomain.example.com> <87zg3pnuse.fsf@bsb.me.uk> <874jlxozzz.fsf@nosuchdomain.example.com> <87fs5hnipv.fsf@bsb.me.uk> <87a5vpnegz.fsf@nosuchdomain.example.com> <86a5uv95g7.fsf@linuxsc.com> <864jkz7hrm.fsf@linuxsc.com> <867cpu5h8w.fsf@linuxsc.com> <20230816235712.844@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: dont-email.me; posting-host="fd3ada769e75711f4f8ff6c26696c0a7"; logging-data="652185"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18XKjzRQdcWFNw+hma0QfFa0TN2GyhH/x8=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:vN3oFqc4xrcW94MsLSIiWw0HFVA= sha1:WVWyRdrWRnlsuNaqTQX2UAixiCE= Xref: csiph.com comp.std.c:6548 Kaz Kylheku <864-117-4973@kylheku.com> writes: > I'm all about the diagnosis. Even on machines in which all > representations are values, and therefore safe, a program whose > external effect or output depends on unintialized data, and is > therefore nondeterministic (a bad form of nondeterministic), is a > repugnant program. > > I'd like to have clear rules which allow an implementation to to > go great depths to diagnose all such situations, while remaining > conforming. (The language agrees that those situations are > erroneous, granting the tools license to diagnose.) The C standard allows compilers to do whatever analysis they want and to issue diagnostics for whatever conditions or circumstances they choose. What you want is orthogonal to what is being discussed.