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
* [Bug libfortran/23138] real-values print and add incorrectly (version 4.1.0 20050702, i686-pc-mingw32)
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 ` pinskia at gcc dot gnu dot org
2005-07-29 19:20 ` post at tillmann-wegst dot de
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-29 19:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-29 18:54 -------
I cannot reproduce this with 20050729 on i686-pc-linux-gnu.
--
What |Removed |Added
----------------------------------------------------------------------------
Component|fortran |libfortran
GCC target triplet| |i686-pc-mingw32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23138
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libfortran/23138] real-values print and add incorrectly (version 4.1.0 20050702, i686-pc-mingw32)
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
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: post at tillmann-wegst dot de @ 2005-07-29 19:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From post at tillmann-wegst dot de 2005-07-29 19:01 -------
(In reply to comment #1)
> I cannot reproduce this with 20050729 on i686-pc-linux-gnu.
Yes, Steve Kargl has told me the same. The bug appears to be particular with
the MinGW-version.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23138
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libfortran/23138] real-values print and add incorrectly (version 4.1.0 20050702, i686-pc-mingw32)
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
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2005-07-30 8:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jvdelisle at gcc dot gnu dot org 2005-07-30 06:31 -------
I have confirmed this bug on cygwin. We can't get current builds on cygwin,
perhaps patch to pr21275 is needed?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23138
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libfortran/23138] real-values print and add incorrectly (version 4.1.0 20050702, i686-pc-mingw32)
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
` (2 preceding siblings ...)
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
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-07-30 13:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fxcoudert at gcc dot gnu dot org 2005-07-30 10:56 -------
Marked as confirmed due to Jerry's comment. Right now, building on mingw is an awful pain (4 PR
preventing the build), and cygwin is only a bit better. So, I think work on that point is useless until the
situation gets clearer.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-07-30 10:56:59
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23138
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libfortran/23138] real-values print and add incorrectly (version 4.1.0 20050702, i686-pc-mingw32)
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
` (3 preceding siblings ...)
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
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-30 15:25 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23138
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libfortran/23138] real-values print and add incorrectly (version 4.1.0 20050702, i686-pc-mingw32)
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
` (4 preceding siblings ...)
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
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2005-07-31 2:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dannysmith at users dot sourceforge dot net 2005-07-31 00:56 -------
This may be the problem:
In mk-kinds-h.sh:
case $largest_ctype in
float) echo "#define GFC_REAL_LARGEST_FORMAT \"\"" ;;
double) echo "#define GFC_REAL_LARGEST_FORMAT \"l\"" ;;
"long double") echo "#define GFC_REAL_LARGEST_FORMAT \"L\"" ;;
*) echo "$0: Unknown type" >&2 ; exit 1 ;;
esac
Although mingw supports long double math, the native msvcrt.dll runtime printf
family does not. The 'L' format specifier is ignored and passing long doubles
to printf doesn't work at all--the values are interptreted as doubles. The
same problem occurs in libstdc++ and the unsatisfacpory hack that mingw distros
use is to cast long doubles to doubles before sending to snprintf.
Danny
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23138
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libfortran/23138] real-values print and add incorrectly (version 4.1.0 20050702, i686-pc-mingw32)
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
` (5 preceding siblings ...)
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
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-08-01 21:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fxcoudert at gcc dot gnu dot org 2005-08-01 21:46 -------
(In reply to comment #5)
> Although mingw supports long double math, the native msvcrt.dll runtime printf
> family does not.
OK. I plan to do the following (hopefully in the next few days): add a configure
test and a macro HAVE_PRINTF_THAT_WORKS_WITH_LONG_DOUBLE, and in case it's not
defined (such as for mingw) provide a fallback function to avoid that printf.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23138
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libfortran/23138] real-values print and add incorrectly (version 4.1.0 20050702, i686-pc-mingw32)
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
` (6 preceding siblings ...)
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
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-08-02 7:40 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2005-07-30 10:56:59 |2005-08-02 07:40:27
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23138
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libfortran/23138] real-values are printed incorrectly
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
` (7 preceding siblings ...)
2005-08-02 7:40 ` fxcoudert at gcc dot gnu dot org
@ 2005-08-03 7:21 ` 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
10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-08-03 7:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fxcoudert at gcc dot gnu dot org 2005-08-03 07:21 -------
I've got a patch that should work, but can't test it because of PR23210.
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |23210
Summary|real-values print and add |real-values are printed
|incorrectly (version 4.1.0 |incorrectly
|20050702, i686-pc-mingw32) |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23138
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libfortran/23138] real-values are printed incorrectly
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
` (8 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-08-05 20:28 UTC (permalink / raw)
To: gcc-bugs
--
Bug 23138 depends on bug 23210, which changed state.
Bug 23210 Summary: i686-pc-mingw32/libssp: C compiler cannot create executables
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23210
What |Old Value |New Value
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23138
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libfortran/23138] real-values are printed incorrectly
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
` (9 preceding siblings ...)
2005-08-05 20:28 ` fxcoudert at gcc dot gnu dot org
@ 2005-08-05 22:01 ` fxcoudert at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-08-05 22:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fxcoudert at gcc dot gnu dot org 2005-08-05 22:01 -------
Patched tested and submitted to review
(http://gcc.gnu.org/ml/gcc-patches/2005-08/msg00338.html).
--
What |Removed |Added
----------------------------------------------------------------------------
URL| |http://gcc.gnu.org/ml/gcc-
| |patches/2005-
| |08/msg00338.html
Keywords| |patch
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).