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]
Other format: [Raw text]

[Bug libfortran/68867] New: numeric formatting problem in the fortran library


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68867

            Bug ID: 68867
           Summary: numeric formatting problem in the fortran library
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: seurer at linux dot vnet.ibm.com
  Target Milestone: ---

There is a problem in the formatting code in the fortran library.  The test
case fmt_g0_7.f8 has been failing for a while now and while investigating it I
realized that it only fails when using the fortran library built with gcc trunk
but works when I use the library from gcc 5.1 or earlier versions.  I don't
know fortran so it could be that the library is correct and the test case is
wrong.


seurer@genoa:~/gcc/build/gcc-test/gcc/testsuite$ export
LD_LIBRARY_PATH=/home/seurer/gcc/build/gcc-test/powerpc64le-unknown-linux-gnu/./libgfortran/.libs 
seurer@genoa:~/gcc/build/gcc-test/gcc/testsuite$ ./fmt_g0_7.exe 

Program aborted. Backtrace:
Aborted (core dumped)
seurer@genoa:~/gcc/build/gcc-test/gcc/testsuite$ unset LD_LIBRARY_PATH
seurer@genoa:~/gcc/build/gcc-test/gcc/testsuite$ ./fmt_g0_7.exe 
seurer@genoa:~/gcc/build/gcc-test/gcc/testsuite$


The abort comes from line 30 of the test case

  if (n /= 0) call abort


If I run the code via gdb using the 6.0 library:

Breakpoint 1, testit () at
/home/seurer/gcc/gcc-test/gcc/testsuite/gfortran.dg/fmt_g0_7.f08:14
14            write(astring, '(ru,g0)') 1.0/real(10.0, kind=j(1))
(gdb) n
22          if (astring(2:2) /= '9') then
(gdb) print astring
$1 = '0.100000002', ' ' <repeats 39 times>


But I see this when using an earlier library:

Breakpoint 1, testit () at
/home/seurer/gcc/gcc-test/gcc/testsuite/gfortran.dg/fmt_g0_7.f08:14
14            write(astring, '(ru,g0)') 1.0/real(10.0, kind=j(1))
(gdb) n
22          if (astring(2:2) /= '9') then
(gdb) print astring
$1 = '.100000002', ' ' <repeats 40 times>


Note the difference in the format of the decimal number.

All 4 tests that the code does differ similarly and one of the differences
triggers the call to abort.

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