https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64370

--- Comment #5 from dave.anglin at bell dot net ---
On 2015-01-09 2:31 PM, ubizjak at gmail dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64370
>
>
>
> --- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
>
> (In reply to Mikhail Maltsev from comment #3)
>
>> In libgfortran/intrinsics/c99_functions.c, scalbn is implemented like thi
> s:
>
>> double
>> scalbn (double x, int y)
>
>
> You should be extra careful here, we are using scalbln to avoid overflows.
>   
>
> Please see PR64503, there are some ipa tests in the testsuite (e.g.
>
> gcc.dg/ipa/iinline-4.c) that report -inf for estimated badness when other
>
> functions are used.

The change to using scalbln breaks hppa*-hpux11* as well:
g++ -c   -g -DIN_GCC    -fno-exceptions -fno-rtti 
-fasynchronous-unwind-tables -
W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format 
-Wmissing-format-
attribute -Woverloaded-virtual -pedantic -Wno-long-long 
-Wno-variadic-macros -Wn
o-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. 
-I../../gcc/gcc -I../.
./gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include 
-I/opt/
gnu/gcc/gmp/include  -I../../gcc/gcc/../libdecnumber 
-I../../gcc/gcc/../libdecnu
mber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o sreal.o 
-MT srea
l.o -MMD -MP -MF ./.deps/sreal.TPo ../../gcc/gcc/sreal.c
../../gcc/gcc/sreal.c: In member function 'double sreal::to_double() const':
../../gcc/gcc/sreal.c:125:30: error: 'scalbln' was not declared in this 
scope
      val = scalbln (val, m_exp);


I am puzzled why scalbln was used as m_exp has type "signed int". The 
code also seems
to be specific to a radix of 2.  So, ldexp (x, y) or x * pow (2, y) seem 
like the correct functions
to use.  Also note that an int type should hold the full range of 
exponents for double
on every machine that I'm aware of, so it doesn't seem like there is any 
benefit in using
scalbln over ldexp.

I have read that there are problems with overflow detection on alpha.  
So, is that the issue?

Dave

Reply via email to