From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10377 invoked by alias); 9 Oct 2002 17:16:02 -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 10356 invoked by uid 71); 9 Oct 2002 17:16:02 -0000 Date: Wed, 09 Oct 2002 10:16:00 -0000 Message-ID: <20021009171602.10354.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: =?iso-8859-1?Q?Pop_S=E9bastian?= Subject: Re: c/7857: Different behaviour if compiled with optimization! Reply-To: =?iso-8859-1?Q?Pop_S=E9bastian?= X-SW-Source: 2002-10/txt/msg00331.txt.bz2 List-Id: The following reply was made to PR c/7857; it has been noted by GNATS. From: =?iso-8859-1?Q?Pop_S=E9bastian?= To: jcas@netcabo.pt Cc: gcc-gnats@gcc.gnu.org, austern@apple.com Subject: Re: c/7857: Different behaviour if compiled with optimization! Date: Wed, 9 Oct 2002 19:15:06 +0200 On Sun, Sep 08, 2002 at 02:36:46PM -0000, jcas@netcabo.pt wrote: > /* > Compile with -O3 and runs fine > without there's a precision error. > SQ's value has the correct value with -O3 (+1 than without -O3 for n==46611179) > Reproduced with gcc version 2.95.4 20011002 (Debian prerelease) version gcc 3.3 20021007 (experimental) Compiling the bug report without -O3 gives an error: "Undefined reference to 'sqrt'". For completing the link we have to specify the -lm. Thus with no optimization, the 'sqrt' function is the one defined in the math library, whereas with -O3 the 'sqrt' function is the one defined by GCC... (I think) I hope that this helps, Sebastian. pop@gauvain:~/gcc/main/test$ ../usr/bin/gcc -o pr7857 ./pr7857.c -O3 pop@gauvain:~/gcc/main/test$ ../usr/bin/gcc -o pr7857 ./pr7857.c /tmp/emacs-09607/cc4vzVim.o: dans la fonction `main': /tmp/emacs-09607/cc4vzVim.o(.text+0xaf): r\351f\351rence ind\351finie vers `sqrt' collect2: ld a retourn\351 1 code d'\351tat d'ex\351cution pop@gauvain:~/gcc/main/test$ ../usr/bin/gcc -o pr7857 ./pr7857.c -lm pop@gauvain:~/gcc/main/test$