This is the mail archive of the gcc@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]

cp/semantics.c is broken.


Hi,

On x86,

# g++ -O2 -B/home/work/gnu/bin/egcs/gcc/    -c cw.cc -o cw.o
cw.cc: In function `double floor(double)':
cw.cc:9: warning: volatile qualifier ignored on asm
cw.cc:11: warning: volatile qualifier ignored on asm
cw.cc: In function `double ceil(double)':
cw.cc:21: warning: volatile qualifier ignored on asm
cw.cc:23: warning: volatile qualifier ignored on asm
/tmp/cca30122.s: Assembler messages:
/tmp/cca30122.s:31: Error: bad register name ('%0')
/tmp/cca30122.s:33: Error: bad register name ('%0')

It is from cp/semantics.c.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---cw.cc--
extern "C" { 
__inline  double
floor (double __x)
{
  register double __value;
  __volatile unsigned short int __cw, __cwtmp;
  __asm __volatile ("fnstcw %0" : "=m" (__cw));
  __cwtmp = (__cw & 0xf3ff) | 0x0400;  
  __asm __volatile ("fldcw %0" : : "m" (__cwtmp));
  __asm __volatile ("frndint" : "=t" (__value) : "0" (__x));
  __asm __volatile ("fldcw %0" : : "m" (__cw));
  return __value;
}
__inline  double
ceil (double __x)
{
  register double __value;
  __volatile unsigned short int __cw, __cwtmp;
  __asm __volatile ("fnstcw %0" : "=m" (__cw));
  __cwtmp = (__cw & 0xf3ff) | 0x0800;  
  __asm __volatile ("fldcw %0" : : "m" (__cwtmp));
  __asm __volatile ("frndint" : "=t" (__value) : "0" (__x));
  __asm __volatile ("fldcw %0" : : "m" (__cw));
  return __value;
}
} 
class DiscreteUniform {
    long pLow;
    double delta;
public:
    virtual double operator()();
};
double DiscreteUniform::operator()()
{
    long tmp = long(floor(delta * 2.5));
    return( double(pLow + tmp) );
}


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