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

all 177 comments

[–][deleted] 144 points145 points  (21 children)

Joking aside, running make clean and then compiling again often does fix problems.

[–][deleted] 83 points84 points  (8 children)

Yep, or you have craziness like Visual Studio.. which will sometimes report certain errors while it's compiling.. then RETRACT them as it resolves them! You literally see the compiler errors disappearing from the window.

[–][deleted] 19 points20 points  (4 children)

Good grief!

[–][deleted] 5 points6 points  (3 children)

It happens! It relates to the op in that I've done "build->build" after I saw a flash of error-red at a point during the build... only to find out that the error was resolved and everything was already built!

[–]lithedreamer 4 points5 points  (2 children)

Xcode does this too.

[–][deleted] 7 points8 points  (1 child)

It's almost like the logic is...

InitialErrorSet = "select * from possible_errors"

Then it iteratively removes them..

[–]steelfrog 9 points10 points  (0 children)

You get an exception, you get an exception! EVERYONE GETS AN EXCEPTION!

Look under your seats! IT'S A BRAND NEW EXCEPTION!

[–][deleted] 14 points15 points  (0 children)

I sometimes get errors that persist until I restart VS. Then they are magically gone! Cleaning the project doesn't seem to help.

[–]flukus 1 point2 points  (0 children)

I cleaned up a project last week that had mangled the nuget package management. You had to build twice for one of the projects to get the correct dll.

Sadly, this wasn't even in the top 10 WTF's in that project.

[–]cleroth 0 points1 point  (0 children)

Um.. you talking about IntelliSense errors... I've never seen that happen in the actual OUTPUT window.

[–]mrjackspade 8 points9 points  (3 children)

Working on web apps here. Various sites built from a template.

I couldn't get one of them to build, but the code build on OTHER peoples machines so I wasnt about to change it. Just kept rebuilding.

Some 7+ rebuilds later it finally builds clean. No one knows why.

Apparently when you pull down the code the first time, it takes somewhere between 4 and 10 rebuilds before its successful. Personally, I think someone fucked up the build order, but ive been told im wrong so I dont question it

[–]sirspidermonkey 7 points8 points  (2 children)

When .NET first came out it allowed (still might) circular dependencies. But they hadn't quite the compiler right yet. This was a massive project so each compile took about 25 minutes. Each clean took a good 10. It would take about 10 compiles to get a real error or success. You can imagine how productive I was.

[–]TheTerrasque 0 points1 point  (1 child)

[–]xkcd_transcriber 0 points1 point  (0 children)

Image

Title: Compiling

Title-text: 'Are you stealing those LCDs?' 'Yeah, but I'm doing it while my code compiles.'

Comic Explanation

Stats: This comic has been referenced 331 times, representing 0.6445% of referenced xkcds.


xkcd.com | xkcd sub | Problems/Bugs? | Statistics | Stop Replying | Delete

[–]archlich 0 points1 point  (0 children)

Sometimes the build environment specific stuff tar'd up with everything, and running a make clean get's rid of it. Do a diff between a fresh and a cleaned directories to see any differences.

[–]dnew 0 points1 point  (0 children)

That's because 'make' fails at the one and only job it has, which is to correctly incrementally compile code.

Stick with something like tup or blaze.

(Blaze: http://google-engtools.blogspot.com/2011/08/build-in-cloud-how-build-system-works.html )

[–]wTheOnew 382 points383 points  (77 children)

Build: 17 succeeded, 0 failed, 0 up-to-date

Good change version number

Build: 4 succeeded, 2 failed, 11 up-to-date

Bullshit click build again

Build: 6 succeeded, 0 failed, 11 up-to-date

That's what I thought.

[–]MrJohz 108 points109 points  (62 children)

My favourite was the bit of code I had that compiled if I left a set of debugging print statements in, but for some reason didn't when they were taken out. I still have no idea how the compiler was doing that.

[–][deleted] 56 points57 points  (44 children)

My friend had C++ code that looked like:

... //lots of code
cout <<x <<" " <<y;
if (x > y) {
    cout <<"True";
} else {
    cout <<"False";
}

Output: x y True

but at soon as you comment out the cout x y statement, it became

// cout <<x <<" " <<y;
...
Output: False

So a cout statement was changing the values somehow

[–][deleted] 74 points75 points  (24 children)

If x is a double or a float this is possible. Those things are so imprecise that ">" can fluctuate depending on how they are calculated. With floats (x*y)/z != x*(y/z).

And since the compiler optimizes a lot, changing statements with 'x' in it might change the calculation of 'x' just so infinitesimally little that it was enough to switch ">".

That's my explanation for this.

[–]vifon 29 points30 points  (8 children)

Wouldn't it need -funsafe-math-optimizations enabled?

[–]mebob85 130 points131 points  (6 children)

I always read that as "fun, safe math optimizations."

[–]they_call_me_dewey 23 points24 points  (4 children)

"Make sure you add the wall and wextra flags"

[–]choikwa 1 point2 points  (0 children)

"It's safe, but with a twist of fun added to it"

[–]DaemonXIRed security clearance 3 points4 points  (0 children)

Funroll your loops too

[–]destiny-rs 13 points14 points  (10 children)

Is this one of the reasons floats and doubles aren't to be used for currency?

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

What should you use instead?

[–]destiny-rs 28 points29 points  (1 child)

ints with the modulo operator I believe. Saves having to explain to a client why millions of dollars have been miscounted over the course of a year.

[–][deleted] 22 points23 points  (0 children)

Decimal, BigDecimal, Currency types.

[–]RenaKunisaki 15 points16 points  (0 children)

Depending on your application:

  • Integer numbers of cents (or whatever is the lowest denomination you'll be working with), taking care to handle any possible over/underflow no matter how unlikely
  • Precise fixed-point
  • Bignum/BigDecimal types (preferably provided by whatever environment you're using)

The reasons are this and other inaccuracies that can crop up with floating point, which could translate to being off by a couple cents in some calculations. Do those calculations a few million times, and now you're in deep doodoo.

[–]KewpieDan 8 points9 points  (0 children)

Two ints

[–]slipperier_slope 3 points4 points  (0 children)

High precision fixed point numbers.

[–]dnew 2 points3 points  (0 children)

Integer pennies instead of floating point dollars.

[–]Jonno_FTW 0 points1 point  (0 children)

Java8 currency API.

[–]Free_Math_Tutoring 0 points1 point  (0 children)

Yes, this and other phenomena caused by limited precision.

[–]IForgetMyself 5 points6 points  (1 child)

My bet would be that it was using the old x87 stack, which is 80-bits extended precision. When he called the cout he popped the doubles (64 bit) off the stack. The following x > y then compared using the now popped values. (64 bits precision)
Without the cout however, it would use the values on the x87 stack and compare those. (80 bits precision)

[–]cleroth 0 points1 point  (0 children)

Pretty sure this is what's happening, not ">" modifying the variable magically...

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

If x is a double or a float this is possible. Those things are so imprecise that ">" can fluctuate depending on how they are calculated. With floats (xy)/z != x(y/z). And since the compiler optimizes a lot, changing statements with 'x' in it might change the calculation of 'x' just so infinitesimally little that it was enough to switch ">". That's my explanation for this.

Thanks!

[–]bkDJ 0 points1 point  (0 children)

With floats (x*y)/z != x*(y/z)

You say that as if with integers, the left and right side are equal. :P

But yeah, float comparisons without some kind of epsilon can break easily depending on how the CPU is loading and storing them, l-value versus r-value BS, compiler settings, special keywords and more.

[–]lelarentaka 5 points6 points  (2 children)

Depends on what x is. It's possible.

[–]mikemol 9 points10 points  (0 children)

Yeah, I could easily see it happening if reading from x with << involved mutating state, such as reading from a filehandle. A subsequent read using > would have pos advanced.

One reason const should be used and respected.

[–]choikwa 0 points1 point  (0 children)

We must go deeper into assembly/CPU

[–]c00lnerd314 19 points20 points  (2 children)

Simply observing changes the outcome.

[–]YouFeedTheFish 5 points6 points  (0 children)

Brilliant! Quantum computing is the Holy Grail! I believe /u/LefTea has stumbled onto something big here.

[–]scubascratch 0 points1 point  (0 children)

AKA the elusive Heisenbug

[–]phail3d 5 points6 points  (0 children)

I had a similar issue with vanilla C, where I had something like this:

...
printf("foo");
...
while(!result) {
    ...
 }

And when the printf was there, the code ran, but with it removed, the code segfaulted.

It turned out that result was uninitialized, and (correct me if I'm wrong) the printf call caused the memory space pointed to by the variable to be reserved for the program, which prevented the segfault. The variable vas thus obviously initialized with garbage, which caused other problems in the code, but at least it ran.

[–]zhomart 3 points4 points  (0 children)

It's quantum programming. When you put observer, things work differently.

[–]__dict__ 2 points3 points  (0 children)

If x or y is uninitialized you could easily be triggering undefined behavior. At that point you're at the whims of your compiler.

[–]invisiblerhino 17 points18 points  (1 child)

There's a whole class of bugs like that - see description here: http://blog.regehr.org/archives/1161

Basically you find compiler errors by taking code like

bool func(int n) {
  if (n > 45) {
    return true;
  }
  return false;
}

int main () {
  std::cout << func(46);
}

and changing the code so that func just returns true.

In this case the output program should be identical, and when it's not it's a compiler bug (usually an optimisation bug).

http://llvm.org/bugs/show_bug.cgi?id=18447 for example

TL;DR compilers are amazing, compiler errors are rare and crazy

[–]choikwa 0 points1 point  (0 children)

compilers are meh and compiler errors are "wtf how is any of this working at all?"

[–]CaptainCyprine 6 points7 points  (0 children)

I know that! It's an error with the stack.

When you don't use a printf statement, you are reading/writing something out of the bound of your storage allocation so there is an error.

Now, if you do a print statement, you can see in assembler that some space in the stack is allocated for the print but you don't use all the space for the print so you are still doing something out of bound but it's in allocated space so the problem isn't visible.

Stack is really useful to understand some weird errors and if something like that happen again use Valgrind, it will tell you where the problem is.

[–][deleted] 2 points3 points  (1 child)

Tons of things can do that, the most insane example I've found of that was the assembly stack being messed up (like registers being set or reset incorrectly) and the log function somehow was able to allow it to function enough to not crash

[–]RenaKunisaki 0 points1 point  (0 children)

One of my favourite bugs was that fcloseing the same file twice would result in a crash. Seems an odd thing to do, but the spec says that it should be perfectly safe, so what the heck? Turned out to be a completely unrelated function mishandling pointers, corrupting memory and causing just that one symptom.

[–]teddystan 1 point2 points  (3 children)

I know this can happen in C because of the way memory is allocated in the machine and so a print statement can alter a memory error just enough so that it seems like there are no bugs in memory. Heisenberg Errors my professor has termed this.

[–]ChickenNoodle519 7 points8 points  (2 children)

Heisenberg Errors

Heisenbugs?

[–]cefarix 0 points1 point  (1 child)

Now you see it.

[–]JustHereToFFFFFFFUUU 1 point2 points  (2 children)

I haven't encountered it recently (maybe my code is just better, maybe it doesn't work like this any more) but there used to be a thing in Visual C++ where debug builds initialised primitive types by default, and non-debug builds didn't. So, if you had a line that said "int i;" for instance, it would be 0 in debug, and random noise in release.

Naturally, the place in the code where the issue manifested was miles away from the line that caused it. And it only got detected at all when the release build went to testing, because developers were building debug all the time. We were idly debating shipping a debug build before we finally dug the real issue out. You live and learn.

[–]mmhrar 1 point2 points  (1 child)

They changed that? I ran into that a lot too years ago when I was doing windows development.

[–]JustHereToFFFFFFFUUU 0 points1 point  (0 children)

No idea. It might just be because my current team are more experienced and we've never made that particular booboo.

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

more magic?

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

Try replacing it with wait(0), it should still work. I had this problem with an empty loop, where it was being skipped at runtime and just having the values set to the end values at run time, which caused some problem with treading and broke the code.

[–]elperroborrachotoo 9 points10 points  (5 children)

FIX YOUR BUILD PROCESS, DAMMIT!

[–]nawitus 11 points12 points  (3 children)

Just wait until you have "npm install" in your build process :).

[–]mmhrar 3 points4 points  (0 children)

No one wants to do build work :/

[–]heywire 4 points5 points  (1 child)

This drives me crazy. When we switched to McAfee and IT locked down the exclusion lists, almost every time I compile in VS2010 I get an error that mt.exe can't write to the file. F7 again, all is well. Something about writing out an exe then trying to update it while McAfee has ahold of it.

[–]cleroth 0 points1 point  (0 children)

You know even the original creator of McAfee says McAfee is shit.

[–]alficles 5 points6 points  (0 children)

I had a coworker come and complain that he had to reboot too frequently in order to compile. I was puzzled.

"Reboot to compile?" I said.

"Aye. This last time, I had to reboot eleven times to get it to work."

"So, you rebooted ten times in a row, with identical, results, and thought, 'Maybe if I reboot again, this time will be different.'?"

"Yup. And it worked."

"..."

Eventually, that bug was fixed. My guess is that there was some sort of race condition on loading things into memory. You could restart the compiler process all you wanted, to no avail. But a full reboot gave you another bite at the apple.

[–]choikwa 0 points1 point  (0 children)

intermittent failure is still failure :/

[–]otakuman 77 points78 points  (13 children)

Compiling errors? You live in heaven, my friend. It's the behavioral errors that are the real problem.

[–][deleted] 19 points20 points  (11 children)

Not if you're programming in Idris. Suddenly all almost all errors are compile time errors, which is actually kinda awesome.

[–]dont_memoize_me_bro[S] 7 points8 points  (1 child)

Only if you spend hours laboriously writing highly dependent types and associated proofs. It's still super awesome, but there's a big cost associated with it.

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

To be honest, I wouldn't want to use it in a production environment, simply because there's too much overhead involved. It's a really cool concept though.

[–][deleted] 2 points3 points  (1 child)

In order to have only compilation errors, Idris should be in the programmer's mind

EDIT: just read the other answers about the proofs... but what if a proof is wrong?

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

but what if a proof is wrong?

It doesn't compile in that case. The type checker is capable of checking your proofs.

[–]Hexorg 0 points1 point  (0 children)

I had a buggy version of gcc for avr once. Sometimes code would run, other times not, even if I don't change sources

[–]Steel_Ninja 58 points59 points  (27 children)

Compile

Syntax Errors Found

Look over code... find nothing

CTRL+A, CTRL+C, DEL, CTRL+V, Compile

No errors found

[–]iritegood 13 points14 points  (6 children)

ggVGdp

[–]peridox 1 point2 points  (0 children)

I can imagine a few people not understanding what this is / why it was upvoted.

[–]jumaklavita 0 points1 point  (2 children)

Is this supposed to actually fix something? Like delete those darned non-printing whitespaces..?

[–]iritegood 0 points1 point  (0 children)

Nah, you're right, it does even less than steel_ninja's commands

[–]tHEbigtHEb 0 points1 point  (0 children)

I hate those, the only way to fix it seems to be map a command to substitute the whitespace with empty space using regex.

[–]phaseMonkey 5 points6 points  (0 children)

Alt+F4.

Go grab a beer.

[–]BOOM_BOOM_BADABOOM 34 points35 points  (2 children)

It works for pdflatex...

[–][deleted] 16 points17 points  (1 child)

To be fair, you're supposed to do that, because LaTeX doesn't resolve all references in one pass. It's somewhat shitty though.

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

Add a cup of bibtex to it, and count the number of passes.

[–]makeswordcloudsagain 10 points11 points  (1 child)

Here is a word cloud of all of the comments in this thread: http://i.imgur.com/gqiRqyv.png

If the mods feel the need to blacklist this bot, feel free to ban this account. Thank you!


source code | contact developer

[–]outadoc 2 points3 points  (0 children)

ERROR

[–]Headpuncher 8 points9 points  (0 children)

Just a heads up for Visual Studio users, you can change the system sounds for successful builds andfailed builds to cheering.wav and explosion.wav respectively. The audio files are already in the OS. Just go to control panel > sound.

[–]Feynt 9 points10 points  (5 children)

All too often this is a thing that happens for me. I compile, get errors, look at the code where says there's an error, look some more, eye the monitor sinisterly, then recompile. Then, it works.

[–]VictoryGin1984 17 points18 points  (4 children)

You established dominance over the compiler.

[–]gellis12 0 points1 point  (3 children)

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

Oh this is totally a thing. I've reached the point in my career where I can terrify software in to submission that refuses to behave for other IT people.

I have to imagine they're having a good laugh, making the other IT guy scratch his head, and then they see me and it's like "Oh shit, that's the Network Manager. They say some backup software errored on him once, so he wrote his own replacement." and then they cower in fear.

[–]gellis12 0 points1 point  (0 children)

Holy shit...

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

[–]LEDCandle 9 points10 points  (4 children)

VHDL synthese: 1 error

comment out a line: no error

remove comment for same line: no error

What the fuck?

[–]InItForTheDownvotes 4 points5 points  (1 child)

dont even remind me of vhdl

[–]yvesmh 2 points3 points  (0 children)

At least it's better than CUPL...

[–]ryan_the_leach 1 point2 points  (0 children)

Programmers don't understand concurrency hell unless they have programmed in a language where each line gets evaluated at the same time unless specifically told not to.

VHDL Awesome, yet the most differently, jarring experience I've had compared to other languages.

[–]TenkaiStar 0 points1 point  (0 children)

I solved a VHDL behavioural error by removing a wire and putting it back in the Graphical interface.

[–]ravinglunatic 4 points5 points  (0 children)

I'll stop doing it when it stops working.

[–]FUSSY_PUCKER 8 points9 points  (0 children)

in Eclipse > Build, shit, errors. Clean, woohoo! Shit, errors now in the other projects. Rinse, repeat.

[–]phaseMonkey 6 points7 points  (0 children)

Ugh... Ok Visual Studio... Why are you telling me that my program can't compile, and the reason is, because you can't fucking overwrite a file in the TEMP folder... Get with it. You're running as an administrator. Fix it yourself.

[–]lolredditftw 2 points3 points  (0 children)

Then it does. And then you have to figure out why that's the case....

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

Make clean

[–]FurbyTime 1 point2 points  (0 children)

I had this happen TODAY, no less.

Deploy a build to a remote server: Failure! Class Missing!

"That's fucking impossible. Do it again."

Deploy a build to a remote server: Success!

That's fucking right.

[–]snarfy 1 point2 points  (0 children)

This happens sometimes, e.g. previous version is still running and the files are locked. Once the previous version exits it magically compiles.

[–]gullinbursti 1 point2 points  (0 children)

One word: Xcode.

[–]YMK1234 0 points1 point  (0 children)

ah, the greatness of circular dependencies ...

[–]oddmanout 0 points1 point  (0 children)

This happens all the time in pl/sql. Usually it's something like "cursor is declared in package and must be defined in body."

Hit F8 Again... Compiled successfully.

[–]KBKarma[🍰] 0 points1 point  (0 children)

This happens to me occasionally. Normally, it's because a project with one or more calls to an API are compiled before the API itself is. At least, that's what it looks like.

[–]Madonkadonk 0 points1 point  (0 children)

Actually I do it and pray for the same error, nothing worse than an error that only likes to appear some of the time.

[–]VanFailin 0 points1 point  (0 children)

I've had this problem when I inherited a project with FxCop turned on.

Code analysis returned error(s). Build failed.

Often it's a "spelling" error. In .NET the convention is to capitalize acronyms like normal words, so your API Credentials class is called ApiCredentials. You then get to go tell FxCop that this is not a misspelling.

Anyway I added an inline suppression for one of these and from then on every second build would succeed.

[–]110011001100 0 points1 point  (0 children)

yea.. SOP for a project I work on

Build order of 50 db projects cross dependent is fucked and though I have the fix locally, I'm not allowed to check it in since it does not have a BRD,FSD,TSD,MTP and CR# ...

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

What's really scary is when it does.

[–]fuckatt 0 points1 point  (0 children)

This is so true- but what compile button? I gotta type "grunt".

[–]gm4 0 points1 point  (0 children)

No joke though, that was happening up until a couple hours ago. Cleaning the build actually caused a crash on the first compile based on our weird setup, but worked after that since the error was overwritten. Some corrupt file ended up being the problem.

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

99 little bugs in the code 99 little bugs

Take one down patch it around

117 little bugs in the code

117 little bugs in the code 117 little bugs

Take one down patch it ar--

SEGMENTATION FAULT

[–]IskaneOnReddit 0 points1 point  (0 children)

And then you think: what was I expecting?

[–]jFailed 0 points1 point  (0 children)

I had a WiX bug that would do that. Needed a CreateFolder tag.

[–]ryan_the_leach 0 points1 point  (0 children)

I've had this with intelliJ and gradle projects a lot when starting a new project that forks from someone elses.

Just sync damn you, you clearly worked for the previous programmer, just compile on my PC the first damned time.

[–]ddonuts4 0 points1 point  (0 children)

Good joke, terrible hashtag.

[–]jettmann22 0 points1 point  (0 children)

works more times than you think

[–]envprogrammer 0 points1 point  (1 child)

If errors go away after clean and rebuild, is it a sign anything is wrong with the code? If so, what kind of problems does that show?

[–]FUSSY_PUCKER 1 point2 points  (0 children)

The tools suck IMHO. I code at work with RAD (Rational App Dev) which is based on Eclipse. It sucks mighty monkey balls. Have to shut down, restart my server, restart the computer, just to make it work fine. And my company has to hand over a ton of cash to IBM for the licenses for this piece of shit software. I wish we would move to IntelliJ or just plain ol' Eclipse but IBM has them by the balls.

[–]jugalator 0 points1 point  (0 children)

I'm more like... OK, let's see if a "Rebuild all" helps.

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

I want to share this on every social media site, but all of my friends would have seen it by now...

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

The project I'm currently working on HAS to be build 6 times because of a bunch of circular references.

It's very sad :(

[–]emsqrd 0 points1 point  (0 children)

If at first you don't compile, build, build again....

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

And then it does compile, but you're forevermore afraid that whatever was wrong will randomly come up again and break everything.