UCRT vs. MSVCRT for GCC 14.x
I am using MinGW64 together with Codelite and have just downloaded the latest GNU GCC version packages 14.1 and 14.2. For 14.1 I found 2 packages (UCRT and MSVCRT), for 14.2 I got only the UCRT version...
View ArticleAgora On-Premise-Recording-Nodejs build.sh Error in Dockerfile
I'm encountering build issues with Agora's On-Premise-Recording-Nodejs in a Dockerfile setup. The build.sh script throws multiple C++ warnings related to variable initialization order in...
View ArticleVectorization of sin and cos
I was playing around with Compiler Explorer and ran into an anomaly (I think). If I want to make the compiler vectorize a sin calculation using libmvec, I would write:#include <cmath>#define NN...
View ArticleDifferent behavior in candidate selection between GCC 11 and GCC 12
I'm encountering a different behavior when compiling the following code with GCC 11 and GCC 12 on Ubuntu 22.04:#include <iostream>#include <algorithm>namespace Foo { class MyClass {...
View Articleld merge all `*.str1.4` strings
I crosscompile for cortex M microcontroller using arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabiI compile using -fdata-sections and link using -Wl,--gc-sections -Wl,--sort-section=alignmentIn map...
View Articlecompilation failure with std::any and multiply function
https://godbolt.org/z/hxaq93ebcThe multiply function of double and int fails to compile. I am not sure why it is happening. I tried it on with different compilers, but it didn't work.It appears...
View ArticleGCC won’t work properly (a conflict with FreePascal)
I’ve installed MinGW and set the PATH, but GCC doesn’t see the included files like stdio.h. I’ve typed where gcc and found out that FreePascal comes with GCC. Apparently my PC is using GCC that comes...
View ArticleHow does ld decide the alignment of a section?
I crosscompile for cortex M microcontroller using arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabiThe .bss has 2KB alignmentobjdump:Idx Name Size VMA LMA File off Algn Flags[...] 6 .data 0000354c...
View ArticleHow to make a tuple of const references?
Say there are two functions:void ff( const std::tuple<const int&> ) { }template < typename TT >void gg( const std::tuple<const TT&> ) { }and calls to these functions:int xx =...
View ArticleI can't step into std::string source code
I have s simple code like this, I want to know the implementation of std::string, so I use the GDB and want to step into the source code, but failed. But step into std::map(or std::set)...
View ArticleHow do I write command line arguments into a file in C without writing (null)?
I need to output the arguments passed to a program into a file. Every time I do it, it outputs (null) at the end of every line.This is what I have got:#include <stdio.h>int main(int argc, char...
View ArticleLinker "undefined reference" to shared library functions
I'm having a problem with compiling a C project(proj) to use my shared library. The library provides logging and stats-gathering functionalities which I want to freely include in different projects....
View ArticleWhat is GCC/Clang equivalent of -fp-model fast=1 in ICC
As I read on Intel's website:Intel compiler uses /fp-model fast=1 as defaults. This optimization favors speed over standards compliance. You may use compiler option -mieee-fp to get compliant code.My...
View ArticleWhy -Wunused-value does not catch a statement `true;`?
Given following C code:#include <stdbool.h>int main (void){ true; return 0;}I expect that -Wunused-value would cause a warning at line 5: true;because this statement does nothing and can be a...
View ArticleWhy this c code below works fine? (C Basic, Buffer overflow test)
#include <stdio.h>int main(int argc, char *argv[]){ int arr[5] = {1, 2, 3, 4, 5}; arr[6] = 7; // [1, 2, 3, 4, 5, 6] printf("arr[6] = %d\n", arr[6]); return 0;}As I recall, it used to give a...
View Articlecustomizing gccs code coverage methods for embedded targets
i need to do code coverage in several very resource constrained device in bare metal.when i try to enable this stuff my ram usage doubles and code size blows up nothing fits.its functionally not...
View Articlehow to install older version of gcc -3 or gcc-4 in ubuntu 20
I'm trying to install an older version of gcc-4 on my Ubuntu systemMake a build directory (mkdir gcc-build && cd gcc-build)Download the source file: wget...
View ArticleWhere can I find GLIBCXX_3.4.29?
I updated my GCC compiler from the GIT repo to version 11. Now my test code (GoogleTest/GoogleMock) is complaining about GLIBCXX_3.4.29 not being found.This is not a duplicate please reopenThe answers...
View ArticleBuildroot fails to compile host-heimdal
This is my defconfig slightly modified from configs/raspberrypi3_64_defconfig:$ cat defconfig BR2_aarch64=yBR2_cortex_a53=yBR2_ARM_FPU_VFPV4=y#...
View ArticlePrevent gcc from optimization/removal of variables when using -Wl,--gc-sections?
I have an ARM project, where I would like to keep certain unused variables and their data, until the time they are used.I have seen prevent gcc from removing an unused variable :__attribute__((used))...
View Article