This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c/2498: IA64 denormal float to double cast incorrect



>Number:         2498
>Category:       c
>Synopsis:       IA64 denormal float to double cast incorrect
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 05 15:06:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Mark Dewing
>Release:        gcc version 3.0 20010326
>Organization:
>Environment:
IA64
Linux 2.4.0test10-001115-58smp
>Description:
On the IA64, when a denormal float is cast
to double, the result is not the correct value.
>How-To-Repeat:
#include <stdio.h>


main(){

   float s1,s2;
   int i1,i2;
   float *fptr;
   double d1,d2;

   i1 = 0x800000;  /* smallest float */
   fptr = (float *)&i1;
   s1 = *fptr;

   i2 = 0x400000; /* this is denormal */
   fptr = (float *)&i2;
   s2 = *fptr;

   d1 =(double) s1;
   d2 =(double) s2;

   printf(" s1 = %20.10g s2 = %20.10g\n",s1,s2);
   printf(" d1 = %20.10g d1 = %20.10g\n",d1,d2);

}
>Fix:
The assembly output needs to generate a do-nothing fma.d
(ie add f0 and multiply by f1) in order to force the float
to double conversion.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]