gcc

GCC: warning on unused return [duplicate]

This question already has an answer here: how to raise warning if return value is disregarded – gcc or static code check? 7 answers Problem statement I use a return integer to propagate errors through my code. I would like gcc to provide me with a warning if I accidentally forget to propagate the error (i.e. when I forget to…
Read more

Where is the .debug_loc-section gone with recent compilers?

I’m on Ubuntu 12.04 with gdb 7.4 and gcc-4.6 and gcc-4.8 When building this simple program #include <stdio.h> int main(void) { printf(“hello worldn”); return 0; } with gcc-4.6 and then extracting debug-sections with objdump -W I see a section called .debug_loc. Not so with gcc-4.8 or later. Not luck either with clang-3.6 or later. The version of gdb on my…
Read more

Can the compiler used (gcc / llvm) to compile Python and extensions affect the performance?

BTW, for those python modules (especially C extension), some use openmp, if I use gcc with openmp to compile, I think it will be much faster? Am I right? For most cases, I think gcc does better on code optimization. However, I think use brew in OSX, it will directly give me a llvm compiled binaries. Do I need to…
Read more

How to use previous versions of g++

I am currently running a debian Jessy whose g++’s version is 4.9. For some reason I need to compile a code in g++-4.7 or previous version. I got the files of gcc-4.7 and g++-4.7 from a debian wheezy of a friend who has g++-4.7. I tried to make the apt-get install, it seemed to have worked for the gcc but…
Read more

Setting up Jail to support programming languages using Jailkit

I’m trying to make Online Compiler. As it should be protected from malicious codes, particularly one which is trying to access file system, searching for solution through StackOverflow, I’ve come across jailkit to compile and execute user-submitted codes through non-privileged user. Although, configuration file jk_init.ini by default doesn’t include paths to compilers for any language. Also, hard link to compiler…
Read more

The compiler g++ can’t create a.out file?

So, I was doing the homework for my C++ class. I was compiling for quite awhile with this statement g++-5.2.0 -std=c++14 -Wall -Wextra -pedantic <file_name> in terminal when, for some reason unbeknownst to me, I received this message: Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.. Naively, I ran the command sudo g++-5.2.0 -std=c++14…
Read more

How to detect X32 ABI or environment in the preprocessor?

X32 is an ABI for amd64/x86_64 CPUs using 32-bit pointers. The idea is to combine the larger register set of x86_64 with the smaller memory and cache footprint resulting from 32-bit pointers. It provides up to about a 40% speedup. See Difference between x86, x32, and x64 architectures on Stack Overflow, and the Debian X32 Ports wiki page for details…
Read more

ARM GCC generated functions prolog

I mentioned that ARM toolchains could generate different function prologs. Actually, i saw two obj files (vmlinux) with completely different function prologs: The first case looks like: push {some registers maybe, fp, lr} (lr ommited in leaf function) The second case looks like: push {some registers maybe, fp, sp, lr, pc} (i can confuse the order) So as i see…
Read more

clock_gettime() works well on PC but on a server it aborts compilation

I used the following function to get the execution time of a multi-threaded program: clock_gettime(CLOCK_MONOTONIC,&start); /* ******PROGRAM CODE************* */ clock_gettime(CLOCK_MONOTONIC,&end); It worked fine on my PC laptop running ubuntu 14.04, but when I try to compile and run it on a server it failed compilation giving an error. On my PC laptop: laksith@laksithPC:~/Desktop/test$ gcc main_v8.c -lpthread laksith@laksithPC:~/Desktop/test$ ./a.out On the…
Read more

Unable to use std::chrono with std::future – GLIBCXX_3.4.19 not found

I’m trying to use std::future::wait_for(std::chrono::duration) in my application (in fact, I don’t want to wait at all which makes this more frustrating, as you’ll see), but in using anything from std::chrono, I am unable to run the application after cross-compiling it for my BeagleBone Black: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.19′ not found Until I add the following lines to my code, this…
Read more