From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23683 invoked by alias); 4 Nov 2002 17:06:07 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 23619 invoked by uid 71); 4 Nov 2002 17:06:07 -0000 Date: Mon, 04 Nov 2002 09:06:00 -0000 Message-ID: <20021104170607.23608.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Marco Bernardo Subject: Re: c/8395: gcc 2.95.4 and 3.2 generate wrong code for double on intel Reply-To: Marco Bernardo X-SW-Source: 2002-11/txt/msg00167.txt.bz2 List-Id: The following reply was made to PR c/8395; it has been noted by GNATS. From: Marco Bernardo To: Bruce Allen Cc: Bruce Allen , , , , Subject: Re: c/8395: gcc 2.95.4 and 3.2 generate wrong code for double on intel Date: Mon, 4 Nov 2002 17:56:51 +0100 (CET) Dear Bruce, Tim and Toone, Thanks for your messages and for the useful information you provided me with. >> 2. I hope we all agree on the fact that the output produced by >> a (sequential) C program is the same for a given input, >> regardless of the compilation options that are used. > >Absolutely false! > >C does not specify the order in which mathematical expressions are >evaluated, unless the programmer makes these completely explicity. > >And indeed compiling with optimizations turned on can eliminate many >subexpressions, cause compile-time evaluatiosn, register sorage etc, which >can also change results. I understand that: - C does not specify the order in which mathematical expressions are evaluated (up to operators precedence and associativity, I guess) - this order is important at run time (as you pointed out to me) - the compiler can change the order in which mathematical expressions are evaluated, especially for optimization purposes However, for a person doing research on the formal semantics of programming languages, it is difficult to accept that two differently compiled versions of the same sequential program return two different values for the same input. The compiler should not be free to alter the semantics of a sequential program, i.e. the program output for a given input! Some consistency should be kept. Anyway, thanks again for your messages. Best regards, Marco @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Prof. Marco Bernardo Universita` di Urbino Centro per l'Applicazione delle Scienze e Tecnologie dell'Informazione Piazza della Repubblica 13, 61029 Urbino, Italy Phone: +39-0722-4475 - E-mail: bernardo@sti.uniurb.it Fax: +39-0722-4475 - WWW: http://www.sti.uniurb.it/bernardo/ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@