Questions tagged [compiler-specific]

47 questions
3
votes
1 answer

Is there a C compiler flag that allows case insensitivity?

I'm just wondering, is it possible to instruct GCC (or another compiler) that I dont want case-sensitivity in my C code? If thats impossible, then another option would be to have a compiler-flag that throws an error when it finds two global…
Maestro
  • 9,046
  • 15
  • 83
  • 116
2
votes
1 answer

How does GCC optimize this `switch`

Today I discovered that GCC does some amazing magic for optimizing switches in this code: StairsType GetStairsType(uint8_t tileId, uint8_t dlvl) { if (dlvl == 0) return StairsType::Part; if (tileId == 48) { return dlvl >= 21…
glebm
  • 20,282
  • 8
  • 51
  • 67
2
votes
0 answers

g++ generating the "complete object allocating constructor"

Is there a way(an argument) to make the g++ compiler to generate the "complete object allocating constructor"(C3) and the "deleting destructor"(D0)? I loooked into this Why are C3 allocating constructors never used? , does not answer my question.
yonutix
  • 1,964
  • 1
  • 22
  • 51
2
votes
0 answers

What features does threadsanitizer lack that are supported by helgrind, and vice-versa?

Performance aside, what features does gcc -fsanitize=thread lack that are supported by valgrind --tool=helgrind, and vice-versa? Is it platform-dependent? Which detects the most critical errors? I would like to use only one if I can, since gcc…
2
votes
1 answer

'Compiling' source files consisting of headers and cpp files into one huge cpp file

How can I get the compiler, or some other tool to spit out one huge source file with the headers included into their respective *.cpp files and then shove all those into one big *.cpp source file? I have millions of lines of code and lots of mingled…
SolaGratia
  • 309
  • 4
  • 18
2
votes
1 answer

Libc name and compilers

I apologize if the question is trivial, but I have googled around and downloaded the gcc source code too without finding a satisfactory answer. So, how the compiler ( gcc/clang/etc... ) knows the file name of the libc? I know that unix-like systems…
pabloski
  • 29
  • 1
2
votes
0 answers

How to use Green Hills Multi IDE to compile Linux application

Green Hills MULTI 6.xx currently support 2 proprietary OSs, INTEGRITY and VelOSity as well as ThreadX (let's not call it an OS). Has anyone tried to use their compiler and libraries to compile apps for Linux? I went through their user manual and the…
user1906583
  • 115
  • 2
  • 9
1
vote
1 answer

Segmentation Fault on eraseFromParent() LLVM

bool runOnFunction(Function &F) override { outs() << "Inside Function: "< work; for(BasicBlock &BB : F) for(Instruction &I : BB){ if(i == 15) work.insert({i,…
1
vote
0 answers

How to get a list of all the functions called in chronological order?

Is there a way to list all the functions called while executing a program in chronological order? Using the chronological list of invoked functions, order file can be generated. I can do this with program instrumentation…
A. K.
  • 34,395
  • 15
  • 52
  • 89
1
vote
1 answer

What other compilers do I need to worry about struct packing?

In GCC, I need to use __attribute__((packed)) to make structs take the least amount of space, for example, if I have a large array of structs I should pack them. What other common compilers do struct padding, and how do I pack structs in these other…
user13874243
1
vote
1 answer

How a variable sized array in C work internally?

I am trying to understand how a variable sized static array work internally: Following is a fixed size static array in C and its Assembly equivalent; int main() { int arr[2] = {3}; } ================ main: push rbp mov rbp,…
Franc
  • 319
  • 9
  • 28
1
vote
1 answer

How many object files can I pass to a linking task?

I found this for a vanilla case of Bash on GNU/Linux, but what about other shells, other operating systems and other compilers?
1737973
  • 159
  • 18
  • 42
1
vote
0 answers

On which compilers or with which compiler flags, pointer arithmetic rule violation may cause troubles?

The c++ standard constrains pointer arithmetic to be performed within an array ([expr.add]) which makes implementation of vector-like containers difficult. One could implement a vector-like container with an implementation similar to this: //First…
Oliv
  • 17,610
  • 1
  • 29
  • 72
1
vote
0 answers

Why is MSVC compiler wierdly slower than gcc on Linux and Xcode C++ compiler on Mac

I couldn't figure out why the execution time for the following code snippet varies significantly on Windows(MSVC++)Virtual machine, Linux(GCC)virtual machine and Mac(xCode) physical machine. #include #include #include…
artecher
  • 339
  • 3
  • 8
1
vote
1 answer

Unlocking an already unlocked thread

In an already running old code, i have found a place where they were trying to unlock an already unlocked mutex. I am clear that unlocking an already unlocked mutex will lead to undefined behaviour. But my doubts are Am I able to predict the…