Bug 355496 - "-fno-tree-vrp" optimization broken?
Summary: "-fno-tree-vrp" optimization broken?
Status: RESOLVED FIXED
Alias: None
Product: openSUSE 11.0
Classification: openSUSE
Component: Development (show other bugs)
Version: Alpha 1
Hardware: All Linux
: P5 - None : Normal (vote)
Target Milestone: Alpha 3
Assignee: Richard Biener
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-22 23:03 UTC by Mike Fabian
Modified: 2008-02-25 17:34 UTC (History)
2 users (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
ImUtil.i (208.96 KB, text/plain)
2008-02-13 21:09 UTC, Stefan Dirsch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Fabian 2008-01-22 23:03:25 UTC
Can be reproduced like this:

gs -dNOPLATFONTS -sDEVICE=x11alpha /usr/share/doc/packages/ghostscript-library/examples/alphabet.ps

(happens both on i386 and x86_64).

Works on 10.3.
Comment 1 Mike Fabian 2008-01-22 23:04:39 UTC
Without anti-aliasing it still works fine, i.e. 

gs -dNOPLATFONTS -sDEVICE=x11
/usr/share/doc/packages/ghostscript-library/examples/alphabet.ps

works. But as soon as one tries to use anti-aliasing,
only blank pages are displayed.
Comment 2 Dr. Werner Fink 2008-01-23 09:43:01 UTC
The ghostscript of 10.3 is espgs 8.15.4, that on factory is gpl gs 8.60.
Please note that gpl gs 8.60 does show the page on a 10.2 with and without
anti-aliasing, therefore I guess a compiler problem.

Richard? What has changed between the old and new compiler?  Is there the
last working compiler available within factory?
Comment 3 Richard Biener 2008-01-23 10:08:15 UTC
There changed a lot, as always.  You can try murzim-rguenther-12 for what will
be submitted for the next rebuild.
Comment 4 Dr. Werner Fink 2008-01-23 11:45:07 UTC
This version of gcc results also in blank pages
Comment 5 Dr. Werner Fink 2008-02-12 12:05:38 UTC
Just copied the resulting binary RPMs of a factory build without
libgs support into a build system of 10.3 and installed this.
The same binary together with the same X11.so device file
does not work on factroy but on 10.3.

This leads me to the assumption that the problem is not located
within gs its self but one of the following libraries:

 d127:/ # ldd /tmp/gs /usr/lib64/ghostscript/8.60/X11.so
 /tmp/gs:
        libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x00002aaaaacc8000)
        libcupsimage.so.2 => /usr/lib64/libcupsimage.so.2 (0x00002aaaaaf46000)
        libcups.so.2 => /usr/lib64/libcups.so.2 (0x00002aaaab15c000)
        libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x00002aaaab392000)
        libgimpprint.so.1 => /usr/lib64/libgimpprint.so.1 (0x00002aaaab5b8000)
        libz.so.1 => /lib64/libz.so.1 (0x00002aaaab8a2000)
        libgmodule-2.0.so.0 => /usr/lib64/libgmodule-2.0.so.0 (0x00002aaaabab8000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00002aaaabcbc000)
        libglib-2.0.so.0 => /usr/lib64/libglib-2.0.so.0 (0x00002aaaabec0000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00002aaaac16f000)
        libtiff.so.3 => /usr/lib64/libtiff.so.3 (0x00002aaaac477000)
        libjpeg.so.62 => /usr/lib64/libjpeg.so.62 (0x00002aaaac6d1000)
        libssl.so.0.9.8 => /usr/lib64/libssl.so.0.9.8 (0x00002aaaac8f5000)
        libcrypto.so.0.9.8 => /usr/lib64/libcrypto.so.0.9.8 (0x00002aaaacb41000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aaaacec0000)
        libm.so.6 => /lib64/libm.so.6 (0x00002aaaad0dc000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00002aaaad32f000)
        libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00002aaaad568000)
        libc.so.6 => /lib64/libc.so.6 (0x00002aaaad79e000)
        /lib64/ld-linux-x86-64.so.2 (0x00002aaaaaaab000)
        libpcre.so.0 => /usr/lib64/libpcre.so.0 (0x00002aaaadae3000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002aaaadd0c000)
        libexpat.so.1 => /lib64/libexpat.so.1 (0x00002aaaadf1a000)
 /usr/lib64/ghostscript/8.60/X11.so:
        libXt.so.6 => /usr/lib64/libXt.so.6 (0x00002aaaaaccc000)
        libSM.so.6 => /usr/lib64/libSM.so.6 (0x00002aaaaaf2f000)
        libICE.so.6 => /usr/lib64/libICE.so.6 (0x00002aaaab138000)
        libXext.so.6 => /usr/lib64/libXext.so.6 (0x00002aaaab355000)
        libX11.so.6 => /usr/lib64/libX11.so.6 (0x00002aaaab566000)
        libc.so.6 => /lib64/libc.so.6 (0x00002aaaab89c000)
        libXau.so.6 => /usr/lib64/libXau.so.6 (0x00002aaaabbe2000)
        libxcb-xlib.so.0 => /usr/lib64/libxcb-xlib.so.0 (0x00002aaaabde5000)
        libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00002aaaabfe7000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00002aaaac204000)
        /lib64/ld-linux-x86-64.so.2 (0x0000555555555000)

It should be noted that not only the fonts are not displayed in
case of using -sDEVICE=x11alpha but also normal drawings are
missed or incomplete, e.g.

  gs -sDEVICE=x11alpha /usr/share/ghostscript/8.60/examples/tiger.eps

shows only a gray background in factory but in the 10.3 system the normal
tiger face in foreground.

Are there any miss-compilations within the X11 libraries?
Comment 6 Mike Fabian 2008-02-12 12:32:26 UTC
We have now tried whether it works with the X11 library from 10.3.

We unpacked

/work/CDs/all/full-10.3-x86_64/suse/x86_64/xorg-x11-libX11.rpm

in a local directory and removed libX11-xcb.so.1.0.0 so that only
libX11 remained.

Then,

LD_LIBRARY_PATH=${PWD}/usr/lib64 gs -sDEVICE=x11alpha  /usr/share/ghostscript/8.60/examples/tiger.eps

worked.

So this might be a problem in libX11 or a maybe a mis-compilation of
libX11 in STABLE.
Comment 7 Stefan Dirsch 2008-02-12 23:08:11 UTC
I don't see this issue on a 10.3 with current X.Org (including libX11) built for 10.3 and installed. But this is still ghostscript 8.15. 
Comment 8 Stefan Dirsch 2008-02-12 23:57:30 UTC
(In reply to comment #7 from Stefan Dirsch)
> I don't see this issue on a 10.3 with current X.Org (including libX11) built
> for 10.3 and installed. But this is still ghostscript 8.15. 
Still working after updating ghostscript to release 8.60 from STABLE built for 10.3. Miscompilation of libX11 in STABLE?

Comment 9 Stefan Dirsch 2008-02-13 06:12:27 UTC
I've now recompiled the libX11 and libxcb sources of 10.3 for STABLE. Still the same problem.
Comment 10 Stefan Dirsch 2008-02-13 06:26:02 UTC
Building (STABLE) libX11 with
RPM_OPT_FLAGS="-fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-aliasing", i.e. removing the "-O2" optimization, fixes the issue. We're testing on x86_64. I have no clue which file gets miscompiled.

Comment 11 Stefan Dirsch 2008-02-13 06:36:08 UTC
"-O1" still works. 
Comment 12 Stefan Dirsch 2008-02-13 06:46:57 UTC
So it's one of these:
+  -falign-jumps                        [enabled]
+  -falign-labels                       [enabled]
+  -fcaller-saves                       [enabled]
+  -fcrossjumping                       [enabled]
+  -fcse-follow-jumps                   [enabled]
+  -fdelete-null-pointer-checks         [enabled]
+  -fexpensive-optimizations            [enabled]
+  -fforward-propagate                  [enabled]
+  -fgcse                               [enabled]
+  -finline-small-functions             [enabled]
+  -foptimize-register-move             [enabled]
+  -foptimize-sibling-calls             [enabled]
+  -fpeephole2                          [enabled]
+  -fregmove                            [enabled]
+  -freorder-blocks                     [enabled]
+  -freorder-functions                  [enabled]
+  -fschedule-insns2                    [enabled]
+  -fstrict-aliasing                    [enabled]
+  -fthread-jumps                       [enabled]
+  -ftree-pre                           [enabled]
+  -ftree-store-ccp                     [enabled]
+  -ftree-vrp                           [enabled]

Richard, any favorites? Do I need to disable one by one? 
Werner, what is the difference between x11 and x11alpha DEVICE in X11 function calling? Can this give us a hint where to look for?
Comment 13 Richard Biener 2008-02-13 09:18:35 UTC
Try adding -fwrapv.  Also try the gcc from mbuild murzim-rguenther-54, that
contains some (random) fixes.
Comment 14 Stefan Dirsch 2008-02-13 10:17:39 UTC
Fixed with adding "-fno-wrapv". :-)

There is no x86_64 in murzim-rguenther-54. Tried with urzim-rguenther-53. Without "-fno-wrapv" this didn't help. :-(
Comment 15 Richard Biener 2008-02-13 10:30:58 UTC
Err, -fno-wrapv is the default ... (I'm checking what that actually does now ;))
Comment 16 Richard Biener 2008-02-13 10:32:15 UTC
Oh, and it was murzim-rguenther-52, but I don't remember fixes in that area
(and if it is -fwrapv that fixes it, there's a bug in libX11).
Comment 17 Stefan Dirsch 2008-02-13 10:37:49 UTC
I'm confused. I'll doublecheck my results.
Comment 18 Stefan Dirsch 2008-02-13 11:02:27 UTC
My results before were bogus. Neither -fno-wrapv nor -fwrapv help. Sorry for the confusion. But at least using "-O1" still helps. :-)

Building with gcc from murzim-rguenther-52 didn't help. I think we're back to comment #12.
Comment 19 Stefan Dirsch 2008-02-13 11:54:40 UTC
Ok. Using "-O2 -fno-tree-vrp" instead of "-O2" fixes the problem.
Comment 20 Dr. Werner Fink 2008-02-13 12:00:57 UTC
On comment #12: AFAIK ghostscript uses memory mapping into X11 pixmap
instead of drawing.  You may use also

gs -sDEVICE=x11 -dMaxBitmap=5000000 /usr/share/ghostscript/8.60/examples/waterfal.ps

to force this.
Comment 21 Stefan Dirsch 2008-02-13 16:40:54 UTC
It's enough to compile libX11-1.1.3/src/ImUtil.c with -fno-tree-vrp. Most likely XinitImage(). Richard, let me know what you need to investigate this issue.
Comment 22 Richard Biener 2008-02-13 16:51:22 UTC
Please attach pre-processed source of this file (just pass an additional -save-temps to the build commandline), ImUtil.i.  Thanks.
Comment 23 Stefan Dirsch 2008-02-13 21:09:36 UTC
Created attachment 194768 [details]
ImUtil.i
Comment 24 Richard Biener 2008-02-17 11:39:33 UTC
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35231

and I have a fix.
Comment 25 Stefan Dirsch 2008-02-20 21:09:10 UTC
Great! A fix for gcc or libX11 code?
Comment 26 Richard Biener 2008-02-20 21:25:13 UTC
For gcc.
Comment 27 Richard Biener 2008-02-22 12:49:36 UTC
Fixed.  (package waits for checkin)
Comment 28 Stefan Dirsch 2008-02-23 17:03:39 UTC
Excellent! I'll remove the option once gcc has been checked in.
Comment 29 Stefan Dirsch 2008-02-25 17:34:13 UTC
(In reply to comment #28 from Stefan Dirsch)
> Excellent! I'll remove the option once gcc has been checked in.

done.