What's this phenomenon called?

From Visual Basic to GNU C, this is the place to talk programming.

Moderators: SecretSquirrel, just brew it!

What's this phenomenon called?

Postposted on Wed Apr 03, 2013 2:54 pm

That point where you suspect the compiler/interpreter to be wrong after you've re-read your failing code (that should work) hundreds of times now.

There's gotta be a name for that.
Ryhadar
Gerbil XP
Silver subscriber
 
 
Posts: 384
Joined: Tue Oct 21, 2008 9:51 pm

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 2:59 pm

Programming?
i7 860 - GA-P55-USB3 - 8GiB - HD7850 - SSD - 3.64TB HDD - Xonar D1 - U2410 - Win7 Pro x64.
DancinJack
Minister of Gerbil Affairs
 
Posts: 2026
Joined: Sat Nov 25, 2006 3:21 pm
Location: Austin, TX

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 3:13 pm

Time to take a break.. or being a student? :) Unless you are writing a compiler/interpreter... in that case, I'd say homework..
druidcent
Minister of Gerbil Affairs
 
Posts: 2073
Joined: Wed Aug 07, 2002 7:55 pm
Location: Earth, Sol, Milky Way

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 3:31 pm

Debugger time?

Not related to the thread title: I suggest explaining your code to someone else or a duck. Works much better than staring.
Phenom II X4 @ 3600/2400 | Radeon 5850 @ 850/1250 | Samsung 830 128GB | Samsung SyncMaster T260 | Boston Acoustics A26
Orwell
Gerbil
 
Posts: 32
Joined: Wed Apr 03, 2013 3:28 pm

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 3:40 pm

Hubris? Somewhat tongue-in-cheek.
Sony a7
Sony Zeiss 55/1.8 SSM, 24-70/4 SSM
Minolta 17-35/2.8-4 D, 100-300 APO
TheEmrys
Minister of Gerbil Affairs
Silver subscriber
 
 
Posts: 2144
Joined: Wed May 29, 2002 8:22 pm
Location: Northern Colorado

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 3:48 pm

To the OP: Trust me, been through that soooo many times that now I don't really blame the compiler for my mistakes anymore :D I bet whatever's doing your head in is something so simple that you will kick yourself for overlooking it.
Igor_Kavinski
Gerbil XP
 
Posts: 309
Joined: Fri Dec 22, 2006 2:34 am

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 4:12 pm

In my field I will look at the assembly output. Sometimes the answer becomes obvious. There has been occasions where the compiler has messed up, but this is on smaller microcontrollers.
liquidsquid
Minister of Gerbil Affairs
 
Posts: 2447
Joined: Wed May 29, 2002 10:49 am
Location: New York

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 4:20 pm

Not to one up you, buuuuuuut....

Write HDL code
Simulate code
Works fine in test
Synthesize to FPGA
Does not work
Re-simulate code
Works fine in test
Simulate individual blocks
Individual blocks work fine in test
Synthesize individual blocks
Blocks work on FPGA
Synthesize full code
Does not work on FPGA
Show instructor
Instructor cannot fix
Instructor still penlizes final score
Flip table

True story.

EDIT: okay, I didn't flip the table because it was bolted to the floor.
Being an adult doesn't mean you have to know what you're doing. It just means you have to look like you know what you're doing.
superjawes
Graphmaster Gerbil
Gold subscriber
 
 
Posts: 1034
Joined: Thu May 28, 2009 9:49 am

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 6:19 pm

Uncertainty principle?
I wish to see things not as they are but as they should be.
Aranarth
Gerbil Elite
 
Posts: 603
Joined: Tue Jan 17, 2006 6:56 am
Location: Big Rapids, Mich. (Est Time Zone)

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 6:22 pm

Time to let someone else take a look at the code? Sometimes the most obvious errors just can't be seen by the writer of the code.
ChronoReverse
Gerbil Elite
 
Posts: 736
Joined: Wed Dec 12, 2007 4:20 pm

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 6:45 pm

ChronoReverse wrote:Time to let someone else take a look at the code? Sometimes the most obvious errors just can't be seen by the writer of the code.
If you don't have somebody around to look at your code, I've found that rewriting that portion from scratch (and without referring to the original code) has been an effective method of fixing these issues.
2600K @ 4.8GHz; XSPC Rasa/RX240/RX120 Phobya Xtreme 200; Asus P8Z68-V Pro; 16GB Corsair Vengeance 1333 C9; 2x7970 OC w/ Razor 7970; Force GT 120GB; 3x F3 1TB; Corsair HX750; X-Fi Titanium; Corsair Obsidian 650D; Dell 2408WFP Rev. A01; 2x Dell U2412m
mortifiedPenguin
Gerbil Elite
 
Posts: 812
Joined: Mon Oct 08, 2007 7:46 pm

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 7:12 pm

ChronoReverse wrote:Time to let someone else take a look at the code? Sometimes the most obvious errors just can't be seen by the writer of the code.

This. I've lost count of how many times I've been on both ends of:

Developer #1: "I've been trying to figure this bug out all day, think you could take a look?"

(30 second pause)

Developer #2: "Umm, WTF is this line here supposed to be doing? That doesn't look right."

Developer #1: "D'oh! Can't believe I missed that."

Your brain plays tricks on you. Sometimes you read what you *think* should be there, not what's *actually* there. And reading it over and over again just reinforces it.

This is also why the original developer of a piece of code should not be involved in the final verification testing of that code. You're unlikely to think of testing the corner cases you overlooked while writing the code; you didn't think of them the first time around, so you're probably not going to think of them when you test either.

Edit: If the code in question is reasonably self-contained and you don't mind posting it publicly I'm sure there are people here who would be willing to take a look (provided we're not doing your homework for you).

Edit 2: What language? If it is a compiled language try disabling compiler optimizations.
(this space intentionally left blank)
just brew it!
Administrator
Gold subscriber
 
 
Posts: 37520
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 7:37 pm

Good responses all. :D

I was actually the one helping someone at their wits end (for a change) and was wondering if there was a term for it.
Ryhadar
Gerbil XP
Silver subscriber
 
 
Posts: 384
Joined: Tue Oct 21, 2008 9:51 pm

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 7:42 pm

Ryhadar wrote:Good responses all. :D

I was actually the one helping someone at their wits end (for a change) and was wondering if there was a term for it.


Yep. It's called being a developer. :wink:

That said, I have actually run into occasions where the compiler was screwing things up during optimization, but it has always been for small microcontroller environments.

--SS
SecretSquirrel
Gerbil Jedi
Gold subscriber
 
 
Posts: 1686
Joined: Tue Jan 01, 2002 7:00 pm
Location: The Colony, TX (Dallas suburb)

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 7:50 pm

SecretSquirrel wrote:That said, I have actually run into occasions where the compiler was screwing things up during optimization, but it has always been for small microcontroller environments.

I've seen that a fair bit as well, but I've also seen gcc do it on x86 at -O2 and above, especially when the developer makes implicit assumptions about aliasing of values stored at the same memory location (e.g. doing a brute force pointer cast instead of using a union).
(this space intentionally left blank)
just brew it!
Administrator
Gold subscriber
 
 
Posts: 37520
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 7:55 pm

Every single time I have accused the compiler of being wrong, I have been wrong myself. So I don't even play that game anymore.
Carpe diem quam minimum credula postero
sid1089
Gerbil Team Leader
 
Posts: 290
Joined: Wed Jul 26, 2006 4:56 am

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 7:56 pm

just brew it! wrote:
SecretSquirrel wrote:That said, I have actually run into occasions where the compiler was screwing things up during optimization, but it has always been for small microcontroller environments.

I've seen that a fair bit as well, but I've also seen gcc do it on x86 at -O2 and above, especially when the developer makes implicit assumptions about aliasing of values stored at the same memory location (e.g. doing a brute force pointer cast instead of using a union).


The common factor being that the programmer is trying to make use of their knowledge of the hardware to write effecient code -- something you obviously have to do in a microcontroller. The times I've seen it on big platforms, I or someone else assumed that sizeof(void*)==sizeof(int).
SecretSquirrel
Gerbil Jedi
Gold subscriber
 
 
Posts: 1686
Joined: Tue Jan 01, 2002 7:00 pm
Location: The Colony, TX (Dallas suburb)

Re: What's this phenomenon called?

Postposted on Wed Apr 03, 2013 8:05 pm

SecretSquirrel wrote:The common factor being that the programmer is trying to make use of their knowledge of the hardware to write effecient code -- something you obviously have to do in a microcontroller. The times I've seen it on big platforms, I or someone else assumed that sizeof(void*)==sizeof(int).

The most recent one I've seen (on x86 gcc) was a developer assuming you could cast the address of an int as (float *) and use the resulting pointer to access the data at that address as a float. Works up to -O1, but breaks at -O2 and above. IIRC the culprit was the -fstrict-aliasing option (implied by -O2).
(this space intentionally left blank)
just brew it!
Administrator
Gold subscriber
 
 
Posts: 37520
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: What's this phenomenon called?

Postposted on Thu Apr 04, 2013 8:06 am

I've lost count of the number of times I've started explaining my block of non-working code to a colleague when the obvious bug has suddenly struck me. This is after I'd been staring at it for hours not seeing why it won't work.

I have found compiler bugs in the past, but they are very rare and it's always been possible to break the code down and come up with a really simple version of what is broken.

Always compile your code with -Wall -Werror, there's a reason for warnings. Others have been commenting on gcc and pointer aliasing, newer versions of gcc complain more about that than before.
notfred
Grand Gerbil Poohbah
 
Posts: 3716
Joined: Tue Aug 10, 2004 10:10 am
Location: Ottawa, Canada

Re: What's this phenomenon called?

Postposted on Thu Apr 04, 2013 8:11 am

I work in an environment with 1 other developer on a regular basis. We call each over to look at stuff when it is not working. The peer review 90% of the time we figure out our own mistakes and the other has no clue what they were looking at. There is a shift in your thinking when you are reviewing it with someone else.

The other 10% their different viewpoint finds issues with something your brain has glossed over.

That said I have had some pretty wonky compiler issues over the last 20 years. a bug search can help if you are 100% sure that it is not your code.
Arvald
Gerbil XP
Silver subscriber
 
 
Posts: 337
Joined: Tue Sep 27, 2011 12:14 pm
Location: Gerbil-land, Canada

Re: What's this phenomenon called?

Postposted on Thu Apr 04, 2013 8:46 am

Arvald wrote:I work in an environment with 1 other developer on a regular basis. We call each over to look at stuff when it is not working. The peer review 90% of the time we figure out our own mistakes and the other has no clue what they were looking at. There is a shift in your thinking when you are reviewing it with someone else.

The other 10% their different viewpoint finds issues with something your brain has glossed over.

That said I have had some pretty wonky compiler issues over the last 20 years. a bug search can help if you are 100% sure that it is not your code.

This.

Every time I find something difficult I end up calling someone over just in time to realize exactly what I did wrong and how obvious it should have been. :lol:
Z68XP-UD4 | 2700K @ 4.4 GHz | 16 GB | 770 | PCP&C Silencer 950 | XSPC RX360 | Heatkiller R3 | D5 + RP-452X2 | HAF 932 | 1 TB WD Black w/ SRT
Waco
Gerbil Elite
 
Posts: 743
Joined: Tue Jan 20, 2009 4:14 pm

Re: What's this phenomenon called?

Postposted on Thu Apr 04, 2013 10:57 am

Yeah I can't count how many times I've brought over a sample of code I've been slamming my head on the desk for hours over just to have the other dude in 30 seconds go 'uh why are you doing this part here? *points*'

"..."
"crap."
Desktop: FX-8350 | 32 GB | XFX Radeon 6950 | Windows 7 x64
Laptop: i7 740QM | 12 GB | Mobility Radeon 5850 | Windows 8.1.1.1.1 x64
SuperSpy
Gerbil Jedi
Gold subscriber
 
 
Posts: 1549
Joined: Thu Sep 12, 2002 9:34 pm
Location: TR Forums

Re: What's this phenomenon called?

Postposted on Thu Apr 04, 2013 1:01 pm

Best interview question I had...

The position was for a Project Manager role, and the interviewer was an engineer setting up a scenario about a problem the engineering team had..

He gave me some code and said this isn't working, and the team is stuck what should we do. I looked at it for about 20 sec, told them they had array indexing issues, and to fix that and get back to work :) Of course that led to some new issues, and we went back and forth on the problem for about 20 min, with the new issues getting harder for me to resolve.. Best line was when the interviewer said "Now that the engineers were thoroughly embarrassed by the project manager debugging their code in 30 sec..."
druidcent
Minister of Gerbil Affairs
 
Posts: 2073
Joined: Wed Aug 07, 2002 7:55 pm
Location: Earth, Sol, Milky Way


Return to Developer's Den

Who is online

Users browsing this forum: No registered users and 1 guest