42,289 questions
1
vote
0
answers
36
views
x86: How to obtain return address from %ebp?
Similar question: Assembly return address
I want to write a function to print the return address of the current function. This is code that prints %ebp+4:
void backtrace() {
int ebp;
asm ("movl %%...
0
votes
1
answer
48
views
GCC+CMake, static lib changes size_t footprint
While refactoring some legacy code I ran into some strange behaviour of CMake+GCC that I can not explain or correct.
This is what I have:
Debian Trixie with GCC 14.2.0 and CMake 3.31.6
A test project ...
1
vote
0
answers
86
views
How do I configure VSCode IntelliSense to use my local GCC trunk build?
I have built GCC 16.0 trunk in order to test out the new C++26 reflection capabilities. I am developing using WSL (Ubuntu) and VSCode.
As it stands, I have the following basic example in a simple ...
0
votes
0
answers
90
views
Linkage error using STD on Windows GCC 15.2.0
I follow How to use module `std` with gcc to generate "gcm.cache/std.gcm" on Windows using GCC 15.2.0 and ran g++ -std=c++23 -fmodules -fsearch-include-path -c bits/std.cc at "C:\bak\...
1
vote
0
answers
35
views
Inline Assembly Bug in gcc? [duplicate]
The code in question
void _start() {
const char msg[] = "Hello, World!\n";
long ret;
__asm__ volatile (
"mov $1, %%rax\n"
"mov $1, %%rdi\n"
...
0
votes
1
answer
213
views
Why __FILE__ does not print the full path (even with gcc)
I am writing a logging utility in C and want __FILE__ to print the full absolute path to the source file:
/home/j/OSL/Separate.c
But it still prints a relative path:
../Separate.c
even though I am ...
44
votes
2
answers
3k
views
GCC miscompiles long chains of overloaded `operator,`
I encountered a very odd issue in a larger project and after a lot of debugging reduced it to this minimal example. My idea is that a long comma-expression gets truncated after hitting some threshold.
...
Advice
0
votes
4
replies
27
views
Unable to install CBLAS 0.3.30
I am trying to install CBLAS on Debian 13, and am, as far as I can see, following the instructions in the README file that came in the folder. When I do a 'make all', I get the following errors that I ...
4
votes
2
answers
241
views
Why does a floating-point multiplication compile more efficiently when I put it in an inline function?
I am using com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.linux64_1.0.0.202410170706 AKA arm-none-eabi-gcc (GNU Tools for STM32 13.3.rel1.20240926-1715) 13.3.1 20240614 to ...
0
votes
1
answer
88
views
gcc 15.0.2+mingw 13.0.0 libstdc++-v3 build error
I'm trying to build mingw 13.0.0 with gcc 15.0.2 toolchain on Windows using another mingw 13.0.0 with gcc 15.0.2 build under busybox shell. As described in this tutorial, I first configured, built and ...
5
votes
4
answers
406
views
Storage duration of compound literals in C
Compile and run the code below:
#include <stdio.h>
struct s {
int *i;
};
void f(struct s *foo, const int a, const int b)
{
foo->i = (int []){a, b};
}
int main(void)
{
struct s ...
5
votes
3
answers
221
views
Log2 implementation with cygwin64 seems inefficient
I noticed there was a double precision divide after all log2 calls when using cygwin64 3.6.4 and using compiler options -O3 and
-D_FILE_OFFSET_BITS=64 so I wrote a small program to illustrate it. ...
1
vote
3
answers
134
views
gcc 13.3.0: [-Wstringop-overflow=]
I've encountered some "scaring" compiler warning, which I can not understand.
Here is code snippet:
char *__wp_load_htt(char *httdir, char *tname)
{
char fname[512];
...
Advice
0
votes
7
replies
81
views
Can I mess up GCC hash seed of unordered_map?
So I am currently investigating a random issue and found the cause to be that, during looping and accumulating floating numbers in an unordered container, traversing order difference leads to the ...
1
vote
1
answer
71
views
Cross-building GNU GCC on x86_64-pc-linux-gnu for aarch64-linux-android with Android NDK
There's a nice terminal app called Termux for android phones. The app provides a fully fonctional nix terminal and a package manager. The app dev is dead, and only some packages are maintained. You ...