search -  faq -  rulez -  staff

forums






map cycle
irc              pwnalizer
voice         dswp bar




Register

Login


It is currently 12.21.24

 

All times are UTC + 1 hour


Forum rules


Teh Master Of Anarchy Commands U:
LOL!



Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: C+GCC+X11+OpenGL=WTF
PostPosted: 08.08.12 
Offline
[dswp]R.Stallman
User avatar

Joined: 04.13.09
Posts: 2946
Location: Solar System/≈Zagreb
-----tdm:  
nick: [ntr]Shortly
skill: 497.05
kills: 3446
deaths: 4411
ratio: 0.78
-----bomb:  
nick: [ntr]Shortly
skill: 707.602
kills: 526
deaths: 863
ratio: 0.60
The only difference between wtf1.c and wtf2.c is the line 141.

From wtf1.c:
Code:
 int i;

From wtf2.c:
Code:
 int i,j;

Look what difference it makes:
Code:
$ ./wtf1
Unhandled X event type: 28.
Unhandled X event type: 28.
Unhandled X event type: 28.
Unhandled X event type: 28.
Unhandled X event type: 28.
Unhandled X event type: 28.
Unhandled X event type: 28.
Unhandled X event type: 28.
Unhandled X event type: 28.
Unhandled X event type: 28.
Unhandled X event type: 28.
Unhandled X event type: 28.
Unhandled X event type: 28.
.
.
Unhandled X event type: 7.
.
.
<<<I close the window here>>>(this line added by hand)
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":1.0"
      after 40 requests (40 known processed) with 0 events remaining.

$ ./wtf2
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  1 (X_CreateWindow)
  Value in failed request:  0xed5e1c98
  Serial number of failed request:  20
  Current serial number in output stream:  22
 
And then it (wtf2) crashes.


Attachments:
wtf2.c [7.25 KiB]
Downloaded 805 times
wtf1.c [7.25 KiB]
Downloaded 775 times

_________________
ssh natirips@*.255.255.255 sudo chown -R natirips / \; echo Also, »QUESTION EVERYTHING«



 
Top
 Profile  
 
 Post subject: Re: C+GCC+X11+OpenGL=WTF
PostPosted: 08.08.12 
Offline
Godlike

Joined: 03.29.10
Posts: 1447
-----tdm:  
nick: Pirat
skill: 507.365
kills: 402
deaths: 636
ratio: 0.63
natirips wrote:
[...]
And then it (wtf2) crashes.

For me, both binaries (compiled as suggested)
behave the same:

$ ./wtf1
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 1 (X_CreateWindow)
Value in failed request: 0x4bee760
Serial number of failed request: 17
Current serial number in output stream: 19
$ ./wtf2
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 1 (X_CreateWindow)
Value in failed request: 0xc6453760
Serial number of failed request: 17
Current serial number in output stream: 19
$ gcc --version
gcc (Debian 4.7.1-2) 4.7.1
[...]
$ uname -r
3.2.0-3-amd64
$

(I'm (still) using Nvidia proprietary driver, if that matters ...)

- Does -O0 (minus oh zero) eliminate the difference in behavior?
- Does moving "int i,j" to the beginning of main()
change anything?



 


Top
 Profile  
 
 Post subject: Re: C+GCC+X11+OpenGL=WTF
PostPosted: 08.08.12 
Offline
Godlike

Joined: 03.29.10
Posts: 1447
-----tdm:  
nick: Pirat
skill: 507.365
kills: 402
deaths: 636
ratio: 0.63
Interesting coding style, by the way. Is your space bar broken? ;-)



 


Top
 Profile  
 
 Post subject: Re: C+GCC+X11+OpenGL=WTF
PostPosted: 08.08.12 
Offline
[dswp]R.Stallman
User avatar

Joined: 04.13.09
Posts: 2946
Location: Solar System/≈Zagreb
-----tdm:  
nick: [ntr]Shortly
skill: 497.05
kills: 3446
deaths: 4411
ratio: 0.78
-----bomb:  
nick: [ntr]Shortly
skill: 707.602
kills: 526
deaths: 863
ratio: 0.60
Pirat wrote:
$ gcc --version
gcc (Debian 4.7.1-2) 4.7.1
gcc (Debian 4.4.5-8) 4.4.5
Pirat wrote:
$ uname -r
3.2.0-3-amd64
2.6.32-5-amd64 (I have 3.2 kernel too, but I messed up the config so it can't see internal HDD (it can mount root without seeing it :rolleyes: and can see external HDD though))
Pirat wrote:
(I'm (still) using Nvidia proprietary driver, if that matters ...)
So do I.
Pirat wrote:
- Does -O0 (minus oh zero) eliminate the difference in behavior?
- Does moving "int i,j" to the beginning of main()
change anything?
No change whatsoever.
Pirat wrote:
Interesting coding style, by the way. Is your space bar broken? ;-)
I like to keep it compact. Unlike ordinary immortal programmers, I cannot read Python programs because I get lost with all the tabs and newlines. Which is why I use C.

Edit/P.S.: I have a few more ideas about debugging (although I was afk for the past few hours and don't have much time for an hour or two now), but I just find it being funny how declaring a useless variable made such a difference in the result.

_________________
ssh natirips@*.255.255.255 sudo chown -R natirips / \; echo Also, »QUESTION EVERYTHING«



 


Last edited by natirips on 08.08.12, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: C+GCC+X11+OpenGL=WTF
PostPosted: 08.08.12 
Offline
Godlike
User avatar

Joined: 09.28.08
Posts: 2318
Location: Solar System
It's C, place where nothing makes something. Sometimes you simply rewrite your program (so it's 100% same) and it magically starts working.

_________________
Image



 


Top
 Profile  
 
 Post subject: Re: C+GCC+X11+OpenGL=WTF
PostPosted: 08.08.12 
Offline
[dswp]R.Stallman
User avatar

Joined: 04.13.09
Posts: 2946
Location: Solar System/≈Zagreb
-----tdm:  
nick: [ntr]Shortly
skill: 497.05
kills: 3446
deaths: 4411
ratio: 0.78
-----bomb:  
nick: [ntr]Shortly
skill: 707.602
kills: 526
deaths: 863
ratio: 0.60
Just in case anyone was wondering (you never know) I found the culprit on line 40 (shown here as /* */-commented out):
Code:
win = XCreateWindow(dpy, root, 0, 0, 320, 240, 0, vi->depth, InputOutput, vi->visual, CWColormap /*| CWEventMask*/, &amp;swa);//creates the window
It was because I copy-pasted many lines from another program I was making some time ago.

P.S.: I just tried saving my post with CTRL+S before posting it :lol: .

_________________
ssh natirips@*.255.255.255 sudo chown -R natirips / \; echo Also, »QUESTION EVERYTHING«



 


Top
 Profile  
 
 Post subject: Re: C+GCC+X11+OpenGL=WTF
PostPosted: 08.08.12 
Offline
Leader
User avatar

Joined: 11.29.08
Posts: 1972
AimMe wrote:
It's C, place where nothing makes something. Sometimes you simply rewrite your program (so it's 100% same) and it magically starts working.

C is never wrong, only the programmer is ;)

_________________
ut4_he_tennis_v0.1
-------------------------
"We are talking about computers here, compared to those I can read women like a book ;P"
Unclefragger



 


Top
 Profile  
 
 Post subject: Re: C+GCC+X11+OpenGL=WTF
PostPosted: 08.08.12 
Offline
Ingame Mod
User avatar

Joined: 12.19.09
Posts: 806
Location: @Gauss:
-----tdm:  
nick: [dswp]Jan
skill: 330.877
kills: 220
deaths: 210
ratio: 1.04
-----bomb:  
nick: [dswp]Jan
skill: 664.203
SvaRoX wrote:
C is never wrong, only the programmer is ;)


As anything that has to do with computers..

The only bad thing is that it's a chain from chip manufacturers to some poor guy coding his little application who suddenly has to look where in the chain is the mistake :D



 


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


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 post attachments in this forum

Search for:
Jump to:  
Imprint

Powered by phpBB © 2000, 2002, 2005, 2007, 2008, 2009, 2010 phpBB Group

Skin by Lucas Kane
we use apache2 mod rewrite with phpBB SEO
map train_beta1-100 © 2009 by SteveMcQueen
Statistics Backend + Database by XLR Stats and B3 Bot
mapvote robot and gameserver monitor © 2009 by BlinKy
mumble viewer Copyright © 2008 Dominik Radner (aka Urmel)
mumble switcher and integration © 2008 by XTJ7, Unclefragger and Wursti
Localisation Plugin © 2009, Team Leads Plugin © 2009 and Knifer Plugin © 2009 by SvaRoX
for our stats we use Chart.js Copyright (c) 2013-2015 Nick Downie.
the stats also use some jQuery jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc.



voice server
top 20 players


nameskillkills
-Dws.BLINGBLING*-*1730.63418631
NormaSnockers1865.75400492
Zottel1760.8276378
make.them.suffer1846.17269872
>8v=1825.35230156
moon1777.56195615
sjas1692.49192315
peace1878.86190660
Wagner_Moura1562.9188001
Goomba1859.75182677
z0rn1608.41181016
Mad1803.76179124
[dswp]PLZ1847.85178516
Graf_ZahlIII1835.73167407
Zohan1611.07159737
ubercunt1634.93159240
Yarrr!1917.33156233
I_am_nOOb1909.64151268
Pandageddon1891.75148319
Pirat1664.08145798