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

--- Comment #14 from beebe at math dot utah.edu ---
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26374

That is a really old one, from early 2006; I would have hoped that it
had long since been repaired in gcc.

However, I just checked my VM for CentOS 7 on PowerPC, and found this:

        % cat foo.c
        static const double x = 1.0L / 42 ;

        % /usr/bin/gcc -c foo.c
        foo.c:1:1: error: initializer element is not computable at load time
         static const double x = 1.0L / 42 ;

That is gcc-4.8.5 (20150623 (Red Hat 4.8.5-44)).

I recently built gcc-8.5.0 on that system, and it raises the same
error.

Changing 42 to 42.0L to have a pure long-double expression does not
eliminate the error with either compiler.

The assignment is perfectly legal in all ISO Standards for C from 1989
to date, and the expression must be evaluated to IEEE 754 requirements
by the compiler, producing a correctly rounded result.  That latter
would not be possible if it were expressed as a fractional value,
because the C Standards do not require correct conversion of decimal
fractions to binary fractions.

The build of gcc-8.5.0 took five days on this qemu-emulated CPU, so it
really is not practical for me to try the test file with gcc-9 through
gcc-12 versions.  I needed 8.5.0 to be able to build TeX Live 2022:
see

        http://www.math.utah.edu/pub/texlive-utah/#centos-7-ppc64be

for my report (and many others elsewhere in that Web page).

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: be...@math.utah.edu  -
- 155 S 1400 E RM 233                       be...@acm.org  be...@computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------

Reply via email to