Building C++ not working in OSX 10.9
Update:I solved the problem in the end by reinstalling command line tools, as shown in this link. Sorry for the trouble!Initial questionI have just upgraded to OSX Mavericks and I cannot make the...
View ArticleWhy is SSE4.2 cmpstr slower than regular code?
I'm trying to validate a string that must only contain ASCII visible characters, white space and \t.But it seems that ASCII table lookups are faster than the _mm_cmpestri instruction with...
View ArticleHow to prevent GCC from optimizing out a busy wait loop?
I want to write a C code firmware for Atmel AVR microcontrollers. I will compile it using GCC. Also, I want to enable compiler optimizations (-Os or -O2), as I see no reason to not enable them, and...
View Articlesyscall from within GCC inline assembly [duplicate]
This question already has an answer here:How to invoke a system call via sysenter in inline assembly? 2 answersis it possible to write a single character using a syscall from within an inline assembly...
View ArticleWhy GCC -Ofast makes the program wrong but only when it prints the result twice?
Recompiling an old program made it output the wrong result. I'd like to know why.I know that -Ofast may "disregard strict standards compliance" but I'm curious about what happens under the hood.I...
View Articlestrerror_s,strcpy_s,localtime_s,sprintf_s not declared in this scope?
I have written a cross-platform code gives a current date(mm/dd/yy) and time(hh/mm/ss) and complete date(yyyymmdd), This code works in windows(MSVS2015) but not working in Linux(GCC 4.8.5).My code...
View ArticleHow to invoke a system call via sysenter in inline assembly?
How can we implement the system call using sysenter/syscall directly in x86 Linux? Can anybody provide help? It would be even better if you can also show the code for amd64 platform.I know in x86, we...
View ArticleBinary Bomb phase 4 help (Reverse engineering) [duplicate]
This question is an exact duplicate of:Reverse engineering assemblyGood day. I'm struggling with phase 4 of the binary bomb. I have googled and saw a few questions regarding this phase. However, it is...
View ArticleInstalling Ta-lib creates gcc error
I am getting gcc error when trying to install Ta-lib as a global package on my mac. I get an error below: gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall...
View ArticleAddress of templated inline constexpr variable is not treated as constant...
template <typename T> inline constexpr int a = 1; static_assert(&a<void>, ""); This does not compile on gcc 9.2, but compiles on both clang and msvc.Gcc complains that the expression...
View ArticleHow to pass arguments to inline GCC/Clang assembly with Intel syntax?...
This question already has an answer here:How to pass arguments to inline GCC/Clang asembly with Intel syntax? [duplicate] 1 answerHow do I re-write this using Intel syntax?int main() { int e; asm(...
View ArticleBest practices regarding warning outputs when compiling in gcc?
I'm learning c and am compiling all my programs using gcc in linux subsystem for windows.I learned that I can include some flags by the gcc standards. Some include the basic -o or -lm. I discovered the...
View ArticleLoading a dynamic library at run-time yields inconsistent and unexpected...
I've been fighting with this problem for quite some time, and I've been unable to find a solution or even an explanation for it. So sorry if the question is long, but bear with me as I just want to...
View ArticleHow to force GCC to generate specific floating-point instructions [duplicate]
This question already has an answer here:Why does clang produce inefficient asm with -O0 (for this simple floating point sum)? 1 answerGiven the following C code, double a = 4.00; double b =...
View ArticleIn Makefiles, how to display percentage of compilation followed by compiler's...
This is a bit tricky...I want my Makefile to display progression percentage of my compilation. This is easy as long as I use tput or escaped sequences to move my cursor to modify my percentage.But if a...
View ArticleDebugging C in VS Code on Linux Mint does not work
I want to debug a C program. By clicking on "Add Configuration..." or clicking the Settings-Button, nothing happens. I recognized that the text "Activating extensions..." appears at the status bar. I...
View ArticleTranslate from cc command line to CMakeLists.txt
I want to use cmake on my project but I have to define a preprocessor macro this way :#if defined CONFIG_TEXTUI void BoardView_init (void) { } void BoardView_free (void) { } void BoardView_displayAll...
View ArticleHow to install an older version of gcc on Fedora
I tried to install CUDA on fedora 31 but got stuck at the last step because CUDA officially support fedora 29 (gcc 8.2) while the version shipped with fedora 31 is 9.2, I then installed pytorch with...
View ArticleInserting "marker" instructions into assembly without GCC reordering them
For purposes of doing performance analysis it is useful to be able to tell which line of C code goes with which line of generated assembly code. This can be very difficult once a sufficient number of...
View Articlewhat's the difference between __builtin_popcountll and_mm_popcnt_u64?
I was trying to how many 1 in 512MB memory and I found two possible methods, _mm_popcnt_u64() and __builtin_popcountll() in the gcc builtins._mm_popcnt_u64() is said to use the CPU introduction...
View Article