GCC 10.1 Compiler is acting strange [closed]
I have a feeling the GCC 10.1 compiler is acting strange, as it ignores the comments I write. Any suggestions?
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 ArticleHow can I compile C program to 32bit elf64?
I want to achieve a similar effect as assemblying a program with nasm -f elf64 that uses BITS 32 directive.Such a code:BITS 64mov eax, 0xamov edx, 0xfimul eax, edxretassembled with this command looks...
View ArticleHow to visualize the pointers in the code snippet?
I am finding it difficult to visualize this piece of code. I cannot seem to find the ans to this.I did get the ans forprintf("**r = %d\n",**r);printf("**s = %d\n",**s);but other variables are not...
View Articleclang (LLVM) inline assembly - multiple constraints with useless spills /...
clang / gcc : Some inline assembly operands can be satisfied with multiple constraints, e.g., "rm", when an operand can be satisfied with a register or memory location. As an example, the 64 x 64 = 128...
View Articleclang/ARM assembly - Misinterpreted absolute branch
I am working on a project where code is linked into an existing, statically linked binary. Thus code like this with absolute branches is necessary:.arm.globl TestThunk TestThunk: mov r0, #0 b...
View Articlegcc won't create executable file on linux terminal [Solved] [closed]
I am trying to create an executable file from multiple C source files on linux terminal using gcc. I managed to create the object files but the executable file won't show up. This is what I have been...
View ArticleGCC behaves differently on Arch Linux
I'm a newbie in Arch Linux. I've tried to compile IRAF package from github and I've got multiple definition error./usr/bin/ld: xppcode.o:/home/nastya/iraf/unix/boot/spp/xpp/xppcode.c:109: multiple...
View ArticleError installing python-snappy: snappy-c.h: No such file or directory
I am using amazon ec2 ubuntu 11.04 server sudo pip install python-snappy also I tried to downloaded package and entered "sudo python setup.py install"I got the error: running build running build_ext...
View ArticleHow does free () frees memory when 0 is encountered?
I have a question, about C-function free().What will happen, if first I'll allocate memory for char-string, then past '\0' to any position of the string and set the new pointer to the next after '\0'...
View ArticleDifference between gcc warnings and gcc error messages
I was compiling this code snippet in code-blocks without any messages at all: printf("adress of x %i\n",ptr);Now I try to compile this via terminal and gcc but I get this message: warning: format ‘%i’...
View ArticleGCC optimizer generating error in nostdlib code
I have the following code:void cp(void *a, const void *b, int n) { for (int i = 0; i < n; ++i) { ((char *) a)[i] = ((const char *) b)[i]; }}void _start(void) { char buf[20]; const char m[] =...
View ArticleWhat's the difference between the .asciz and the .string assembler directives?
I know that the .ascii directive doesn't put a null character at the end of the string, as the .asciz directive is used for that purpose. However, I don't know whether the .string directive puts a null...
View Articlegcc inline x86 asm code producing garbage results
This program takes two input integers and produces x^y and prints in the main; the actual computation is inline x86 asm (at&t). Can any of you say why garbage is getting loaded in the registers and...
View Articlegcc: "cannot find -lasound" when compiling on Windows
I am compiling a C++ program on Windows. The program uses the SDL2 library. I run the following pkg-config command to obtain the correct flags to pass to the GCC compiler.$ pkg-config sdl2 --cflags...
View ArticleHow to show 'preprocessed' code ignoring includes with GCC
I'd like to know if it's possible to output 'preprocessed' code wit gcc but 'ignoring' (not expanding) includes:ES I got this main:#include <stdio.h>#define prn(s) printf("this is a macro for...
View ArticleQuestions about assembly code generated from C code by GCC 7.5 [duplicate]
I have a simple C code to generate assembly code via GCC 7.5:void swap(int* a, int* b){ int c; c = *a; *a = *b; *b = c;}int main(){ int a = 16, b = 32; swap(&a, &b); return 0;}I use this...
View ArticleHow do canary words allow gcc to detect buffer overflows?
I could test using strncpy() with larger source string then the destination:int main() { char *ptr = malloc(12); strcpy(ptr,"hello world!"); return 0;}Compiling with the flag -fstack-protector and...
View ArticleWhy is gcc generating an extra return address?
I am currently learning the basics of assembly and came across something odd when looking at the instructions generated by gcc (6.1.1).Here is the source:#include <stdio.h>int foo(int x, int y){...
View ArticleIs there a compilation option to stop gcc using floating point instructions...
My integer-only, bare-metal C project just ground to a halt when I got an unexpected exception about a floating point instruction.Looking at the gcc generated code, the culprit is an fmov d0, x0, used...
View Article