search -  faq -  rulez -  staff

forums






map cycle
irc              pwnalizer
voice         dswp bar




Register

Login


It is currently 05.01.25

 

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: 452.354
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 1492 times
wtf1.c [7.25 KiB]
Downloaded 1465 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: 1450
-----tdm:  
nick: Pirat
skill: 461.741
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: 1450
-----tdm:  
nick: Pirat
skill: 461.741
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: 452.354
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: 452.354
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: 301.123
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 0 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
bomb » dswp.de:22223
status: online
players: 0/24
map: ut4_casa
 
jump » dswp.de:22224
status: online
players: 0/20
map: q_derpjumps_final
 
freeze » dswp.de:22225
status: online
players: 0/32
map: ut4_casa
 
tdm » dswp.de:22226
status: online
players: 0/32
map: ut4_paris
 
tdm » dswp.de:22227
status: online
players: 0/32
map: ut4_tohunga_b10
 
btw test the new ajax serwer monitor here!
top 20 players


nameskillkills
-Dws.BLINGBLING*-*1071.72418631
NormaSnockers1155.39400492
Zottel1090.4276378
make.them.suffer1143.27269872
>8v=1130.37230156
moon1100.78195615
sjas1048.1192315
peace1163.51190660
Wagner_Moura967.849188001
Goomba1151.68182677
z0rn996.032181016
Mad1117.01179124
[dswp]PLZ1144.31178516
Graf_ZahlIII1136.8167407
Zohan997.679159737
ubercunt1012.45159240
Yarrr!1187.33156233
I_am_nOOb1182.57151268
Pandageddon1171.49148319
Pirat1030.51145798