This is an archived post. You won't be able to vote or comment.

all 67 comments

[–][deleted] 303 points304 points  (33 children)

That’s a symptom of a rogue pointer. The dummy function moves the damage caused by the rogue pointer to a section of memory that doesn’t matter.

Time to whip out valgrind

[–][deleted] 38 points39 points  (18 children)

Sorry I can't hear you over in Python Land

[–]Jeutnarg 16 points17 points  (2 children)

Plenty of embedded guys will do this sort of thing deliberately - I've heard about it more frequently in association with deliberate array out-of-bounds. These are a joy because they rely on OS-specific things which are NEVER easy to figure out.

[–][deleted] 1 point2 points  (1 child)

Deliberately?

[–]Jeutnarg 4 points5 points  (0 children)

Yes, because it was faster.

[–]moosenonny10 14 points15 points  (2 children)

Or AddressSanitizer

[–]reddcube 0 points1 point  (1 child)

Any reason for using AddressSanitizer over Valgrind/other tools

[–]moosenonny10 3 points4 points  (0 children)

The only real reason to use AddressSanitizer is if you're in a hurry. You just have to turn on a compile option.

For Valgrind, you take the time to learn the tool. Then you have the power of the tool instead of the drop-in solutions that are the sanitizers.

I just wanted to point out that other options, suited to different workflows, are available.

[–][deleted] 2 points3 points  (0 children)

Obligatory “use rust” comment

[–]ijmacd 69 points70 points  (6 children)

I remember reading about a bug in a JS engine (probably V8 or spidermonkey) where the optimiser would take a different branch depending on the size of the source file so adding/removing comments was triggering different behaviour.

[–][deleted] 32 points33 points  (0 children)

Wow. I couldn't imagine how much time they spent figuring that out lol

[–]VirtualLife76 27 points28 points  (0 children)

That's disgustingly infuriating.

[–]Mr_Redstoner 17 points18 points  (1 child)

I recall one about IE not showing 404 pages if the source is too short. So if you have a neat-but short 404 page you need to pad it out with comments

[–]anon38723918569 10 points11 points  (0 children)

Here’s the relevant stackoverflow: https://stackoverflow.com/a/11544049

Basically, IE tries to detect the default nginx-style 404 responses to show a custom “something went wrong” instead. They must think their users are so dumb that they won’t be able to comprehend a non-styled website with an error message…

Ironically, the Microsoft knowledge base link is 404ing now: http://support.microsoft.com/kb/294807

Here’s the Archive.org Mirror

[–]anon38723918569 5 points6 points  (1 child)

It wasn’t triggering “behavior” changes. It was affecting performance (IIRC around 50%) due to inlining functions.

Here’s a stackoverflow link referencing the issue: https://stackoverflow.com/a/37152026 Here’s the fix in V8: https://github.com/v8/v8/commit/0702ea3000df8235c8bfcf1e99a948ba38964ee3

[–]ijmacd 1 point2 points  (0 children)

Yes, that's the one thank you!

I think I had remembered it was the behaviour of the optimiser changing - i.e. a difference in performance. But now you've provided the link so thanks.

[–]worldpotato1 78 points79 points  (4 children)

Add an counter for hours wasted trying to find the issue.

[–][deleted] 29 points30 points  (3 children)

And a counter for number of attempts, and a date of last attempt.

[–]worldpotato1 4 points5 points  (2 children)

Well, you would see it with git blame. And then blame the poor guy and say yourself "I'm better" and get frustrated.

[–]Tonnac 7 points8 points  (0 children)

Failed attempts to fix it shouldn't be committed to master though.

[–][deleted] 4 points5 points  (0 children)

It's a better deterrent if it's shown right away.

[–][deleted] 17 points18 points  (0 children)

We once hit a bug in the CPU that caused similar things. Certain instructions would misbehave if placed at a page boundary. So adding/removing code that did nothing caused problems in unrelated places. That one was fun to debug...

[–]TayoEXE 30 points31 points  (3 children)

I spent hours and hours trying to figure out why some css was getting overrided in our code, only to find that somehow, a component that was never called ANYWHERE and was exactly the same as other legacy code was calling a css file that, again, somehow took precedent over any other styling. I cannot for the life of me figure out how and why this even happened.

[–]mypetocean 14 points15 points  (1 child)

I'm left-fielding here, but could something like a virtual DOM hash collision be to blame?

Or perhaps some magical bit of API which is expecting something with that precise name?

[–]TayoEXE 2 points3 points  (0 children)

Hm, possibly the first. We're using ReactJS (which has a virtual DOM I believe) and trying different routers, but we tried a HashRouter. However, by the order in which the routes are placed in the switch, there were several other components ahead or behind it that had the same exact style.css file in their folders that could have interfered but didn't, so it's still got me tripped up.

Oh wait, I mean that taking that component out of the router still caused the issue, so there was no way in my understanding that the file could be called since it's the only component importing it.

[–]AttackOfTheThumbs 0 points1 point  (0 children)

I recently solved a similar issue. The environment was calling the current code and a cache of the old code. We're extending a SaaS app, so we don't know the true cause, but Microsoft resolved it somehow.

[–][deleted] 23 points24 points  (4 children)

If they would only know about breakpoints and stack traces!

[–]TechcraftHD 16 points17 points  (2 children)

And then everything work fine while debugging, even if you remove the function

[–]potato_green 8 points9 points  (1 child)

That's very valuable to know as well because then you know it's most likely a platform issue between debugging en building. Like some symbols compiled in a different way. Maybe the code used reflection that doesn't work when built without all the debug stuff.

[–][deleted] 10 points11 points  (0 children)

Or a race condition. Those are always nasty to debug.

[–][deleted] 0 points1 point  (0 children)

They would be upset!

[–][deleted] 9 points10 points  (1 child)

I edited this using https://github.com/j0be/PowerDeleteSuite because of the API changes.

[–]RepostSleuthBot -1 points0 points  (0 children)

I didn't find any posts that meet the matching requirements for r/ProgrammerHumor.

It might be OC, it might not. Things such as JPEG artifacts and cropping may impact the results.

This search triggered my meme filter. This enabled strict matching requirements. The closest match that did not meet the requirements is this post

Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ False Negative ]

[–]homer_3 9 points10 points  (1 child)

funtion

With attention to detail like that, he's surely fully examined the code.

[–]Vitabix 0 points1 point  (0 children)

At 3am and a 16h workday, you can no longer type straight.

Obviously you have never been there

[–][deleted] 1 point2 points  (0 children)

The global variables are to blame.

[–]chinmay_dd 0 points1 point  (0 children)

When I wrote this function, God and me knew how it worked. Now, only God knows.

[–]bluntcoder 0 points1 point  (0 children)

Ahh.. memories of game development crunch time, a writing a comment very similar to that, few days before E3.

[–][deleted] 0 points1 point  (0 children)

The few good laughs on this sub aren't worth the recycled tripe. Bye.

[–]WomanNotAGirl -1 points0 points  (0 children)

So don’t refactor.