Stupid Bugs

For other topics related to the FreeBASIC project or its community.
Ophelius
Posts: 428
Joined: Feb 26, 2006 1:57

Stupid Bugs

Postby Ophelius » Mar 22, 2010 23:05

Geez, I just spent the last 2 days looking for a strange bug that looked like it didn't have an explanation. I was pulling my hairs out because it didn't make sense. Do you know what it was? I found that a certain '>=' should have been simply a '>'.

What the longest time you've spent looking for a bug that turned out to be ridiculously simple?
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Postby agamemnus » Mar 22, 2010 23:45

In total time wasted, or from the time I noticed it to the time I finally figured out how to fix it?

In total time wasted, maybe 8 hours.
From the time I noticed it to the time I finally figured out how to fix it: months, years, even never.
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Postby KristopherWindsor » Mar 23, 2010 17:27

Yes, maybe 8 hours or so.
The problem ended up being that I was not using the thread-safe version of rtlib (-mt compiler switch), but I found the problem originally in a ~4K line program.
:o
h4tt3n
Posts: 691
Joined: Oct 22, 2005 21:12
Location: Denmark

Postby h4tt3n » Mar 23, 2010 21:30

agamemnus wrote:In total time wasted, or from the time I noticed it to the time I finally figured out how to fix it?

In total time wasted, maybe 8 hours.
From the time I noticed it to the time I finally figured out how to fix it: months, years, even never.


He he, the implicit question arising from this is how do we define "bug"?

For instance:

- Mike writes human artificial intelligence code
- Mike hits the Run button
- The code does not respond as expected
(Actually, it doesn't respond at all, no matter what Mike does to it)
- Mike concludes: "There's a bug in my code!"

See? :-)

Cheers,
Mike
Ophelius
Posts: 428
Joined: Feb 26, 2006 1:57

Postby Ophelius » Mar 24, 2010 2:03

h4tt3n: A bug in my definition is an output which isn't identical to what is expected.

The most I've spent is probably around 3 whole days(8-12 hours each) trying to find a stupid bug. It's so relieving when you find it and can move on.
duke4e
Posts: 717
Joined: Dec 04, 2005 0:16
Location: Varazdin, Croatia, Europe
Contact:

Postby duke4e » Mar 24, 2010 7:46

Sometime I need to port snippets of FB code to C. Every once in a while I forget to put == instead = and then I have "much fun" finding out what is wrong with the code.
h4tt3n
Posts: 691
Joined: Oct 22, 2005 21:12
Location: Denmark

Postby h4tt3n » Mar 24, 2010 7:48

I agree, it's a truly wonderful moment when you finally realize what's wrong with your code.

I just couldn't help giving the above example, where the "bug" would require several decades of work from an army of researchers and scientists to be solved.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Postby relsoft » Mar 24, 2010 8:34

Ophelius wrote:h4tt3n: A bug in my definition is an output which isn't identical to what is expected.

The most I've spent is probably around 3 whole days(8-12 hours each) trying to find a stupid bug. It's so relieving when you find it and can move on.


That's why there are debuggers.

BTW, debugging is where GOTO shines the most.

duke4e:

Sometime I need to port snippets of FB code to C. Every once in a while I forget to put == instead = and then I have "much fun" finding out what is wrong with the code.


Don't forget && and ||. ;*)
Pritchard
Posts: 5493
Joined: Sep 12, 2005 20:06
Location: Ohio, USA

Postby Pritchard » Mar 24, 2010 13:27

Any pointer error in a large program. By the Gods, the lines of code I've thrown out because I didn't write tests until too late.
duke4e
Posts: 717
Joined: Dec 04, 2005 0:16
Location: Varazdin, Croatia, Europe
Contact:

Postby duke4e » Mar 24, 2010 14:01

Yeah, pointers can be a real pain in the ass. Random crashes are my favorite.

Somewhat related, but really interesting and fun article can be found here:
http://www.gamasutra.com/view/feature/4 ... tricks.php
vdecampo
Posts: 2982
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Postby vdecampo » Mar 24, 2010 14:05

I find that bugs that cause crashes are easier to find than bugs that just keep a program from doing what is expected. I spent the better part of a day trying to figure out why a routine wasn't working as expected only to discover it was a bug in the EOF function. The Insight debugger is an excellent tool for identifying crash points. I would recommend it to all FB users.

-Vince
jevans4949
Posts: 1148
Joined: May 08, 2006 21:58
Location: Crewe, England

Postby jevans4949 » Mar 24, 2010 14:37

My worst one was on an airline system (peculiar IBM Asm environment) which I was unfamiliar with. Spent months looking at it, and never did figure it out.

In another job, a colleague spent weeks trying to find a bug in our multi-thread banking inquiry system (also IBM Asm). He was beginning to believe an op-code was broken on the CPU! Eventually turned out to be an unrelated module was zapping memory based on an uninitialised pointer register.

Most impressive: working on a manufacturing planning system with a built-in scripting language. I was relatively new, and sent to the client's site in Germany with the phone no. of a guru who had left the company and moved to Bangkok. He said first off to get them to print out the memory dump - which was two trolley-loads and took most of the day! This gave us some thinking time. Aftrer 3/4 of it was printed (late afternoon), I spotted the bug in the source code, and confirmed it in the disk version of the dump. Bangkok guy said: "check a couple of pages in the printout, to prove you needed it, then tell them you've solved it".
h4tt3n
Posts: 691
Joined: Oct 22, 2005 21:12
Location: Denmark

Postby h4tt3n » Mar 24, 2010 16:29

I can highly recommend the book "How not to program in C++" by Steve Oualline. It has loads of hilarious single-page code samples, none of which work as expected. There are also some really, really funny anecdotes in there.

Return to “Community Discussion”

Who is online

Users browsing this forum: wallyg and 2 guests