c/10844: Wrong computation on nan initialized vectors.

szegedy@or.uni-bonn.de szegedy@or.uni-bonn.de
Sun May 18 17:56:00 GMT 2003


>Number:         10844
>Category:       c
>Synopsis:       Wrong computation on nan initialized vectors.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sun May 18 17:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Christian Szegedy
>Release:        gcc (GCC) 3.2.2
>Organization:
>Environment:
gentoo Linux
>Description:
The following program outputs nan istead of 0:

#include <math.h>

int main()
{
   int n = 10;
   int i;
   double *w= (double*)malloc(sizeof(double)*n);
   double x;

   for( i=0 ; i<n ; i++ ) { w[i] = nan(""); }

   w[0] = .0;
   w[0] += .0;

   printf("%lg\n",w[0]);
   
   return 0;
}
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list