Hello all,                        

I have successfully built SH4-Linux toolchain based on              
(binutils-2.17, gcc-4.2-20061205, glibc-2.5) for Renesas SH target.             

I am facing problem while executing the following C++ program.                  

 ------------------------------------------------------------------     
 #include <stdio.h>
 #include <cmath>
 #include <cerrno>

 double  value;

 int main( void )
 {
         value = sqrt(-1.2);
         if (errno != EDOM) {
                 printf("sqrt: GOT %f\n", value);
         }
 }

 ------------------------------------------------------------------             

The above program compiles successfully with the sh4-linux toolchain.           
While executing on target platform "sqrt" function is returning "nan" but     
"errno" variable is not set to "EDOM".
Command: sh4-linux-gcc <name> {here default target is m4}

Observations:                

1. When the above program is compiled with "-m4-nofpu" target option  or with
   any other FPU less target option program executes successfully and the 
   "errno" variable is set to "EDOM".
   Command: sh4-linux-gcc -m4-nofpu <name>

Is there any relation with the target processor (i.e. floating point unit
processor or non - floating point unit processor)?  Because the only difference
between success and failure condition in our case is the target switch we are
specifying (m4-nofpu or m4 respectively ).

Any help on this will be appreciated.                    

Regards,                       
Ashay Jaiswal               
KPIT Cummins Infosystems Ltd,             
Pune (INDIA)                 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
Free download of GNU based SH-Linux toolchains for Renesas' SH Series.          
The following site also offers free technical support to its users.             
Visit http://www.kpitgnutools.com for details.                                
Latest versions of KPIT GNU SH-Linux tools were released on April 5, 2007.      
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


-- 
           Summary: SH- Mathematical Error handling is no working for valid
                    code
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Ashay dot Jaiswal at kpitcummins dot com
 GCC build triplet: i686-pc-linux
  GCC host triplet: sh4-unknown-linux
GCC target triplet: sh4-unknown-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31948

Reply via email to