Mailing List Archive

Re: Ghostscript Problem - Need Verification [SOLVED]
Well, the problem is solved and the solution may be of interest
to some Gentoo users.

At first I thought that I was in for some heavy debugging, but the
fault was a simple matter (simple at least superficially).

I have been using the latest gcc-4.5.1 for some time now and
I try to compile my system with all the newest optimizations, namely
the "-flto," "-floop-interchange," "-floop-strip-mine," and
"-floop-block" compiler flags which enables Graphite and LTO.
Usually I have no problems during an emerge but when I do the
temporary removal of the "-flto" option allows the emerge to finish.
So far there have been no issues with these flags.

Now, whenever a problem with software is encountered the first question
to ask is what has been changed on the system. In my case it most
likely was the use of these compiler flags. So, on a lark, I decided
to re-emerge ghostscript with a basic set of CFLAGS = -O2 -march=native.
It worked. The problem I was having with all black images has
disappeared and ghostscript functions normally.

However, I really cannot consider this to be normal behavior. Compiler
optimization should not degrade the function of a program. Something
subtle must be at fault with the gcc compiler. But being quite uninformed
about compiler design I cannot say much more.

Anyway, thanks again for all those who did the test. This confirmed
that the problem was not ghostscript per se but rather a strange effect
on the ghostscript code caused by the compiler optimization.

I can now see why the Gentoo deveolpers are being so cautious by considering
these latest GCC options as being experimental.

Frank Peters
Re: Ghostscript Problem - Need Verification [SOLVED] [ In reply to ]
Frank Peters <frank.peters@comcast.net> skribis:
> However, I really cannot consider this to be normal behavior. Compiler
> optimization should not degrade the function of a program.

I wouldn't think of optimizers that way; it is more important that a
person can write code that happens to work with the optimizer than
that the optimizer can analyze and handle any code it is given,
especially in a tricky, bit-twiddling language such as C.