Questions tagged [gcc11]

32 questions
41
votes
4 answers

When gcc-11 will appear in Ubuntu repositories?

GCC 11.1 was finally released yesterday. However, now it can only be built from source, so I'm wondering when we can get it with apt?
gavrilikhin.d
  • 554
  • 1
  • 7
  • 20
11
votes
3 answers

C++ Modules Forward Declaring Entity from Another Module

I have recently been trying to convert a codebase to C++20 modules using GCC 11. However, I got stuck on the following situation. First, here is how it was done using headers: A.h class B; class A { public: void f(B&…
sudgy
  • 491
  • 1
  • 3
  • 15
5
votes
1 answer

Support for OMPT in mainstream compilers?

The OpenMP specification from version 5.0 defines the OMPT interface to allow external tools to query the openmp runtime. I wanted to give it a try but i am really confused about how mainstream compilers actually support this. GCC-11 claims to have…
user1551605
  • 166
  • 9
4
votes
1 answer

warning: taking address of packed member of 'struct details' may result in an unaligned pointer value [-Waddress-of-packed-member]

struct details_state { struct details_status D1; struct details_status D2; }; struct details { struct details_state details_states[2]; } __attribute__((packed)); struct…
qwerty
  • 85
  • 2
  • 6
4
votes
2 answers

gcc-11 incorrect may be used uninitialized that seems hard to avoid

I found a particular usage pattern that seems completely ok and no compiler has ever complained on before. Now it raises a warning with gcc-11: A close to minimal example is below. Save as t.c and compile using gcc-11 -O2 -Wall -c t.c. #include…
Jan Wielemaker
  • 1,670
  • 10
  • 18
4
votes
2 answers

Howto disable warning in GCC 11.1 -mgeneral-regs-only' -Wattributes in the interrupt context on ARM architecture?

I've updated the GCC compiler from 10.3 to 11.1. I'm using it to compile for target CPU cortex-m4 with FPU. In my code there is a lot of functions marked as interrupt with the __attribute__((interrupt)) for example: __attribute__((interrupt)) void…
lbxr
  • 41
  • 5
3
votes
2 answers

gcc 11 link error only when optimization disabled

I am facing this weird issue with gcc 11.3.0, a -O3 build works, whereas when I build with -O0 -g (debug build), I get linker error: /usr/bin/ld: path/to/mylib.a(my_file.cpp.2.o): undefined reference to symbol…
Ani
  • 1,448
  • 1
  • 16
  • 38
3
votes
1 answer

On `gcc` 11, how to change the prefix of `.gcno` files when using `--coverage` so they match what `gcov` expects?

I'm adding code coverage on a C project of mine. The process I'm following is this: # compile a .c file, expecting two new files "a.out" and "main.gcno" gcc --coverage main.c # run executable to get coverage data, expecting to create a new…
TomTsagk
  • 1,474
  • 9
  • 23
2
votes
2 answers

std::array:size() as a const in gcc 11

I have this example code #include #include #include template class Booth { public: int function(const std::array & data) { std::bitset bit_set{}; return…
ilya1725
  • 4,496
  • 7
  • 43
  • 68
2
votes
0 answers

`-frecord-gcc-switches` missing flags after gcc 10.4

I used to use -frecord-gcc-switches to embed a version string in a binary. With gcc 10.4, when compiling some c code with -Wall -Werror -O3 -frecord-gcc-switches -DVERSION_THING=123hello, I'd get the following output from readelf -p…
wreckgar23
  • 1,025
  • 9
  • 22
2
votes
1 answer

gcc 11 is not debugging. It shows "as: unrecognized option '--gdwarf-5'"

I installed gcc 11 using homebrew on my machine (linux 20.04). And It is not running on vscode as it shows as: unrecognized option '--gdwarf-5' I'm not sure if it's a path problem or not. Cause when I installed brew it told me Warning:…
Hasib Al Fuad
  • 29
  • 1
  • 4
2
votes
1 answer

Use GCC11 on (K)ubuntu 20.04

I want to use some new C ++ 20 functions that are implemented in the as-yet-unreleased GCC-11. I tried installing the package on Ubuntu 20.04 but as expected it doesn't exist yet. The web search didn't come up with anything useful either. Is there…
Silicomancer
  • 8,604
  • 10
  • 63
  • 130
1
vote
2 answers

workaround for dynamic formatting specs with fmt

Is there a way to use fmt with a spec that is computed at runtime. Noticed that with gcc 10 this code worked fine but not with modern gcc. #include const char* get_spec(bool test) { // image this is implemented in some other .cpp…
Mikhail
  • 7,749
  • 11
  • 62
  • 136
1
vote
1 answer

Upgrading from C++17 to C++20, encountering a build error in Boost, async_accept() when using boost::asio::use_future as second argument

OS: Ubuntu 22.04 Compiler: gcc 11.3 Boost Version: 1.80 Working on upgrading an existing project from C++ standard C++17 to C++20. Everything compiles in C++17 but when upgrading to C++20, an error is being generated in acceptor_.async_accept when…
Nick
  • 11
  • 2
1
vote
0 answers

Which section of the modern compiled code controls the exit of a c program?

So, In the binary files of C program compiled using old gcc versions like 3.3.6 there is a section like .dtors but there is nothing like that in the binary files of C program compiled using new gcc versions like 11.3.0 I want to know what will be…
Vignesh SB
  • 11
  • 4
1
2 3