Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Browsing all 22296 articles
Browse latest View live

Very simple. Just trying to compile a hello world program, but gcc won't stop...

My issue is with something so basic, I don't even know how to fix it. I don't know why it's saying the file doesn't exist when it's right there. I checked and there's no whitespace in the file's name...

View Article


Example of polymorphism preventing compiler optimization?

Cannot remember where I saw it now- but somewhere I read that dynamic polymorphism prevents the compiler from making various optimizations. Besides inlining, could somebody please englighten me with...

View Article


A bizzare phenomenon on inline function? [closed]

While I tried to understand inline functions, I found myself in a rabbit hole which is very deep. I get to know that inline is a function specifier, that inline is a mere hint to a compiler, that it's...

View Article

Copy elision possible if returning parameter?

Consider a function that takes an object by value, performs some operations on it and return that object, for example:std::string MyToUpper (std::string s){ std::transform(s.begin(), s.end(),...

View Article

creating large memory in stack

I tried to create large amount of memory in stack (int a[1000000000]). It compiled successfully. However at run time it Segfaulted. Its perfectly agreeable that the program segfaults. My question is,...

View Article


Is there any benefit to passing all source files at once to a compiler?

I have read about "Whole Program Optimization" (wpo) and "Link Time Code Generation" (ltcg).I wonder is there more inter-module-analysis going on if I pass all sources at once to the compiler from the...

View Article

Why is the stack pointer moved down 4 bytes greater than the stack frame size...

Using the trivial C program below as an example. main() makes a function call to sum passing in 4 integer. sum() uses 4 locals.void sum(int a, int b, int c, int d);void main(void){ sum(11, 12, 13,...

View Article

function overloading in C riscv64-elf-gcc vs clang

In an embedded riscv32 mcu's sdk I see the follow function overloading practice:void FLASH_ROM_READ(uint32_t StartAddr, void *Buffer, uint32_t len);void FLASH_ROM_READ(UINT32 StartAddr, PVOID Buffer,...

View Article


how to print __uint128_t number using gcc?

Is there PRIu128 that behaves similar to PRIu64 from <inttypes.h>:printf("%" PRIu64 "\n", some_uint64_value);Or converting manually digit by digit:int print_uint128(uint128_t n) { if (n == 0)...

View Article


gcc assembly vs direct to machine code [closed]

I recently started learning how to program, and I found this one thing curious:Why does gcc go the extra mile of compiling the c-code to assembly and then to machine code?Wouldn't it be just as...

View Article

Problem adding custom MAC instruction with 4 operands to the RISCV architecture

I am trying to add a custom instruction which has 4 operands. It does multiply and accumulate (a*b+c) to the first 3 source registers and then store the result in the destination register. It...

View Article

How to use gcc with fsanitize=address?

I'm trying to learn how to use -fsanitize=address -fno-omit-frame-pointer to detect memory leaks. I wrote something simple which clearly has a memory leak in it, but compiling with gcc...

View Article

GCC v12.1 warning about serial compilation

I have upgraded my whole arch linux system today (12th May, 2022). gcc was also upgraded from v11.2 to v12.1. I tried compiling some of my programs with g++ (part of GCC compiler collection) by the...

View Article


Using a shared libray within static library used by 2nd shared library and...

Basic question: Can one specify, when building a static library (and ONLY when building the static library), that the static library needs to link with a shared object?I'm working on a project that...

View Article

How i can static build GDB from source?

I've download gdb-6.5.bz2.tar. Untar this file.I write:LDFLAGS=-static ./configurebut as a result i get a gdb, which require a so files, for instance: ncurses.so.5 libc.so.0 etcHow i can build...

View Article


how do you use the pascal calling convention with gcc?

I need to tell gcc the calling convention is pascal so I use:void __attribute__((pascal, regparm(0))) functionname() {}It says:warning: 'pascal' attribute directive ignored [-Wattributes]So how do I...

View Article

Where are include files stored - Ubuntu Linux, GCC

So, when we do the following:#include <stdio.h>versus #include "myFile.h"the compiler, GCC in my case, knows where that stdio.h (and even the object file) are located on my hard drive. It just...

View Article


GCOV/LCOV support [closed]

I was trying to merge multiple info files into one single file so that I can have a common report using this commandlcov --add-tracefile ./coverage/mercury_libmerc_driver_tls_only.info --add-tracefile...

View Article

Source path of CallStack is invalid when debugging with CMake in VSCode

I'm building a debugging environment with CMake in VSCode.Debugging with breakpoints works fine in Visual Studio using the same CMake.However, in VSCode, the target source file of CallStack is not...

View Article

How to use fsanitize=leak in older mac versions?

Unfortunately my Mac is a little old (x86_64-apple-darwin19.6.0) so it's not compatible with fsanitize=leak when I want to analize memory leaks in programs.leak.c:#include <stdlib.h>int main(){...

View Article
Browsing all 22296 articles
Browse latest View live


Latest Images