GCC Bugzilla – Bug 22217
Z edit descriptor with negative numbers
Last modified: 2005-07-19 08:18:04 UTC
$ cat foo3.f90
i = -1
end program main
$ gfortran foo3.f90
$ gfortran -v
Using built-in specs.
Configured with: ../gcc-4.1-20050625/configure --prefix=/home/zfkts --enable-
Thread model: posix
gcc version 4.1.0 20050625 (experimental)
The output should be
Confirmed. This bug is due to my recent patch to support large integer kinds.
I'm thinking about how we should fix this.
It's probably easiest to have xtoa() and friends extract
the integer for themselves.
If you do this, don't forget to increase the size of buffer
so it can hold largest_integer_kind*8+1 characters for binary
Would it be possible to define a macro GFC_LARGEST_INTEGER_KIND
For the GFC_LARGEST_INTEGER_KIND macro, there is already a GFC_INTEGER_LARGEST.
Or do you mean that GFC_LARGEST_INTEGER_KIND should be just 8 (or 16), not
GFC_INTEGER_8 (or GFC_INTEGER_16)?
As for this bug, the solution you mention was the one I thought of, but it means
changing prototypes. A better solution (at least, I think it is better) is to
have an extract_uint() function that does cast to GFC_UINTEGER_4 before casting
Attached patch fixes the problem (for Z, O and B edit descriptors, with all kinds).
I'm leaving town tomorrow, won't have access to an internet connection and lots
of things to do before tomorrow. So, please feel free to test and commit this
patch! If nobody does it, I'll do it when I come back (in August).
Created attachment 9205 [details]
Subject: Bug 22217
Module name: gcc
Changes by: email@example.com 2005-07-09 09:33:32
libgfortran : ChangeLog
libgfortran/io : write.c
gcc/testsuite : ChangeLog
2005-07-07 Francois-Xavier Coudert <firstname.lastname@example.org>
Thomas Koenig <Thomas.Koenig@online.de>
* io/write.c (extract_unit): New function; extract
ints as unsigned signed int of the correct size.
* io/write.c (write_int): Use it.
* runtime/error.c: Adjust copyright years.
Adjust size of buffer to maximum that can occur.
2005-07-07 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.dg/negative-z-descriptor.f90: New test.
No need to apply on 4.0 branch, since support for large kinds is only in