Stupid Bugs

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
Ophelius
Posts: 428
Joined: Feb 26, 2006 1:57

Stupid Bugs

Post by Ophelius »

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

Post by agamemnus »

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:

Post by KristopherWindsor »

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: 698
Joined: Oct 22, 2005 21:12
Location: Denmark

Post by h4tt3n »

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

Post by Ophelius »

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:

Post by 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.
h4tt3n
Posts: 698
Joined: Oct 22, 2005 21:12
Location: Denmark

Post by h4tt3n »

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:

Post by relsoft »

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 ||. ;*)
anonymous1337
Posts: 5494
Joined: Sep 12, 2005 20:06
Location: California

Post by anonymous1337 »

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:

Post by duke4e »

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: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

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: 1186
Joined: May 08, 2006 21:58
Location: Crewe, England

Post by jevans4949 »

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: 698
Joined: Oct 22, 2005 21:12
Location: Denmark

Post by h4tt3n »

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.
Post Reply