Error when compiling - unknown field specified in initializer
I have found an old script written in C and when I try to compile it I get the following message # gcc libipt_rope.c -o libipt_rope.solibipt_rope.c:349: error: variable ‘rope’ has initializer but...
View ArticleStructured binding initializer form { assignment-expression } fails for array...
[dcl.dcl]/1 (final C++17 draft, N4659) describe the grammar of a simple-declaration as:[...]simple-declaration: - [...] - attribute-specifier-seq(opt) decl-specifier-seq ref-qualifier(opt) [...
View ArticleMem alloced via mmap without munmap will cause leak after process exits or...
there is the code about alloc mem via mmapvoid *ret = mmap(NULL, 4 * 1024, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);when process exits normally, the memory will be return to os ?
View ArticleThis code snippet is storing the value of input with a '\n' which is not...
I am trying to match the input of a string by user with that of the string from a file. But there are two things that is not happening the right way.typedef struct{ int yyyy; int mm; int dd;}...
View ArticleFormat of linker map file
I have generated linker map file from gcc for my C code. Where do I find the format of the .map file so I can exactly figure out what is in there instead of guessing it.I couldn't find any reference or...
View ArticleHow does gcc choose to number temporary variables from -fverbose-asm?
Having this simple c:#define _XOPEN_SOURCE#include <stdio.h>#include <stdlib.h>#include <alloca.h>int main(){ char *buf = alloca(600); snprintf(buf,600,"hi!, %d, %d, %d\n", 1,2,3);...
View ArticleForce linker to include a section in the binary
I'm instrumenting my program with a custom compiler instrumentation pass. The compiler adds a global variable in each module. All the global go to a particular section (_prof_global). For each module i...
View ArticleIs there an x86 instruction to create a core dump?
General question that I would like answeredI have some x86 assembly code that I'm trying to debug. I'd like to get a core dump so I can inspect what is going on. Is there an x86 instruction (or set of...
View ArticleWhat does __builtin_unwind_init () do in libgcc unwind library?
This is for educational purpose. I have been exploring the stack unwinding mechanism and the source code of the unwind library in libgcc. I came across this function and I can't find a definition for...
View ArticleUsing __builtin_extract_return_addr() function to find the RSP value of ret...
I have recently been trying to use the __builtin_extract_return_addr function described here (https://gcc.gnu.org/onlinedocs/gcc/Return-Address.html) to obtain the encoded value of the RSP pointer. I...
View ArticleCommand clear won't take kill signal ( in infinite loop | c program )
I used the command "clear" in C language at infinite loop just for test and the kill signal does not stop it.Why the program does not stop when i press Ctrl+C ?#include <stdlib.h>int main () {...
View ArticleHave some troubles to use lib installed with vcpkg in vscode and gcc
I'm a beginner in C and I want to use a lib called json-c.So I followed the git tutoriel and I installed vcpkg.After that I run the command:vcpkg install json-cvcpkg integrate installSo now vscode can...
View ArticleClang-tidy constexpr error on working code. Serious or not?
I have the following class#ifndef TEST_SUITE_BASE_H#define TEST_SUITE_BASE_H#include <stdint.h>#include <cpu.h>#include <io.h>namespace test {class Test_suite_base{public: using...
View ArticleHow to define constants for __int128?
gcc has the __int128 type natively.However, it’s not defined in limits.h. I’m mean there’re no such things as INT128_MAX or INT128_MIN…And gcc is interpreting literal constants as 64 bits integers....
View ArticleWhy a*b/c instead of a*(b/c) gives 3x bigger program size on AVR?
Recently I tried to pack my code into small ATTiny13 with 1kB of flash. In optimalisation process I discovered something weird for me. Let's take the example code:#include <avr/interrupt.h>int...
View ArticleHow to test the cpu variant in Gnu asssembler
I would like to implement some assembly code differently depending on the cpu variant I am assembling for.I am currently compiling for ARM, and the cpu variant is passed through the "-mcpu" option of...
View ArticleDisabling Dymanic memory usage in ARM
We are working in embedded project, where dynamic memory allocation is forbidden, I am trying to use the solution given here, by wrapping the calls to new and delete, I think this is the best way to...
View ArticleError during make gcc: "cp: Permission denied"
What I didIn my initially empty build directory, I configure gcc with/home/anthony/Documents/gcc-pi/gcc/configure --prefix=/opt/gcc --enable-multilib --disable-shared --enable-static...
View ArticleWhy does GCC use multiplication by a strange number in implementing integer...
I've been reading about div and mul assembly operations, and I decided to see them in action by writing a simple program in C:File division.c#include <stdlib.h>#include <stdio.h>int main(){...
View ArticleEclipse CDT shows semantic errors, but compilation is ok
I have installed Eclipse Indigo for C/C++ Linux developers on Ubuntu 10.04 x86. When I use common predefined macro __BASE_FILE__ Eclipse says Symbol '__BASE_FILE__' could not be resolved, but...
View Article