Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rainer Weikusat Newsgroups: comp.unix.programmer,comp.lang.c Subject: Re: Odd compiler behaviour? Date: Tue, 01 Mar 2016 21:20:45 +0000 Lines: 18 Message-ID: <87si09lwsy.fsf@doppelsaurus.mobileactivedefense.com> References: <20160301061135.783@kylheku.com> <87h9gqb0lj.fsf@mantic.terraraq.uk> <878u22aua9.fsf@mantic.terraraq.uk> <87wpplaojy.fsf@mantic.terraraq.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net jZlEFw/qwOtYkP/3w6Lyvwbl1toZONA7fbkcgtRbglMxhboNE= Cancel-Lock: sha1:Y62h+gxdx5u10Cy0t0UzLDM0nsY= sha1:EyqeNRn74bGUMkrnT2UHolrplLQ= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Xref: csiph.com comp.unix.programmer:7990 comp.lang.c:82907 Richard Kettlewell writes: > Barry Margolin writes: [...] >> Wow, you totally misunderstand the point of declaring out-of-bounds >> access to be UB. >> >> The compiler can still generate the first code, and in fact that's >> what I'd expect most compilers to do. It doesn't have to check >> bounds, > > “Do anything you like” - in other words, undefined behavior - includes > the first line, but not exclusively. "Nobody's asked to do anything specific" ('undefined behaviour') is something rather different fromj "do anything you like".