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 ada/46490] New: For four major i386 BSDs, GNAT fails FP to static integer conversion with -O2,-O3 optimization


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

           Summary: For four major i386 BSDs, GNAT fails FP to static
                    integer conversion with -O2,-O3 optimization
           Product: gcc
           Version: 4.6.0
               URL: http://www.dragonlace.net
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gnugcc@marino.st
              Host: Same as Target
            Target: FreeBSD, OpenBSD, NetBSD, DragonFlyBSD: i386
             Build: Same as Target


Created attachment 22404
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22404
Nested_C460007 program (1 of 1)

I have successfully ported GNAT to all four major BSDs on two architectures,
i386 and x86_64 (8 ports total).
There is a failure of an ACATS test, cb460007, that fails on all four BSD
platforms, but only for the i386 arch.
All of the x86_64 ports pass the test just fine.

I have discovered the test passes on i386 if optimization level 0 or 1 is
specified.
Furthermore, if the test is re-written such that the program is contained
within a single procedure, the
test doesn't fail with any optimization levels.

I have provided two test programs.  The SlimC46007 program is cut-down version
of the ACATS test c460007, and tests case 9 and 10 only (conversion of floating
point to static integer).  The Nested_C460007 program does the same thing, but
without the extra package.


Output of running SlimC46007 to demonstrate effect of optimization levels.

> gnatmake -O2 slimc460007.adb
gnatgcc -c -O2 slimc460007.adb
gnatgcc -c -O2 c460007_1.adb
gnatbind -x slimc460007.ali
gnatlink slimc460007.ali -O2

> ./slimc460007
Test C460007: Rounding for type conversions of real operand to integer target
CASE  9 FAILED (static target subtype)
CASE 10 FAILED (static target subtype)

> rm *.o *.ali
> gnatmake slimc460007.adb
gnatgcc -c slimc460007.adb
gnatgcc -c c460007_1.adb
gnatbind -x slimc460007.ali
gnatlink slimc460007.ali

> ./slimc460007
Test C460007: Rounding for type conversions of real operand to integer target
BOTH TESTS PASSED.




Output of running Nested_C460007 where O-level has no effect
> gnatmake -O2 nested_c460007.adb
gnatgcc -c -O2 nested_c460007.adb
gnatbind -x nested_c460007.ali
gnatlink nested_c460007.ali -O2

> ./nested_c460007
BOTH TESTS PASSED.

> rm *.o *.ali
> gnatmake nested_c460007.adb
gnatgcc -c nested_c460007.adb
gnatbind -x nested_c460007.ali
gnatlink nested_c460007.ali

> ./nested_c460007
BOTH TESTS PASSED.



Note: I've been tracking this failure for months.  It's been part of 4.6.0 as
long as I can remember.
It is the only test failure for the i386 FreeBSD GNAT and the i386 DragonFly
BSD GNAT.  The i386 NetBSD GNAT is doesn't seem to support stack-checking, so
omitting those stack-check ACATS and DejaGNU test, this is the only failure on
that platform as well.


The same test was run on all 4 listed platforms with the exact same results.


i386 DragonFlyBSD 2.6  (13 Nov 2010)
====================================
> gnatgcc -v
Using built-in specs.
COLLECT_GCC=gnatgcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i386-backplane-dragonfly2.6/4.6.0/lto-wrapper
Target: i386-backplane-dragonfly2.6
Configured with: /home/marino/gnat_port/gen_x/work/gcc-4.6-20101113/configure
--enable-languages=c,ada --build=i386-backplane-dragonfly2.6
--program-prefix=gnat --prefix=/usr/local --with-system-zlib
--with-gmp=/usr/pkg --with-mpfr=/usr/pkg --with-mpc=/usr/pkg
--with-libiconv-prefix=/usr/pkg --enable-threads=single --enable-shared
--disable-bootstrap --disable-libgomp --disable-libssp --disable-nls
Thread model: single
gcc version 4.6.0 20101113 (experimental) -=> GNAT AUX [DragonFly BSD] (GCC)



i386 FreeBSD 8.0    (30 Oct 2010)
=================================
> gnatgcc -v
Using built-in specs.
COLLECT_GCC=gnatgcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i386-portbld-freebsd8.0/4.6.0/lto-wrapper
Target: i386-portbld-freebsd8.0
Configured with: /usr/home/marino/workzone/port/work/gcc-4.6-20101030/configure
--enable-languages=c,ada --build=i386-portbld-freebsd8.0 --program-prefix=gnat
--prefix=/usr/local --with-system-zlib --with-gmp=/usr/local
--with-mpfr=/usr/local --with-mpc=/usr/local --with-libiconv-prefix=/usr/local
--enable-shared --disable-bootstrap --disable-libgomp --disable-libssp
--disable-nls
Thread model: posix
gcc version 4.6.0 20101030 (experimental) -=> GNAT AUX [FreeBSD] (GCC)



i386 NetBSD 5.1RC4  (30 Oct 2010)
=================================
> gnatgcc -v
Using built-in specs.
COLLECT_GCC=gnatgcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i386-pc-netbsdelf5.1/4.6.0/lto-wrapper
Target: i386-pc-netbsdelf5.1
Configured with: /workzone/gnat_port/gen_2/work/gcc-4.6-20101030/configure
--enable-languages=c,ada --build=i386-pc-netbsdelf5.1 --program-prefix=gnat
--prefix=/usr/local --with-system-zlib --with-gmp=/usr/pkg --with-mpfr=/usr/pkg
--with-mpc=/usr/pkg --with-libiconv-prefix=/usr/pkg --enable-threads=yes
--enable-shared --disable-bootstrap --disable-libgomp --disable-libssp
--disable-nls
Thread model: posix
gcc version 4.6.0 20101030 (experimental) -=> GNAT AUX [NetBSD] (GCC)



i386 OpenBSD 4.7    (30 Oct 2010)
=================================
> gnatgcc -v
Using built-in specs.
COLLECT_GCC=gnatgcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i386-pc-openbsd4.7/4.6.0/lto-wrapper
Target: i386-pc-openbsd4.7
Configured with: /home/marino/gnat_port/gen_3/work/gcc-4.6-20101030/configure
--enable-languages=c,ada --build=i386-pc-openbsd4.7 --program-prefix=gnat
--prefix=/usr/local --with-system-zlib --with-gmp=/usr/local
--with-mpfr=/usr/local --with-mpc=/usr/local --with-libiconv-prefix=/usr/local
--enable-threads=yes --enable-shared --disable-bootstrap --disable-libgomp
--disable-libssp --disable-nls
Thread model: posix
gcc version 4.6.0 20101030 (experimental) -=> GNAT AUX [OpenBSD] (GCC)


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