How can I mitigate the impact of the Intel jcc erratum on gcc?

By compiler: GCC: -Wa,-mbranches-within-32B-boundaries clang (10+): -mbranches-within-32B-boundaries compiler option directly, not -Wa. MSVC: /QIntel-jcc-erratum See Intel JCC Erratum – what is the effect of prefixes used for mitigation? ICC: TODO, look for docs. The GNU toolchain does mitigation in the assembler, with as -mbranches-within-32B-boundaries, which enables (GAS manual: x86 options): -malign-branch-boundary=32 (care about 32-byte boundaries). … Read more

How to set CUDA compiler flags in Visual Studio 2010?

You can select the options for the GPU Code Generation in this dialog: In this case “compute_20” means that i am compiling for the virtual compute architecture 2.0 – virtual architecture influences the PTX generation stage. The second part that comes after the coma is “sm_21”.This influences the CUBIN generation stage. It defines the real … Read more

How do you disable the unused variable warnings coming out of gcc in 3rd party code I do not wish to edit?

The -Wno-unused-variable switch usually does the trick. However, that is a very useful warning indeed if you care about these things in your project. It becomes annoying when GCC starts to warn you about things not in your code though. I would recommend you keeping the warning on, but use -isystem instead of -I for … Read more

What are the useful GCC flags for C?

Here are mine: -Wextra, -Wall: essential. -Wfloat-equal: useful because usually testing floating-point numbers for equality is bad. -Wundef: warn if an uninitialized identifier is evaluated in an #if directive. -Wshadow: warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed. -Wpointer-arith: warn if anything depends … Read more