From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by listman.redhat.com (Postfix) with ESMTP id 958C53099C for ; Wed, 18 Apr 2001 13:07:16 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.11.0/8.8.7) id f3IH3sp10757 for axp-list@listman.redhat.com; Wed, 18 Apr 2001 13:03:54 -0400 Received: from ml.comspec.com (IDENT:root@ml.comspec.com [192.139.80.27]) by mail.redhat.com (8.11.0/8.8.7) with ESMTP id f3IH3rC10753 for ; Wed, 18 Apr 2001 13:03:54 -0400 Received: from mercutio.iplink.net ([192.139.81.54]:7689 "EHLO iplink.net") by ml.comspec.com with ESMTP id ; Wed, 18 Apr 2001 13:05:33 -0400 Message-ID: <3ADDC9CC.25847588@iplink.net> Date: Wed, 18 Apr 2001 13:07:24 -0400 From: alvin X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.17-14 i686) X-Accept-Language: en MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: gcc 2.96 optimization bug on RedHat7.0/alpha References: <4DAF89CD261ED011A47B0000C0F973BF016FB619@norge.is.sal.ksu.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: axp-list@redhat.com List-Help: List-Post: List-Subscribe: , List-Id: Linux and Red Hat on Alpha processors List-Unsubscribe: , List-Archive: "Hoover, Tony" wrote: > > Granted, however a compile time warning that your source will generate > "_undefined_ behavior" should not be out of the question. > --------------------------------------------------------------------------- > Tony Hoover, Network Administrator > KSU - Salina, College of Technology > mailto:hoover@sal.ksu.edu > > "Don't Blend in..." > ---------------------------------------------------------------------------- > > > ---------- > > From: David Woodhouse[SMTP:dwmw2@infradead.org] > > Reply To: axp-list@redhat.com > > Sent: Wednesday, April 18, 2001 11:17 AM > > To: axp-list@redhat.com > > Subject: Re: gcc 2.96 optimization bug on RedHat7.0/alpha > > > > > > gatgul@voicenet.com said: > > > BTW your opinion about the code posted is broken, is also ur opinion. > > > It is perfectly correct IMHO . I guess it just does not live up to > > > some one else's arbitrary standard. > > > > The 'arbitrary standard' to which you refer is known as ISO C99. > > > > If you desire a compiler which lives up to other standards, that's fine - > > just don't report bugs against gcc. Do you see people reporting gcc to be > > buggy because it doesn't compile FORTRAN code to produce the results you > > expect? > > > > > > > I'm sorry that u believe this but i believe that the results from > > > -O0 == -O1 == -O2 == -O3 == -O4 > > > should all be the same. If any one of them failes to be equal, then > > > the compiler failed to produce the correct code to derive the correct > > > results. > > > > That is an interesting opinion. The rest of the world, however, accepts > > the > > fact that according to the specifications of the C language, certain code > > has _undefined_ behaviour. If the compiler encounters such code, it's > > perfectly entitled to send insulting mail to your boss and sleep with your > > wife. It's certainly not required to do the same thing each time. Then the compiler should allways print out a line that is somthing like "you code may not work as you expect(you have been warned)" Just a little try at humor. But on a more serious note. C as a language has a number of issues about order of evaluation of expressions and what will happen if you have side effects because of expression evaluation. I missed part of the early part of the thread but at this point it seems to be a discussion about what a compiler will do compared to what you might expect. Concider int x = 1; int y = 2; int fval = 4; int f(int val) { return fval/=val; } t = f(x) + f(y); is t = 4 + 2 or is t = 2 + 2 since "+" is commutitive it is legitimate to evaluate either f(x) or f(y) first but because of side effects you will get different results. A compiler can pick any order of evaluation so long as the operator precedance is kept. Now this is an extreem example but it is possible to find more subtile examples of this in everyday code. -- Alvin Starr || voice: (416)585-9971 Interlink Connectivity || fax: (416)585-9974 alvin@iplink.net ||