Skip to main content
3 votes
1 answer
68 views

Is warning yielded by -Wc++-compat about identifiers not yet expanded by macro a false positive?

I've been compiling my C code against some very "non-default" warnings and found a potential GCC bug - a false positive caused by -Wc++-compat. Before explaining anything, it would probably ...
sleeptightAnsiC's user avatar
-1 votes
0 answers
30 views

Class declaration in cpp file does not work in static library [duplicate]

I am trying to use ramulator2 with a simple change. It is built as a shared library, and when tested it works fine. For reasons beyond this question, I want it as a static library. I thought this was ...
mewais's user avatar
  • 1,335
1 vote
0 answers
101 views

Why g++ does not optimize this code removing the division (s / s)?

code example compiled with -O3 and -fno-inline in godbolt: https://godbolt.org/z/4rvxccsns template <class T> T numbbo(T r, unsigned s) { return 10.0 / (static_cast<float>(s) / ...
gustavo's user avatar
  • 128
1 vote
0 answers
50 views

How to improve gcc compile time for compile-once single file program

GCC version: 11.4.0 Flags I am passing: -O3 -march=native -funroll-all-loops -mprefer-vector-width=512 -mavx I have a C program that looks like this: void foo(...) { for (int i...) for (int j...)...
Pratyush Das's user avatar
1 vote
4 answers
76 views

Make constant array visible to different source file

Is it possible to make contents of constant array be visible across multiple other source files so that compiler can optimize access to the array. I have an array const int myTable[10]; and in ...
user1806687's user avatar
1 vote
2 answers
99 views

What is the rationale for 0-size arrays?

Both GCC and Clang support (as an extension) 0-size (also called "0-length") arrays. What is the rationale for 0-size arrays (example int x[0])?
pmor's user avatar
  • 6,181
0 votes
0 answers
18 views

how to fix clang: error: -lm: 'linker' input unused [-Werror,-Wunused-command-line-argument]? [duplicate]

I downloaded homebrew, gcc14 and pasted the path on compiler. Then it worked when I pasted the flags: -DCMAKE_C_FLAGS="-Wall -Werror -pedantic-errors -lm -g" But it didn’t build and showed:...
user28256843's user avatar
0 votes
2 answers
118 views

GCC Output Symbol not Relocatable with -fPIC

On an Ubuntu 24.04, using the default GCC-13.2 compiler I compiled a source file with -fPIC option to produce relocatable binary: /usr/bin/c++ -v -DBPFTIME_BUILD_WITH_LIBBPF=1 -DSPDLOG_COMPILED_LIB -...
TheAhmad's user avatar
  • 930
0 votes
0 answers
31 views

Issues with GCC / G++ in cuda 11.7

I am having problems with CUDA extension, I've been trying to run several deep learning models that require C. As always the first step with these models is to run setup.py but I keep encountering the ...
Ahmed Gaber's user avatar
0 votes
1 answer
45 views

Issue with DWARF DIE's and tracking variables

My compiler is writing DWARF DIE's and I am currently coming across an issue with tracking variables. For example, the abbreviation would look something like: DW_AT_name DW_FORM_string ...
Connor's user avatar
  • 13
2 votes
2 answers
95 views

Why am I getting "Assuming signed integer overflow does not occur" here?

Code in question (godbolt) #include <stdbool.h> void do_work(void); typedef struct task { int timer; void (*job)(void); } task_t; typedef struct task_list { task_t *tasks; int ...
Fullaccess 's user avatar
0 votes
0 answers
57 views

Issues with using * in command line in windows [duplicate]

I was trying to solve the reverse polish calculator problem where the arguments can be entered on the command line. I am facing a peculiar problem. The program name is rpc.exe A command line entry as ...
Vinayak Deshmukh's user avatar
1 vote
1 answer
78 views

vectorisation fails due to unsupported control flow in loop

I have some C code that looks like (The full code on Compiler-Explorer: https://godbolt.org/z/aTGac8fco): void foo(const float *restrict const input, float *restrict const output, ...
oliversm's user avatar
  • 1,961
0 votes
1 answer
45 views

ARM stack padding generated by compiler

The following function, #include <string.h> void func1(char *s) { char buffer[4]; strcpy(buffer, s); } is compiled, $ arm-linux-gnueabi-gcc -g -fno-stack-protector func1.c -c -o func1.o $...
Isidro Arias's user avatar
0 votes
1 answer
55 views

Install GCC and G++ on Windows in a GitHub Actions CI/CD Workflow

I'm setting up a GitHub Actions CI/CD workflow and need to install gcc and g++ on a Windows runner to compile C/C++ code. I want the installation to be fully automated, as part of the CI/CD pipeline, ...
Asile34's user avatar
  • 144

15 30 50 per page
1
2 3 4 5
2799