🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Peter W. Flur Tue, 14 Apr 1992 14:10
Re: gcc compiler bug ?
#388
Author: Peter W. Flur
Date: Tue, 14 Apr 1992 14:10
40 lines
1487 bytes
|->  From osborn@eecom.gatech.edu Tue Apr 14 09:00:15 1992
|->  Return-Path: <osborn@eecom.gatech.edu>
|->  Date: Tue, 14 Apr 1992 09:00:13 -0500
|->  To: help@eecom
|->  From: osborn@eecom.gatech.edu
|->  Subject: gcc compiler bug ?
|->  
|->  
|->  There appears to be a bug in the gcc compiler on the hp's.  (I have not
|->  tried the suns yet.)
|->  
|->  The following program shows that the absolute value function (fabs) does
|->  not except double precision variables, as the man pages indicate.
|->  
|->  #include <math.h>
|->  
|->  main(ac,av)
|->  int ac;
|->  char *av[];
|->  {
|->  
|->  double a,b;
|->  
|->  a = 1.7;
|->  b = 0.5;
|->  printf("x = %g\n",fabs(a-b));
|->  printf("x = %g\n",fabs((a-b)));
|->  printf("x = %g\n",fabs((double)(a-b)));
|->  printf("x = %g\n",fabs((float)(a-b)));
|->  printf("x = %g\n",fabs(a*b));
|->  }
|->  
|->  Who should this bug be reported to ??  
|->  
|->  Allan Osborn
|->  
|->  

Well, in playing around, I see that this is a bug with the optimization or
lack thereof.  If you use gcc -O, it compiles fine.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads