This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33271] nint_2.f90 abort compiled with -O0
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Sep 2007 10:04:33 -0000
- Subject: [Bug fortran/33271] nint_2.f90 abort compiled with -O0
- References: <bug-33271-14842@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from fxcoudert at gcc dot gnu dot org 2007-09-03 10:04 -------
(In reply to comment #3)
> A) I see that you and others put a number of patches and regenerations. Do you
> want me to rebootstrap and then do it?
I don't think we've touched anything who should affect this since you filed the
PR, so no real need to update.
It starts to sound like a library problem... could you compile and run the
following C source:
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
double a;
float b;
int j1, j2;
long long int i1, i2;
printf ("%lu %lu %lu\n", sizeof(int), sizeof(long int), sizeof(long long
int));
a = 4.99999999999999944488848768742172978818416595459e-1L;
i2 = 0;
i1 = (long long int) __builtin_lround (a);
if (i1 != 0 || i2 != 0)
puts ("Abort 1");
a = 5.0e-1L;
i2 = 1;
i1 = (long long int) __builtin_lround (a);
if (i1 != 1 || i2 != 1)
puts ("Abort 2");
a = 5.00000000000000111022302462515654042363166809082e-1L;
i2 = 1;
i1 = (long long int) __builtin_lround (a);
if (i1 != 1 || i2 != 1)
puts ("Abort 3");
b = 4.999999701976776123046875e-1;
j2 = 0;
j1 = (int) __builtin_lroundf (b);
if (j1 != 0 || j2 != 0)
puts ("Abort 4");
b = 5.0e-1;
j2 = 1;
j1 = (int) __builtin_lroundf (b);
if (j1 != 1 || j2 != 1)
puts ("Abort 5");
b = 5.00000059604644775390625e-1;
j2 = 1;
j1 = (int) __builtin_lroundf (b);
if (j1 != 1 || j2 != 1)
puts ("Abort 6");
a = 4.503599627370497e+15L;
i1 = __builtin_llround (a);
i2 = 4503599627370497;
if (i1 != i2 || i1 != 4503599627370497)
puts ("Abort 7");
a = -4.503599627370497e+15L;
i1 = __builtin_llround (a);
i2 = -4503599627370497;
if (i1 != i2 || i1 != -4503599627370497)
puts ("Abort 8");
return 0;
}
(gcc a.c -lm -W -Wall; try with -O0 and -O1, I expect it will fail only at
-O0).
One last question: in your build tree, you should have a file named
${builddir}/${target_triplet}/libgfortran/config.h. How does it define the
macros HAVE_LLROUND, HAVE_LLROUNDF, HAVE_LLROUNDL, HAVE_LROUND, HAVE_LROUNDF
and HAVE_LROUNDL?
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2007-09-03 10:04:32
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33271