why XLC compiler on bluegene/q doesn't support '-qtm'? - c

I have a problem with the xlc compiler on BlueGene/q. The version of the xlc compiler is 12.1:
IBM XL C/C++ for Blue Gene, V12.1 Version: 12.01.0000.0000
According to the document1, it should support the compiler option "-qtm", which is used to enable the Transactional Memory. However, I always got the following error message:
Option -qtm is not valid. Enter xlc_r for list of valid options.
How can I figure it out? Any help is appreciated.

Are you invoking the compiler as bgxlc ?

Related

When to use -std=c11 while compiling a C source code using ubunto

I am trying to compile a C source code to a machine code using an ubunto terminal
My tutor instruction was to use the following command:
running clang myprogramm.c -std=c11
Why shall I use the keyword -std=c11 and what is the difference to using just
clang myprogramm.c
Using std= options is required by your tutor (I'm divinig her motives, I'm particularly good at this!) because she wants to make sure you stay away from all those nifty Clang features that turn the accepted language from C to A LANGUAGE SUPERFICIALLY LOOKING LIKE C BUT ACTUALLY A DIFFERENT LANGUAGE NOT SUPPORTED BY OTHER C COMPILERS.
That is more than just additional library functions. It include syntax changes that break the grammar of Standard C, as defined by ISO. A grasshopper should not use these while learning. Using -std=c11 makes sure Clang either warns about or even rejects, with an error, such constructs.
When to specify the standard? Whenever you use the compiler. It is never a good idea to let the compiler just use whatever it wants.
If someone tries to use a compiler that is too old, then they will get a warning or error, and they will understand why the compile fails.
If a code contributor (maybe even yourself!) tries to add code using features that are too new, their code will be rejected. That's very important if you intend to keep compatibility with an older standard.
By explicitly stating the standard, using new features or extensions are a choice and don't happen by accident.

Using c89 in Xcode

Is there any way to compile C code with c89 standard NOT c99 in Xcode (or another way with terminal)?
I've searched in Xcode settings but I didn't find any way to choose compiler or standard.
You should add -pedantic-errors to Other C flags in your project settings, like so:
Of course, don't forget to set the C language dialect to C89 as well.
This will give you the appropriate compile time errors when you try to compile something that is not valid C89.
Optionally, if you want Xcode to compile your code regardless of incompatibilities, but only give you yellow warnings at the problematic lines, use -pedantic instead of -pedantic-errors.
In a nutshell, these flags make the compiler stick to the language standard more strictly, as opposed to the default behavior, which is to attempt compiling the code any way possible.
I hope this helps :)
Source
(even though they mention this in the context of GCC, but the same flags apply for Clang as well)

Vim csupport; Change c compiler to clang

We required to use the CLANG compiler with the C99 standard and AddressSanitizer (ASAN) turned on, however I cannot figure out how to change these settings using the csupport plugin.
I have read the relevant sections of the help file but I'm still lost, any help would be appreciated.
Change the global variable g:C_CCompiler to clang and set the flags using g:C_CFlags
More information can be found here

How to get into C99 mode in Codeblocks10.05?

I recently realized that I am not even in C99 mode after receiving the compile error
'for' loop initial declarations are only allowed in C99 mode
I found some advice on how to get to C99 via a quick search which has told me to go to Projects -> Properties... But alas, it is greyed out and I am not sure that is even the correct way to fix it (probably not available because my file is not a project, it is a normal source file). I have also seen a lot of similar questions saying to enable C99 mode so I have looked inside the compiler flags menu, but I cannot see anything about C99. I have tried some other flags such as In C Mode, support all ISO C90 programs..., but after I set this flag, I got more errors than I had before which seem to appear whenever the compiler finds comments inside main().
Note: Please don't just say to initialize the counter outside the for loop.
Update: While trying to compile outside of codeblocks with gcc, I tried
gcc -O2 -std=C99 filename.c, but received an error:
unrecognized command line option "-std=C99"
I use 64-bit Windows 7, CodeBlocks10.05, and GNU gcc.
For future reference, type in the flag -std=c99 in settings->compiler->other options which is not case-sensitive, however when compiling in a terminal the flag is case-sensitive. Thanks chris!

alternatives to GCC 3.4.3 option -fstack-protector-all?

I'm trying to set option -fstack-protector-all in GCC 3.4.3 compiler for enabling some stack smashing protection scenarios. However when compiling with this i got error: unrecognized command line option "-fstack-protector-all"
. So seems this option isn't implemented in GCC 3.4.3 ?? or Am I missing something ?
If it is not implemented in older GCC compiler what is the best / easiest alternative to this ?
Or maybe some useful code pattern to implement stack-smashing protector in C code itself ?
Thanks
You seem to be only one minor version off a gcc version that seems to be able to provide you with this particular smash protection. I found this when googling:
http://www.research.ibm.com/trl/projects/security/ssp/
Maybe you could upgrade to that one (one minor number up) and still be compatible with your vendor?
Additionally, as at least for a number of years canary values are default set in gcc (no need to use the option you mention), have you looked at the disassembly of a simple program? If you see some storing/loading from a (gs) location near end of stack, it's already implemented.

Resources