Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: The bug Date: Tue, 13 Feb 2018 11:44:13 -0800 Organization: None to speak of Lines: 28 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="687e3fdc1719f9ca714ff8931aee93b3"; logging-data="16648"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19m7hGwk4eNfA/MZ0JS4Kks" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:8clPqB5hpnxomVnT5adbdSwodug= sha1:2NkPmY7GS4zEceJJnDrMW9NeLGw= Xref: csiph.com comp.lang.c:126675 jacobnavia writes: > Le 08/02/2018 à 22:50, jacobnavia a écrit : >> Consider this program: [snip] >> Compiled without any optimizations, this program outputs nothing. Gcc >> with -O2 will print "bug". >> >> Why is this happening? >> > > I found the root cause: gcc/clang will assume that there is no "UB" i.e. > no overflow. Then, a multiplication of two unsigned values into a signed > result can't be negative. *You* found the root cause? I posted the explanation last Thursday. If you've killfiled me, you're free to do so, but I'd like to know about it so I don't waste my time. Can someone post a followup to this so jacob sees it? I'll also mention that I recently posted an lcc-win bug report in comp.compilers.lcc; jacob might have missed that as well. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"