public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/23138] New: real-values print and add incorrectly (version 4.1.0 20050702, i686-pc-mingw32)
@ 2005-07-29 18:54 post at tillmann-wegst dot de
  2005-07-29 19:01 ` [Bug libfortran/23138] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: post at tillmann-wegst dot de @ 2005-07-29 18:54 UTC (permalink / raw)
  To: gcc-bugs

Hi all, 

I'd like to report what looks like a bug in 
gfortran for Windows, version: 
"GNU F95 version 4.1.0 20050702 (experimental) (i686-pc-mingw32)"

It concerns values of type real, which both print and add 
incorrectly. 

To give an example, take this little program: 

------------------------------------------------
program realtrouble
   real :: x
   integer :: i

   x=1.0
   i=5

   write(*,*) "x==",x    ! Prints 0.0 instead of 1.0 !!! 
   write(*,*) "x==",1.0  ! Prints 0.0 too !!! 
   write(*,*) "i==",i    ! Prints 5, as expected
end program realtrouble
------------------------------------------------------

Apart from incorrect results of write()ing: when summing 
several values of type real, adding 0.0 to 0.0 yielded 2.0, 
adding another 0.0 to 2.0 yielded 0.0 again! 

I've compiled and linked the program at the command-line 
under Windows XP with no particular flags, simply like this: 
    gfortran gftest.f95

Here's what a verbose execution produced: 
Driving: gfortran gftest.f95 -v -lgfortranbegin -lgfortran
Using built-in specs.
Target: i686-pc-mingw32
Configured with: ../gcc/configure --prefix=/mingw --enable-languages=c,f95
Thread model: win32
gcc version 4.1.0 20050702 (experimental)
 c:/gfortran/bin/../libexec/gcc/i686-pc-mingw32/4.1.0/f951.exe gftest.f95 -
quiet -dumpbase gftest.f9
5 -mtune=pentiumpro -auxbase gftest -version -o C:\DOKUME~1\Tillmann\LOKALE~1
\Temp/ccWqbaaa.s
GNU F95 version 4.1.0 20050702 (experimental) (i686-pc-mingw32)
        compiled by GNU C version 3.4.4 (mingw special).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
 as -o C:\DOKUME~1\Tillmann\LOKALE~1\Temp/ccIHcaaa.o C:\DOKUME~1
\Tillmann\LOKALE~1\Temp/ccWqbaaa.s
 c:/gfortran/bin/../libexec/gcc/i686-pc-mingw32/4.1.0/collect2.exe -Bdynamic 
C:/fortran/g95/lib/crt2
.o -Lc:/gfortran/bin/../lib/gcc/i686-pc-mingw32/4.1.0 -
Lc:/gfortran/bin/../lib/gcc -LC:/fortran/g95/
lib -Lc:/gfortran/bin/../lib/gcc/i686-pc-mingw32/4.1.0/../../.. C:\DOKUME~1
\Tillmann\LOKALE~1\Temp/c
cIHcaaa.o -lgfortranbegin -lgfortran -lmingw32 -lgcc -lmoldname -lmingwex -
lmsvcrt -luser32 -lkernel
32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt
--------------------------------------

I've exchanged mails with Steven Kargl, who suggested to 
produce a .original-file using flag "-fdump-tree-original". 

This generated the following: 
MAIN__ ()
{
  real4 x;
  int4 i;

  x = 1.0e+0;
  i = 5;
  _gfortran_filename = "gftest.f95";
  _gfortran_line = 8;
  _gfortran_ioparm.unit = 6;
  _gfortran_ioparm.list_format = 1;
  _gfortran_st_write ();
  _gfortran_transfer_character ("x==", 3);
  _gfortran_transfer_real (&x, 4);
  _gfortran_st_write_done ();
  _gfortran_filename = "gftest.f95";
  _gfortran_line = 9;
  _gfortran_ioparm.unit = 6;
  _gfortran_ioparm.list_format = 1;
  _gfortran_st_write ();
  _gfortran_transfer_character ("x==", 3);
  {
    real4 C.473 = 1.0e+0;

    _gfortran_transfer_real (&C.473, 4);
  }
  _gfortran_st_write_done ();
  _gfortran_filename = "gftest.f95";
  _gfortran_line = 10;
  _gfortran_ioparm.unit = 6;
  _gfortran_ioparm.list_format = 1;
  _gfortran_st_write ();
  _gfortran_transfer_character ("i==", 3);
  _gfortran_transfer_integer (&i, 4);
  _gfortran_st_write_done ();
}
------------------------------------ 

Steve's preliminary conclusion is (quote):
"(...).original shows that the gfortran frontend is
doing the right thing.  This is a gfortran library problem
or an interface with OS library problem." 

Kind regards 
   Tillmann Wegst

-- 
           Summary: real-values print and add incorrectly (version 4.1.0
                    20050702, i686-pc-mingw32)
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: post at tillmann-wegst dot de
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-08-05 22:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-29 18:54 [Bug fortran/23138] New: real-values print and add incorrectly (version 4.1.0 20050702, i686-pc-mingw32) post at tillmann-wegst dot de
2005-07-29 19:01 ` [Bug libfortran/23138] " pinskia at gcc dot gnu dot org
2005-07-29 19:20 ` post at tillmann-wegst dot de
2005-07-30  8:07 ` jvdelisle at gcc dot gnu dot org
2005-07-30 13:35 ` fxcoudert at gcc dot gnu dot org
2005-07-30 15:25 ` pinskia at gcc dot gnu dot org
2005-07-31  2:12 ` dannysmith at users dot sourceforge dot net
2005-08-01 21:46 ` fxcoudert at gcc dot gnu dot org
2005-08-02  7:40 ` fxcoudert at gcc dot gnu dot org
2005-08-03  7:21 ` [Bug libfortran/23138] real-values are printed incorrectly fxcoudert at gcc dot gnu dot org
2005-08-05 20:28 ` fxcoudert at gcc dot gnu dot org
2005-08-05 22:01 ` fxcoudert at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).