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 target/30634] FAIL: gfortran.fortran-torture/execute/intrinsic_set_exponent.f90



------- Comment #11 from dave at hiauly1 dot hia dot nrc dot ca  2007-02-04 19:55 -------
Subject: Re:  FAIL: gfortran.fortran-torture/execute/intrinsic_set_exponent.f90

> > Can you try the following C code?
> > 
> > double f(void)
> > {
> >   long long t = -1;
> >   double t1;
> >   __builtin_memcpy(&t1, &t, sizeof(long long));
> >   return t;
> > }
> 
> Didn't cause a problem.  The constant was pushed to memory:

I realized that we should be returning t1 in the above.  Also noticed
that the constant that's a problem isn't -1, it's 0xffffffffffff.  So
I tweaked the program to see if it made a difference.  It didn't change
the generated code for function f.

However, I noticed that the above constant was not output correctly.
It was output as a pair of 32-bit words and the high and low parts were
reversed:

        .section        .rodata
        .align 8
L$C0000:
        .word   -1
        .word   1048575

Don't know why TARGET_ASM_ALIGNED_DI_OP wasn't used here.

# cat yy.c
#include <stdio.h>
double f(void)
{
  long long t = 0x000fffffffffffff;
  double t1;
  __builtin_memcpy(&t1, &t, sizeof(long long));
  return t1;
}
int main()
{
  union
    {
      long long ll;
      double d;
    } u;

  u.d = f ();
  printf ("ll = 0x%llx\n", u.ll);
  return 0;
}

# ../../xgcc -B../../ -O2 -o yy yy.c
# ./yy
ll = 0xffffffff000fffff
# ../../xgcc -B../../ -O0 -o yy yy.c
# ./yy
ll = 0xfffffffffffff
# ../../xgcc -B../../ -v
Reading specs from ../../specs
Target: hppa64-hp-hpux11.00
Configured with: ../gcc/configure --with-gnu-as --with-as=/opt/gnu64/bin/as
--with-ld=/usr/ccs/bin/ld --enable-shared --with-local-prefix=/opt/gnu64
--prefix=/opt/gnu64/gcc/gcc-4.2.0 --host=hppa64-hp-hpux11.00 --disable-nls
--with-gmp=/opt/gnu64/gcc/gcc-4.2.0
Thread model: posix
gcc version 4.2.0 20070123 (prerelease)

Dave


-- 


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


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