Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Compiler design in C? Date: Mon, 14 Nov 2016 12:32:16 -0800 Organization: None to speak of Lines: 36 Message-ID: References: <9e27a17d-aaab-48e1-9139-95114dea0da6@googlegroups.com> <3121b7be-aca1-44b0-9dc9-6b23611bbfba@googlegroups.com> <300e8fda-56cf-476f-9bd7-257791357090@googlegroups.com> <8760nsr02s.fsf@gmail.com> <0dc796fe-911c-4dc0-952a-7b9e3ed54eae@googlegroups.com> <87mvh4kytv.fsf@bsb.me.uk> <7f59dd53-a2fd-4e61-85b9-308790eeab7d@googlegroups.com> <877f87llzn.fsf@bsb.me.uk> <7309d801-64fc-4d2b-961e-1e8b50f11389@googlegroups.com> <878tsn2e8z.fsf@gmail.com> <65a37d5b-1c93-41ad-95f4-321c05397d43@googlegroups.com> <87vavqh6zf.fsf@gmail.com> <874m39ykb4.fsf@gmail.com> <5c07d760-4246-4ff1-b34c-1a32eb69d49b@googlegroups.com> <87d1hx6dur.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="338d9c584b6183b18f341b7cfd63cc93"; logging-data="25510"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vkXhCIQZDg8buuOqCei3X" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:AcvFXMO1AjPNM8u/hVNzMjyAnvU= sha1:u4RK81BBi0O860n3xF67WOnedgU= Xref: csiph.com comp.lang.c:96571 supercat@casperkitty.com writes: > On Monday, November 14, 2016 at 1:49:56 PM UTC-6, gwowen wrote: [...] >> How does *your* "as if" rule differ from the Standard's version? > > The difference is that on hardware which defines the effect of an integer > store followed by a floating-point load, my version would specify that the > output must be consistent with such hardware-defined effect, while the > Standard's version would say that because *some* hardware platforms may not > define the effect, compilers for all hardware platforms--even those where > the effect would be defined--can do anything they like. So if a hardware platform makes certain guarantees about the behavior of its LOAD and STORE instructions (however they're spelled in the preferred assembly language for that platform), those guarantees should be imposed on the behavior of assignments and other expressions in the C programming language. (Only C, or should other languages be required to follow suit?) Certainly a given implementation is free to make such guarantees, as long as they don't conflict with the requirements of the standard. > When the authors of C89 listed the common effects of Undefined Behavior, > they did not prohibit implementations from doing anything else, but I've > seen no evidence that they intended that implementations for hardware which > would naturally behave in a useful fashion should not allow programmers to > exploit that behavior. One more time, I urge you to write up your proposals in a coherent form and post them somewhere. -- 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"