public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: other/8974: fabs error with -ansi
@ 2002-12-23  2:26 Warren du Plessis
  0 siblings, 0 replies; 4+ messages in thread
From: Warren du Plessis @ 2002-12-23  2:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/8974; it has been noted by GNATS.

From: Warren du Plessis <warren@eng.up.ac.za>
To: bangerth@dealii.org,  gcc-bugs@gcc.gnu.org,  gcc-prs@gcc.gnu.org, 
 nobody@gcc.gnu.org,  warren@eng.up.ac.za,  gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: other/8974: fabs error with -ansi
Date: Mon, 23 Dec 2002 12:25:15 +0000

 Hi,
 
 If I try to link with "-static -ansi -lm" I get the following error message:
 /tmp/cc6IBIGC.o: In function `main':
 /tmp/cc6IBIGC.o(.text+0x43): undefined reference to `fabs'
 /tmp/cc6IBIGC.o(.text+0x89): undefined reference to `fabs'
 /tmp/cc6IBIGC.o(.text+0xca): undefined reference to `fabs'
 collect2: ld returned 1 exit status
 If I remove the -ansi flag and compile with "-static -lm" everything 
 works perfectly as I explained previously.
 
 I tried compiling with -O through -O8 (just to make sure! - I know the 
 docs say that there is nothing above -O3, but a friend of mine says that 
 it goes up to -O5 or -O6 at least) and got exactly the same results.
 
 My friend says that it could be a typecasting problem if that helps.
 
 Thanks for your help!
 Warren
 
 bangerth@dealii.org wrote:
 
 >Synopsis: fabs error with -ansi
 >
 >State-Changed-From-To: open->feedback
 >State-Changed-By: bangerth
 >State-Changed-When: Fri Dec 20 19:37:38 2002
 >State-Changed-Why:
 >    The problem you write seems as if for certain numbers the
 >    implementation of fabs is doing something wrong, but only
 >    on certain machines. Now, fabs is a function that libm
 >    implements, not the compiler, so to find out where the
 >    problem lies exactly, try the following:
 >    
 >    - try linking with -static on a machine where it works.
 >      This makes sure that not the local libm is taken, but the
 >      one from the system where it works. Try the other way
 >      round and see whether it then also fails on the machines
 >      it worked on previously.
 >    - Try what happens when you switch on optimization.
 >    
 >    Just for the reference, I cannot reproduce the problem
 >    on a PIII, but that was to be expected from your report.
 >    
 >    Thanks
 >      Wolfgang
 >
 >http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8974
 >
 >
 >  
 >
 
 
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: other/8974: fabs error with -ansi
@ 2003-05-12 11:46 steven
  0 siblings, 0 replies; 4+ messages in thread
From: steven @ 2003-05-12 11:46 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, warren

Synopsis: fabs error with -ansi

State-Changed-From-To: feedback->open
State-Changed-By: steven
State-Changed-When: Mon May 12 11:28:54 2003
State-Changed-Why:
    Feedback received.
    
    BTW Don't trust your friends ;-) -O3 really is the highest opimization level in GCC at the moment.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8974


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: other/8974: fabs error with -ansi
@ 2002-12-20 19:37 bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2002-12-20 19:37 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, warren

Synopsis: fabs error with -ansi

State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Fri Dec 20 19:37:38 2002
State-Changed-Why:
    The problem you write seems as if for certain numbers the
    implementation of fabs is doing something wrong, but only
    on certain machines. Now, fabs is a function that libm
    implements, not the compiler, so to find out where the
    problem lies exactly, try the following:
    
    - try linking with -static on a machine where it works.
      This makes sure that not the local libm is taken, but the
      one from the system where it works. Try the other way
      round and see whether it then also fails on the machines
      it worked on previously.
    - Try what happens when you switch on optimization.
    
    Just for the reference, I cannot reproduce the problem
    on a PIII, but that was to be expected from your report.
    
    Thanks
      Wolfgang

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8974


^ permalink raw reply	[flat|nested] 4+ messages in thread

* other/8974: fabs error with -ansi
@ 2002-12-17  2:16 warren
  0 siblings, 0 replies; 4+ messages in thread
From: warren @ 2002-12-17  2:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8974
>Category:       other
>Synopsis:       fabs error with -ansi
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 17 02:16:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Warren du Plessis
>Release:        unknown-1.0
>Organization:
>Environment:
Output of gcc -v
Configured with: /var/tmp/portage/gcc-3.2-r1/work/gcc-3.2/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,ada,f77,objc,java --enable-threads=posix --enable-long-long --disable-checking --enable-cstdio=stdio --enable-clocale=generic --enable-__cxa_atexit --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/include/g++-v32 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext
Thread model: posix
gcc version 3.2
>Description:
fabs() gives garbage (output included below) when I compile the code below with gcc 3.2 with the -ansi flag and run it on a PentiumIV 2.4 GHz I have access to.  The same code compiled with any other version of gcc or with icc works properly.  Running the same binary on a different spec machine works properly, but gives the same problem on other machines of the same type.  The problem only occurs when the -ansi flag is used (When I compile the code below with:
	gcc -ansi -lm -o test test.c
it gives problems, but when I compile with:
	gcc -lm -o test test.c
it works properly.).


Source file:
/* Test fabs problem */

#include<stdio.h>
#include<math.h>

int main()
{
  int count1;
  double value;

  /* Use a loop to show the behaviour as the values change. */
  for(count1 = 0; count1 < 8; count1++)
    {
      value = -1.35 + 0.01*count1;
      printf("%f\t%f\n", value, fabs(value));
    }

  /* Just to prove that the same thing happens with constants. */
  printf("\n%f\t%f\n", -1.29, fabs(-1.29));
  printf("%f\t%f\n", -1.28, fabs(-1.28));

  return 0;
}


Output:
-1.350000       0.000000
-1.340000       1972025612002701974956562650445561404174954378236176687125875831578843553978832422898371277103679201670561005568.000000
-1.330000       0.000000
-1.320000       427698125597735782527681486701155185015946591284413207628408209475262279918486665822208.000000
-1.310000       0.000000
-1.300000       92559680389175149863256792315491644408430319360732995401023488.000000
-1.290000       0.000000
-1.280000       19991593113087055742149331948245352448.000000

-1.290000       0.000000
-1.280000       19991593113087055742149331948245352448.000000
>How-To-Repeat:
Compile and run on a similar machine.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/gzip; name="test.i.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.i.gz"

H4sICBpl/z0AA3Rlc3QuaQDNHGtv20byu34FkeAAW1VsPWzFhnoH9FrXNc6JA8c94JAWBEUubdbU
UuFDtq/If7/ZF/fJhyUVOANVyN157+zM7JDsW2/ivSlRUR6FbwZvyc33yypJy3cJ/ocYCLPVKsCR
lyYYiUGBMmC3x1WRH6fJ8vg+DN+Rf5P52fzdmlzj6vndPa6OZ0fT4wSHaRWh46KMkuzo4Q2gzoDA
7P32FGaKAGIyRkFZ5aiQHKZnsxYYF43ipTgOIxRrRE5aiEyZKpPpKxkRzYqyWiqMZpM2aTmjs+1t
RijQvy3XDsyiWGW8C43ZoHxZI7jxKlwk9xhFXoJLr0j+i/xyAeRPTnbU07b4MimLY8JWXdvzVqDZ
Xkw1G7cyYcti2SN8CHLP9yufXCzs+eIhy0sKQK8cEMSiZB7+dcymGb6n0+RiMRj4PnouEcxm2Pc9
Nzj9EWS/VkFEFsuNaMILaFjaLpsLErohgMyZ71JEGMoE0OzEhIDfydxJRIWqLDDNoPA7mzqJSHQG
0GCaBovC7/yk2aDNK1Ej1hIJc3tDuAqiKDdmxeLBZYQ2qi7cXyjZyD1xb09wX0pw5kZZZRFyz2DY
Qo/qlKJYFsc6Ui10akwx+LUuGBssRExxyJunycqcqnmQSWZWW2rGSLpHmVdhOfC8P+E/jzPeBOmX
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jODE9M74i1BoLD9U9Iq/lKi9dmu13Qad+57KJFgHU3yFtkpi/gWw++JMSt3AIgzRVvgm0
npvagPWqRVm1TJEXhMTN+Y3vP8NyeToEVJc2zMAkUyS4k4wNY5Epg24yNoyLzFSBeRl53TTbEAYm
hx5W6zZaD5t1m6yHxRwGe+u9N9+Z7vYV0Oihh9YmjEPtTjIOGIfinWQcMKC69cCnW3X0vO7iZYOQ
nTt+PS+obHRSdSsexjOMaKvYYt8Ly/LjNHJitbPqg2Rzyu67LGiDuKhMxj3oWEAWpVUWxboO/HpI
vtkrcxfhHjj0qyQzlnev+Zo8j3MQhlDkEqQd3NK1+JqXnTvOhqFv2pifHfQIEyhJO8OEDWNJHQdL
I4Lab0rRYoO8IuXYEK9Ct7mnGaln2tVwAdmUwG1es7gd8OaDBnA9iJaqX9Ivi/qqy9+pJC+aolfS
IP8rBecX8W73EMJiLR31YzRvK8RIcdVUXdHa8VStHQdEjlWQ4IPD+mMu+tYofSOFy8U/ziIvocRZ
fsDmyXcjCw7rfe+dievvvmOHiD/5EY8iA/C7ydHs1PvOGx+NJ0PJgvyxvuDBm7/Fv5XwH34zYlgj
6vUHzCiHDPobFUNg/IYVHOAwPec49JrhOKiT2TMF8ow6gQcHtLKCtRkvBt8G/wP50WTFW0UAAA==


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-05-12 11:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-23  2:26 other/8974: fabs error with -ansi Warren du Plessis
  -- strict thread matches above, loose matches on Subject: below --
2003-05-12 11:46 steven
2002-12-20 19:37 bangerth
2002-12-17  2:16 warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).