This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/41675] New: GNAT rejects type with 64 bits, claiming it has 65 bits
- From: "dirk dot herrmann-privat at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Oct 2009 15:40:08 -0000
- Subject: [Bug ada/41675] New: GNAT rejects type with 64 bits, claiming it has 65 bits
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hello everybody,
the following piece of code demonstrates the problem. It compiles and prints
out "T'Size: 63". Thus, with the commented line used instead, the result
should be "T'Size: 64". But in that case GNAT terminates with the following
error message: "main.adb:5:04: size required (65) for type "t" too large,
maximum allowed is 64".
with Ada.Text_IO;
procedure Main is
-- T_Delta : constant := 0.1 * (2.0**(-64 + 9)); -- Gnat bug
T_Delta : constant := 0.1 * (2.0**(-63 + 9));
type T is delta T_Delta range 0.0 .. 51.1;
for T'Small use T_Delta;
begin
Ada.Text_IO.Put_Line("T'Size: " & Integer'Image(T'Size));
end Main;
One possible reason is, that GNAT counts a sign bit, which is not counted when
the 'Size attribute is queried. In any case, I assume that this inconsistency
is unintended.
Here's the versions that I am using:
> gnatmake --version
GNATMAKE 4.3.4
...
> gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.4-2'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr
--enable-targets=all --with-tune=generic --enable-checking=release
--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.3.4 (Debian 4.3.4-2)
Friendly regards,
Dirk Herrmann
--
Summary: GNAT rejects type with 64 bits, claiming it has 65 bits
Product: gcc
Version: 4.3.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dirk dot herrmann-privat at gmx dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41675