Questions tagged [compiler-flags]

Parameters that may be passed to a compiler affecting how compilation is carried out. These can have a variety of effects on the paths searched for external dependencies, optimization level, how source code is interpreted, code checks that are performed and preprocessor directives.

Parameters that may be passed to a compiler affecting how compilation is carried out. These can have a variety of effects on the paths searched for external dependencies, optimization level, how source code is interpreted, code checks that are performed and preprocessor directives.

479 questions
6
votes
1 answer

GCC optimization flags for matrix/vector operations

I am performing matrix operations using C. I would like to know what are the various compiler optimization flags to improve speed of execution of these matrix operations for double and int64 data - like Multiplication, Inverse, etc. I am not looking…
laxy
  • 385
  • 2
  • 10
6
votes
1 answer

Issues when using f2py module in python code

I have a FORTRAN code that required the following compile command gfortran -c interp.f -ffixed-format -ffix-line-length-none I compiled the same using f2py module in python from numpy import…
Andy Stow Away
  • 649
  • 1
  • 8
  • 17
5
votes
2 answers

Correct way to handle compiler flags when using CMake

I am struggling to find a proper way to propagate correct compiler flags for all targets. Let's imagine that there is a project which contains a library and unit tests. ProjectFolder |-WorkerLibFolder |-Worker.cpp |-Worker.hpp |-CMakeLists.txt…
NwMan
  • 187
  • 1
  • 2
  • 10
5
votes
1 answer

is there a way to obtain the same result than set compiler flags at runtime for PEFlags?

years ago i stumbled in the C0000006 external exception when running a large (100+MB) exe from a shared folder on some particular LANs. So I started using the compiler flags described in this question. After years of succesful "execution of exe" on…
UnDiUdin
  • 14,924
  • 39
  • 151
  • 249
5
votes
1 answer

What are the common problems in switching from GCC to Clang?

Suppose my C++ is standard-compliant and I don’t rely on third-party libraries, what are the usual pitfalls encountered when replacing “g++” to “clang++” in the makefile? Like incompatible compiler options, different requirement of option order,…
Leedehai
  • 3,660
  • 3
  • 21
  • 44
5
votes
1 answer

Enable stack canaries in ios swift

I was looking for a way to enable stack canaries for my ios application in swift but then i found that recent version of xcodes have the flag required to enable stack canaries is enabled by default. So then i was looking for a way to ensure the…
XiOS
  • 1,665
  • 2
  • 18
  • 22
5
votes
3 answers

What is the difference between these Kotlin compiler flags?

For some time Kotlin allowed to set kotlin.incremental=true and since 1.1.2 there is also kotlin.compiler.incremental=true. I would like to know what is the difference between these two?
Michał Z.
  • 4,119
  • 1
  • 22
  • 32
5
votes
1 answer

How to build nodejs C++ addon depending on a shared library with relative location

I'm trying to build a node.js C++ using node-gyp but can't figure out how to specify the -Wl,-rpath,$ORIGIN so that when loaded from node it could find shared object library that is in the same directory as addon.node. I have tried setting my…
Darien Pardinas
  • 5,910
  • 1
  • 41
  • 48
5
votes
3 answers

Compiler warning when a class breaks rule-of-three (five)

Is it possible to trigger compiler warning when a class breaks rule-of-three (or rule-of-five)? This feature sounds easy to implement and is very useful in safety critical software but I can't find it anywhere in documentation or Google search…
JD.
  • 455
  • 6
  • 15
5
votes
1 answer

gcc -u symbol compiler option

When do we use the gcc -u compiler option? Can you please provide an example too? https://gcc.gnu.org/onlinedocs/gcc-2.95.2/gcc_2.html Says the following: Pretend the symbol symbol is undefined, to force linking of library modules to define it.…
Chetan Dugar
  • 63
  • 1
  • 5
5
votes
3 answers

Is it realistic to use -O3 or -Ofast to compile your benchmark code or will it remove code?

When compiling the benchmark code below with -O3 I was impressed by the difference it made in latency so i began to wonder whether the compiler is not "cheating" by removing code somehow. Is there a way to check for that? Am I safe to benchmark with…
5
votes
0 answers

CMake: Enable '/arch:AVX2' in Visual Studio 2013 projects

I'm trying to enable AVX2 code-generation via CMake on my Visual Studio 2013 projects and so far, I'm out of luck. Things I've tried are: Set CMAKE_CXX_FLAGS_* to include /arch:AVX2 like so: SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}…
Vite Falcon
  • 6,575
  • 3
  • 30
  • 48
5
votes
1 answer

-fno-exceptions for some libraries?

This is somewhat similar to "Disabling C++ exceptions, how can I make any std:: throw() immediately terminate?." I would like my program to terminate whenever an exception is thrown out of the STL. The problem is as follows: I am writing a library…
niklasfi
  • 15,245
  • 7
  • 40
  • 54
5
votes
2 answers

How to overrule default gcc options to the linker?

On my system when I compile something (with bfin-linux-uclibc-g++ but that is irrelevant), I get hundreds of warnings (not in my own code base) with respect to one of the compiler flags. I want to disable it. fde encoding in…
Anne van Rossum
  • 3,091
  • 1
  • 35
  • 39
5
votes
0 answers

Program segfaults when compiled with clang but not gcc

Summary: When I set the -mcmodel=large flag when compiling with clang my application segfaults when accessing thread local storage. This does not happen when compiling with gcc. Is this a bug with clang or something I am doing wrong? Details: The…
Gabriel Southern
  • 9,602
  • 12
  • 56
  • 95