Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
gcc-4.5.1 and Xlib issues
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
vh4x0r
n00b
n00b


Joined: 11 May 2009
Posts: 37

PostPosted: Tue Nov 16, 2010 9:16 pm    Post subject: gcc-4.5.1 and Xlib issues Reply with quote

I was working on some code using Xlib, and I noticed a weird issue :? , which hadn't occurred until I recompiled my entire system using gcc-4.5.1. I wrote this code :
Code:
#include <X11/Xlib.h>

int main ()
{
  Display * d = XOpenDisplay (NULL);
  int s = DefaultScreen (d);
  Window w = XCreateSimpleWindow (d, RootWindow (d, s), 400, 200, 400, 300, 1,
                                  BlackPixel (d, s), WhitePixel (d, s));
  XEvent e;
  GC arc_gc = XCreateGC (d, w, 0, 0);
  XSetLineAttributes (d, arc_gc, 1, LineSolid, CapNotLast, JoinMiter);
  XSelectInput (d, w, ExposureMask | KeyPressMask);
  XMapWindow (d, w);
  while (1)
    {
      XNextEvent (d, &e);
      if (e.type == Expose)
        XDrawArc (d, w, arc_gc, 50, 50, 100, 100, 0, 360*64);
      if (e.type == KeyPress)
        break;
    }
  XCloseDisplay (d);
  return 0;
}

and the result I got was an arc with lots of stray lines :lol: . Curiously this doesn't occur when I don't set the thickness with XSetLineAttributes (). I'm pretty sure this didn't occur with gcc 4.4. Here are my package versions.
Code:
[I] x11-libs/libX11
     Available versions:  1.3.4 (~)1.3.6 {doc ipv6 static-libs test +xcb}
     Installed versions:  1.3.6(13:13:31 10/12/10)(xcb -doc -ipv6 -static-libs -test)
     Homepage:            http://xorg.freedesktop.org/
     Description:         X.Org X11 library
[I] x11-base/xorg-server
     Available versions:  1.7.6 1.7.7-r1 (~)1.8.2 [m](~)1.9.2 [m](~)1.9.2.901 {debug dmx doc hal ipv6 kdrive minimal nptl sdl static-libs tslib +udev xorg}
     Installed versions:  1.8.2(06:19:47 10/15/10)(kdrive nptl udev xorg -dmx -doc -hal -ipv6 -minimal -static-libs -tslib)
     Homepage:            http://xorg.freedesktop.org/
     Description:         X.Org X servers
[U] sys-devel/gcc
     Available versions: 
   (2.95)   *2.95.3-r9 ~*2.95.3-r10!s
   (3.1)   *3.1.1-r2
   (3.2)   **3.2.2!s *3.2.3-r4
   (3.3)   (~)3.3.6-r1!s
   (3.4)   3.4.6-r2!s
   (4.0)   ~*4.0.4!s
   (4.1)   4.1.2!s
   (4.2)   (~)4.2.4-r1!s
   (4.3)   (~)4.3.3-r2!s 4.3.4!s (~)4.3.5!s
   (4.4)   (~)4.4.2!s 4.4.3-r2!s (~)4.4.3-r3!s (~)4.4.4-r1!s 4.4.4-r2!s (~)4.4.5!s
   (4.5)   {M}(~)4.5.1!s
   {altivec bootstrap boundschecking build d doc fixed-point fortran gcj graphite gtk hardened ip28 ip32r10k java libffi lto mudflap multilib multislot n32 n64 nls nocxx nopie nossp nptl objc objc++ objc-gc openmp static test vanilla}
     Installed versions:  4.4.3-r2(4.4)!s(16:37:03 10/07/10)(fortran mudflap multilib nls nptl openmp -altivec -bootstrap -build -doc -fixed-point -gcj -graphite -gtk -hardened -libffi -multislot -n32 -n64 -nocxx -objc -objc++ -objc-gc -test -vanilla) 4.5.1(4.5)!s(22:26:28 10/12/10)(doc fortran gcj graphite gtk lto mudflap multilib nls nptl openmp -altivec -bootstrap -build -fixed-point -hardened -libffi -multislot -n32 -n64 -nocxx -nopie -nossp -objc -objc++ -objc-gc -test -vanilla)
     Homepage:            http://gcc.gnu.org/
     Description:         The GNU Compiler Collection
Back to top
View user's profile Send private message
roarinelk
Guru
Guru


Joined: 04 Mar 2004
Posts: 520

PostPosted: Wed Nov 17, 2010 2:15 pm    Post subject: Reply with quote

Works for me, both 4.4.5 and 4.5.1 draw a window with a circle inside.

Maybe it's a gfx driver and/or libX11 issue? (I use x11 git with the nvidia blob).
Back to top
View user's profile Send private message
vh4x0r
n00b
n00b


Joined: 11 May 2009
Posts: 37

PostPosted: Wed Nov 17, 2010 2:57 pm    Post subject: Reply with quote

I have an integrated intel IGP (Intel HD graphics) with the Core i3 processor and xf86-video-intel-2.13.0. This graphics chip is relatively new :D , so that could be the problem too.
_________________
main () { while (true) fork (); }
Back to top
View user's profile Send private message
xpace
n00b
n00b


Joined: 20 Feb 2010
Posts: 5

PostPosted: Sun Feb 20, 2011 1:37 pm    Post subject: Reply with quote

vh4x0r, have you find a solution for this?

I have the same problem compiling your code. Also I see the same problem with:

qucs http://img97.imageshack.us/img97/8527/snapshot5u.png
kicad http://img571.imageshack.us/img571/9274/snapshot6p.png
multisim in wine http://img690.imageshack.us/img690/4959/snapshot7o.png

I'm using the proprietary drivers for nvidia and gcc 4.5.2
Back to top
View user's profile Send private message
vh4x0r
n00b
n00b


Joined: 11 May 2009
Posts: 37

PostPosted: Sun Feb 20, 2011 2:01 pm    Post subject: Reply with quote

No, it still occurs with libX11-1.4.1, gcc-4.5.2, xf86-video-intel-2.14.0 and xorg-server-1.9.4 :(
The only way to fix my code was to not change line attributes ...
_________________
main () { while (true) fork (); }
Back to top
View user's profile Send private message
xpace
n00b
n00b


Joined: 20 Feb 2010
Posts: 5

PostPosted: Sun Feb 20, 2011 3:47 pm    Post subject: Reply with quote

I filled a bug, but I dont know what is causing this.

https://bugs.gentoo.org/show_bug.cgi?id=355703
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum