Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
  1. Re-read your code thorougly. Make sure you aren't doing things with side-effects in ASSERTs, or other debug (or more general, configuration) specific statements. Also remember that in a debug build memory gets initialized differently - telltale pointer values you can check here: Debugging - Memory Allocation RepresentationsDebugging - Memory Allocation Representations. When running from within Visual Studio you are nearly always using the Debug Heap (even in release mode) unless you explicitly specify with an environment variable that this is not what you want.
  2. Check your build. It's common to get problems with complex builds in other places than the actual compiler - dependencies often being the culprit. I know that "have you tried completely rebuilding" is almost as infuriating an answer as "have you tried reinstalling windows", but it often does help. Try: a) Rebooting. b) Deleting all your intermediate and output files MANUALLY and rebuilding.
  3. Look through your code to check for any potential locations where you might be invoking undefined behavior. If you've been working in C++ for a while, you'll know there are some spots where you think "I'm not ENTIRELY sure I'm allowed to assume that..." - google it or ask here about that particular type of code to see whether it is undefined behavior or not.
  4. If that still doesn't seem to be the case, generate preprocessed output for the file that is causing the problems. An unexpected macro expansion can cause all kinds of fun (I am reminded of the time a colleague decided a macro by the name of H would be a good idea...). Examine the preprocessed output for unexpected changes between your project configurations.
  5. Last resort - now you really are in compiler bug land - look at the assembly output. This might take some digging and fighting just to get a handle on what the assembly is actually doing, but it's actually quite informative. You can use the skills you pick up here to evaluate micro-optimizations as well, so all is not lost.
  1. Re-read your code thorougly. Make sure you aren't doing things with side-effects in ASSERTs, or other debug (or more general, configuration) specific statements. Also remember that in a debug build memory gets initialized differently - telltale pointer values you can check here: Debugging - Memory Allocation Representations. When running from within Visual Studio you are nearly always using the Debug Heap (even in release mode) unless you explicitly specify with an environment variable that this is not what you want.
  2. Check your build. It's common to get problems with complex builds in other places than the actual compiler - dependencies often being the culprit. I know that "have you tried completely rebuilding" is almost as infuriating an answer as "have you tried reinstalling windows", but it often does help. Try: a) Rebooting. b) Deleting all your intermediate and output files MANUALLY and rebuilding.
  3. Look through your code to check for any potential locations where you might be invoking undefined behavior. If you've been working in C++ for a while, you'll know there are some spots where you think "I'm not ENTIRELY sure I'm allowed to assume that..." - google it or ask here about that particular type of code to see whether it is undefined behavior or not.
  4. If that still doesn't seem to be the case, generate preprocessed output for the file that is causing the problems. An unexpected macro expansion can cause all kinds of fun (I am reminded of the time a colleague decided a macro by the name of H would be a good idea...). Examine the preprocessed output for unexpected changes between your project configurations.
  5. Last resort - now you really are in compiler bug land - look at the assembly output. This might take some digging and fighting just to get a handle on what the assembly is actually doing, but it's actually quite informative. You can use the skills you pick up here to evaluate micro-optimizations as well, so all is not lost.
  1. Re-read your code thorougly. Make sure you aren't doing things with side-effects in ASSERTs, or other debug (or more general, configuration) specific statements. Also remember that in a debug build memory gets initialized differently - telltale pointer values you can check here: Debugging - Memory Allocation Representations. When running from within Visual Studio you are nearly always using the Debug Heap (even in release mode) unless you explicitly specify with an environment variable that this is not what you want.
  2. Check your build. It's common to get problems with complex builds in other places than the actual compiler - dependencies often being the culprit. I know that "have you tried completely rebuilding" is almost as infuriating an answer as "have you tried reinstalling windows", but it often does help. Try: a) Rebooting. b) Deleting all your intermediate and output files MANUALLY and rebuilding.
  3. Look through your code to check for any potential locations where you might be invoking undefined behavior. If you've been working in C++ for a while, you'll know there are some spots where you think "I'm not ENTIRELY sure I'm allowed to assume that..." - google it or ask here about that particular type of code to see whether it is undefined behavior or not.
  4. If that still doesn't seem to be the case, generate preprocessed output for the file that is causing the problems. An unexpected macro expansion can cause all kinds of fun (I am reminded of the time a colleague decided a macro by the name of H would be a good idea...). Examine the preprocessed output for unexpected changes between your project configurations.
  5. Last resort - now you really are in compiler bug land - look at the assembly output. This might take some digging and fighting just to get a handle on what the assembly is actually doing, but it's actually quite informative. You can use the skills you pick up here to evaluate micro-optimizations as well, so all is not lost.
Added common debug-side-effects as first point
Source Link
Joris Timmermans
  • 9.3k
  • 2
  • 39
  • 61
  1. Re-read your code thorougly. Make sure you aren't doing things with side-effects in ASSERTs, andor other debug (or more general, configuration) specific statements. Also remember that in a debug build memory gets initialized differently - telltale pointer values you can check here: Debugging - Memory Allocation Representations. When running from within Visual Studio you are nearly always using the Debug Heap (even in release mode) unless you explicitly specify with an environment variable that this is not what you want.
  2. Check your build. It's common to get problems with complex builds in other places than the actual compiler - dependencies often being the culprit. I know that "have you tried completely rebuilding" is almost as infuriating an answer as "have you tried reinstalling windows", but it often does help. Try: a) Rebooting. b) Deleting all your intermediate and output files MANUALLY and rebuilding.
  3. Look through your code to check for any potential locations where you might be invoking undefined behavior. If you've been working in C++ for a while, you'll know there are some spots where you think "I'm not ENTIRELY sure I'm allowed to assume that..." - google it or ask here about that particular type of code to see whether it is undefined behavior or not.
  4. If that still doesn't seem to be the case, generate preprocessed output for the file that is causing the problems. An unexpected macro expansion can cause all kinds of fun (I am reminded of the time a colleague decided a macro by the name of H would be a good idea...). Examine the preprocessed output for unexpected changes between your project configurations.
  5. Last resort - now you really are in compiler bug land - look at the assembly output. This might take some digging and fighting just to get a handle on what the assembly is actually doing, but it's actually quite informative. You can use the skills you pick up here to evaluate micro-optimizations as well, so all is not lost.
  1. Re-read your code thorougly, and check your build. It's common to get problems with complex builds in other places than the actual compiler - dependencies often being the culprit. I know that "have you tried completely rebuilding" is almost as infuriating an answer as "have you tried reinstalling windows", but it often does help. Try: a) Rebooting. b) Deleting all your intermediate and output files MANUALLY and rebuilding.
  2. Look through your code to check for any potential locations where you might be invoking undefined behavior. If you've been working in C++ for a while, you'll know there are some spots where you think "I'm not ENTIRELY sure I'm allowed to assume that..." - google it or ask here about that particular type of code to see whether it is undefined behavior or not.
  3. If that still doesn't seem to be the case, generate preprocessed output for the file that is causing the problems. An unexpected macro expansion can cause all kinds of fun (I am reminded of the time a colleague decided a macro by the name of H would be a good idea...). Examine the preprocessed output for unexpected changes between your project configurations.
  4. Last resort - now you really are in compiler bug land - look at the assembly output. This might take some digging and fighting just to get a handle on what the assembly is actually doing, but it's actually quite informative. You can use the skills you pick up here to evaluate micro-optimizations as well, so all is not lost.
  1. Re-read your code thorougly. Make sure you aren't doing things with side-effects in ASSERTs, or other debug (or more general, configuration) specific statements. Also remember that in a debug build memory gets initialized differently - telltale pointer values you can check here: Debugging - Memory Allocation Representations. When running from within Visual Studio you are nearly always using the Debug Heap (even in release mode) unless you explicitly specify with an environment variable that this is not what you want.
  2. Check your build. It's common to get problems with complex builds in other places than the actual compiler - dependencies often being the culprit. I know that "have you tried completely rebuilding" is almost as infuriating an answer as "have you tried reinstalling windows", but it often does help. Try: a) Rebooting. b) Deleting all your intermediate and output files MANUALLY and rebuilding.
  3. Look through your code to check for any potential locations where you might be invoking undefined behavior. If you've been working in C++ for a while, you'll know there are some spots where you think "I'm not ENTIRELY sure I'm allowed to assume that..." - google it or ask here about that particular type of code to see whether it is undefined behavior or not.
  4. If that still doesn't seem to be the case, generate preprocessed output for the file that is causing the problems. An unexpected macro expansion can cause all kinds of fun (I am reminded of the time a colleague decided a macro by the name of H would be a good idea...). Examine the preprocessed output for unexpected changes between your project configurations.
  5. Last resort - now you really are in compiler bug land - look at the assembly output. This might take some digging and fighting just to get a handle on what the assembly is actually doing, but it's actually quite informative. You can use the skills you pick up here to evaluate micro-optimizations as well, so all is not lost.
Source Link
Joris Timmermans
  • 9.3k
  • 2
  • 39
  • 61

  1. Re-read your code thorougly, and check your build. It's common to get problems with complex builds in other places than the actual compiler - dependencies often being the culprit. I know that "have you tried completely rebuilding" is almost as infuriating an answer as "have you tried reinstalling windows", but it often does help. Try: a) Rebooting. b) Deleting all your intermediate and output files MANUALLY and rebuilding.
  2. Look through your code to check for any potential locations where you might be invoking undefined behavior. If you've been working in C++ for a while, you'll know there are some spots where you think "I'm not ENTIRELY sure I'm allowed to assume that..." - google it or ask here about that particular type of code to see whether it is undefined behavior or not.
  3. If that still doesn't seem to be the case, generate preprocessed output for the file that is causing the problems. An unexpected macro expansion can cause all kinds of fun (I am reminded of the time a colleague decided a macro by the name of H would be a good idea...). Examine the preprocessed output for unexpected changes between your project configurations.
  4. Last resort - now you really are in compiler bug land - look at the assembly output. This might take some digging and fighting just to get a handle on what the assembly is actually doing, but it's actually quite informative. You can use the skills you pick up here to evaluate micro-optimizations as well, so all is not lost.