[Bug fortran/19443] log10 statement does not work properly in gfortran

mgilbert at airborne dot nrl dot navy dot mil gcc-bugzilla@gcc.gnu.org
Fri Mar 4 18:01:00 GMT 2005


------- Additional Comments From mgilbert at airborne dot nrl dot navy dot mil  2005-03-04 18:01 -------
I updated all cygwin packages recently as well as gfortran before the hd crash
and ensuing lack of cygwin build on gfortran.org.  However, I just got around to
testing the code again.  It appears that everything works correctly now.

  $ gfc --version
  GNU Fortran 95 (GCC 4.0.0 20050131 (experimental))
  Copyright (C) 2005 Free Software Foundation, Inc.

  $ cat log_test.f90
  program test
    implicit none
    REAL*4 :: tst4
    real*8 :: tst8
    tst4 = 1e-5_4
    tst8 = 1e-5_8
    write (*,*) "log with real*4 ......", 10*log (1e-5_4), 10*log (tst4)
    write (*,*) "log with real*8 ......", 10*log (1e-5_8), 10*log (tst8)
    write (*,*) "log10 with real*4 ....", 10*log10 (1e-5_4), 10*log10 (tst4)
    write (*,*) "log10 with real*8 ....", 10*log10 (1e-5_8), 10*log10 (tst8)
  end program test

  $ gfc -o log_test log_test.f90 && ./log_test     
    log with real*4 ......  -115.1292      -115.1292    
    log with real*8 ......  -115.129254649702       -115.129254649702     
    log10 with real*4 ....  -50.00000      -50.00000    
    log10 with real*8 ....  -50.0000000000000       -50.0000000000000  

The "-fdump-tree-gimple" flag doesn't appear to be available for gcc 3.3.3.  For
your reference, here is the gfc .original file

$ gfc -fdump-tree-original log_test.f90
$ cat log_test.f90.t02.orginal
MAIN__ ()
{
  real4 tst4;
  real8 tst8;

  tst4 = 9.99999974737875163555145263671875e-6;
  tst8 = 1.00000000000000008180305391403130954586231382564e-5;
  _gfortran_filename = "log_test.f90";
  _gfortran_line = 7;
  _gfortran_ioparm.unit = 6;
  _gfortran_ioparm.list_format = 1;
  _gfortran_st_write ();
  _gfortran_transfer_character ("log with real*4 ......", 22);
  {
    real4 C.452 = -1.1512924957275390625e+2;

    _gfortran_transfer_real (&C.452, 4);
  }
  {
    real4 D.453;

    D.453 = __builtin_logf (tst4) * 1.0e+1;
      _gfortran_transfer_real (&D.453, 4);
  }
  _gfortran_st_write_done ();
  _gfortran_filename = "log_test.f90";
  _gfortran_line = 8;
  _gfortran_ioparm.unit = 6;
  _gfortran_ioparm.list_format = 1;
  _gfortran_st_write ();
  _gfortran_transfer_character ("log with real*8 ......", 22);
  {
    real8 C.454 = -1.15129254649702289725610171444714069366455078125e+2;

    _gfortran_transfer_real (&C.454, 8);
  }
  {
    real8 D.455;

    D.455 = __builtin_log (tst8) * 1.0e+1;
    _gfortran_transfer_real (&D.455, 8);
  }
  _gfortran_st_write_done ();
  _gfortran_filename = "log_test.f90";
  _gfortran_line = 9;
  _gfortran_ioparm.unit = 6;
  _gfortran_ioparm.list_format = 1;
  _gfortran_st_write ();
  _gfortran_transfer_character ("log10 with real*4 ....", 22);
  {
    real4 C.456 = -5.0e+1;

    _gfortran_transfer_real (&C.456, 4);
  }
  {
    real4 D.457;

    D.457 = __builtin_log10f (tst4) * 1.0e+1;
    _gfortran_transfer_real (&D.457, 4);
  }
  _gfortran_st_write_done ();
  _gfortran_filename = "log_test.f90";
  _gfortran_line = 10;
  _gfortran_ioparm.unit = 6;
  _gfortran_ioparm.list_format = 1;
  _gfortran_st_write ();
  _gfortran_transfer_character ("log10 with real*8 ....", 22);
  {
    real8 C.458 = -5.0e+1;

    _gfortran_transfer_real (&C.458, 8);
  }
  {
    real8 D.459;

    D.459 = __builtin_log10 (tst8) * 1.0e+1;
    _gfortran_transfer_real (&D.459, 8);
  }
  _gfortran_st_write_done ();
}
    

-- 


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



More information about the Gcc-bugs mailing list