Error building program using gcc plugin from linux kernel source tree
I am trying to use a grsecurity gcc plugin that I found on their unofficial linux kernel source tree (the respectre_plugin/ one).My GCC version is 4.7, I modified scripts/gcc-plugins/Makefile to make...
View Articlenon trivial loop unrolling
I have the following non trivial loop that does 10 iterations and stops (computes n over k)#include <stdio.h>#include <stdlib.h>int main(int argc,char **argv){ int d=1; bool f = true;...
View ArticleQt 5.1.1 compiler setup on Ubuntu
First of all, I should point out that I've never used linux before.I have a clean install of 64bit ubuntu, I downloaded Qt 5.1.1 for linux 64 bit from http://qt-project.org/downloads, ran the .run...
View ArticleSaving XMM registers to variables
Is there a C function call (I'm using gcc) that will save an XMM register to a specified __m128 variable? I'd like to avoid direct assembly if possible.The use case here is I'm writing an exception...
View ArticleHow do I ignore a particular gcc warning that's [enabled by default]?
I have the following program that prints green text to the terminal:#include <iostream>#include <string>//returns a colored string for terminal output streamsstd::string...
View Articledlib hangs when building on Google Coral dev board
I am struggling with installing latest version of dlib (http://dlib.net/, v19.17) for Python on the Google Coral Dev Board. It works well with Raspberry Pi 3 B+ (that seems to have exactly the same CPU...
View ArticleDo I need to compile the header files in a C program?
Sometimes I see someone compile a C program like this:gcc -o hello hello.c hello.hAs I know, we just need to put the header files into the C program like:#include "somefile"and compile the C program:...
View ArticleWhy does the following code compile using clang but not gcc
#include <iostream>#include <unordered_map>#include <string>struct tree_node { // tree_node() : attrib_val{"null"} {} std::unordered_map<std::string, tree_node> child;};int...
View ArticleHow can I configure Codeblocks to not close the console after the program has...
I should specify, I do not want to do the waiting for input thing or to use the debugger. I want the program to run and terminate as it normally would, but where the console window doesn't close after...
View ArticleIs there any way to extract asserts from C files?
Is there a simple way to extract the inside of the assert functions from C files?For example - assert(cred->keytab == NULL);/*assert(1==1);*/The output should be -cred->keytab == NULLI'm looking...
View ArticleMy c++ program is compiling fine, but not running . My program is running and...
My c++ program is compiling with no error. I am running my program on vscode . In the same file, when i run this code.My system:Windows 10visual studio code c++ 14#include<bits/stdc++.h>using...
View ArticleWhat is the difference between __i686.get_pc_thunk and __x86.get_pc_thunk?
These helper functions are used by GCC and Clang in 32-bit x86 position-independent code to get the current execution address into a register, for example:call __i686.get_pc_thunk.bxaddl...
View ArticleLink-time optimization and inline
In my experience, there's lot of code that explicitly uses inline functions, which comes at a tradeoff:The code becomes less succinct and somewhat less maintainable.Sometimes, inlining can greatly...
View ArticleI believe GCC is producing incorrect machine code
I am trying to compile this dead simple program:int print(int x, int y){ return x * y;}int main(){ return print(8, 7);}with this command: gcc -c -nostdinc -m32 -masm=intel main.c -O0The file produced...
View ArticleUsing of overloaded new/delete and STL in shared library
I've faced with problem which was caused by conjunction of overloaded operators new/delete and STL (especially std::string). Here's my case...I compile shared library (call it libfoo.so), in which I...
View ArticleBest Way to Make Visuals in C? [closed]
I'm trying to make a pie chart or some kind of visualization of two parts of a whole. I'm using a gcc compiler. gnuplot is a pain. Any recommendations?
View ArticleIs it a gcc -O2 optimization bug (different result from -O1)?
I write a very simple program, it behaves normal without -O2:#include <stdio.h>#include <stdint.h>int main(){ uint32_t A[4] = { 1, 2, 3, 4 }; float B[4] = { 0, 0, 0, 0 }; float C[4] = { 5,...
View ArticleFailed to compile netperf 2.7.0 using Cygwin
Not sure if this is the right place to ask this but I am having issue getting netperf 2.7.0 using Cygwin. Based on what I read, many people have success getting netperf to compile using Cygwin so I am...
View ArticleHow to bind Python to C++ code that includes Jsoncpp?
Working on a code that enables Python to call a C++ code compiled into shared library file (.so file) via Python's ctypes module, using the standard ctypes.CDLL method. The C++ code performs the...
View ArticleWhy do compilers insist on using a callee-saved register here?
Consider this C code:void foo(void);long bar(long x) { foo(); return x;}When I compile it on GCC 9.3 with either -O3 or -Os, I get this:bar: push r12 mov r12, rdi call foo mov rax, r12 pop r12 retThe...
View Article