Path: csiph.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: David Brown Newsgroups: comp.compilers Subject: Re: Optimization techniques and undefined behavior Date: Tue, 7 May 2019 16:05:49 +0200 Organization: A noiseless patient Spider Lines: 22 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <19-05-050@comp.compilers> References: <19-05-014@comp.compilers> <19-04-021@comp.compilers> <19-04-023@comp.compilers> <19-04-037@comp.compilers> <19-04-039@comp.compilers> <19-04-042@comp.compilers> <19-04-044@comp.compilers> <19-04-047@comp.compilers> <19-05-004@comp.compilers> <19-05-008@comp.compilers> <19-05-014@comp.compilers> <19-05-021@comp.compilers> <19-05-041@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="25228"; mail-complaints-to="abuse@iecc.com" Keywords: arithmetic, errors, comment Posted-Date: 07 May 2019 18:43:42 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <19-05-041@comp.compilers> Content-Language: en-GB Xref: csiph.com comp.compilers:2285 On 06/05/2019 17:22, Robin Vowels wrote: > From: "David Brown" > Sent: Saturday, May 04, 2019 1:23 AM > >> You are, as usual, very keen to pick out gcc as though it was something >> special here.  Compilers have been assuming signed integer overflow >> never happens for over 20 years (that's just from my own personal >> experience), long before gcc was that smart. > > Some compilers might, but I have not met one that does ignore > overflow. > I have met several (other than gcc). These were not PC/x86 compilers. > Even in evaluating compile-time expressions, an overflow > is treated as an error, and a diagnostic is issued. That is usually the case, and is helpful. > [clang and gcc definitely generate code that ignores integer overflows > at runtime. I just checked. -John]