Questions tagged [gcc9]

GCC 9 is a major release of the GNU Compiler collection first released in 2019.

Version 9.1 was released on 2019-05-03. Version 9.3 was released on 2020-03-12.

See also:

46 questions
1
vote
2 answers

Can this incomplete type be improved to work with this C++ concept?

The following code works as designed with g++ 9.3.1 and the old concepts TS. But I haven't gotten it to work with g++ 10.3.1 and the C++ core language version of concepts: #if __cpp_concepts < 201707 # define CONCEPT concept bool #else # define…
dave_k_smith
  • 655
  • 1
  • 7
  • 22
1
vote
0 answers

Offset of a member from a member object pointer in gcc 9

I previously used this to extract a size_t offset to a member of an object based on passing in the member object pointer. template constexpr size_t memberOffset(U T::*member) { return (char*)&((T*)nullptr->*member) -…
Daniel Moodie
  • 357
  • 1
  • 10
1
vote
1 answer

Where can I find the GCC 9 implementation of std::chrono::system_clock::now()?

The chrono system header (/usr/include/c++/9/chrono) declares, but does not define, the static now() functions of its clocks. I also do not see an include that looks relevant. Where are these functions implemented?
Felix Dombek
  • 13,664
  • 17
  • 79
  • 131
1
vote
2 answers

Forcing instantiation of all of a template classes member functions

During initial development of a template class, before I've written full test cases, I am finding that I would like the ability to force the compiler to generate the code for every member (including non-static ones) of a template class for a…
Jason C
  • 38,729
  • 14
  • 126
  • 182
1
vote
0 answers

C++17, string + string_view gives compilation error

As per the C++17 book from "Nicolai M. Josuttis" the following code should compile. #include #include int main() { std::string_view sv1 = "hello"; std::string_view sv2 = "world"; auto s =…
1
vote
2 answers

It is possible to getting stuck in the compare_exchange's loop?

Consider this code (from 'C++ concurrency in action' [Second edition]: page 212): void LockFreeStack::pop (stack_data& result) { Node* old_head = head.load(); while(!head.compare_exchange_weak(old_head, old_head->next)) ; result…
Ghasem Ramezani
  • 2,683
  • 1
  • 13
  • 32
1
vote
1 answer

__FLT_MAX__ and __DBL_MAX__ to 0?

With GCC 9.1, when calling std::numeric_limits's functions with floating-point types, they return 0 in most cases. This happens in a project I'm working on, and there is no issue with MSVC, GCC 8.3 or Clang 8.0. ::epsilon() sometimes has a…
Razakhel
  • 732
  • 13
  • 34
1
vote
3 answers

Get warning for left shifting a negative number

I am trying to generate a warning for undefined behavior on left shifting a negative number. According to this answer, left shift of a negative number in C is undefined. The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are…
0
votes
0 answers

using coverity 2019.03

I m using coverity 2019.03 After the configuration I have the message the Successfully generated configuration for the compilers: g++ g++-3 g++-4 gcc gcc-3 gcc-4 ld but when trying to build , I have : [WARNING] No files were emitted. This may be due…
abirb
  • 1
0
votes
1 answer

coredump when calling virtual method of a dynamic allocated object

The snippet below will coredumped in fun() method. Why calling c->b.f() works in main() but failed in the function call? class A { public: inline virtual void f() const {printf("A\n");} }; class B : public A { public: inline void f() const…
brayden
  • 3
  • 1
0
votes
1 answer

c++ unorderd_map insert fails for value_type with atomic member

class strategy { int id; std::atomic strategyStarted; int startTime; int endTime; void getStartTime() { return startTime; } void setStartTime(int sTime) { startTime = sTime; } }; class strategyImpl{ …
Prabal Kajla
  • 125
  • 12
0
votes
0 answers

Build gcc-9.1.0 error with libgfortran.so

I tried to install gcc-9.1.0 version with gcc-5 and the following configure options: ../gcc-9.1.0/configure --prefix=local/gcc/9.1.0-all \ --program-suffix='-10' \ --without-included-gettext \ --enable-threads=posix \ …
0
votes
0 answers

Why is GCC complaining with Wstringop-overflow?

I have code which looks like this: char* newChar = new char[strlen(inputCharArray)+1]; if (NULL == newChar) { return; } strncpy(newChar, inputCharArray, strlen(inputCharArray)); newChar[strlen(inputCharArray)] = '\0'; This seems for me like…
Sir2B
  • 1,029
  • 1
  • 10
  • 17
0
votes
1 answer

Link with -rpath=/usr/local/lib works, -rapth=$ORIGIN does not

I am working on an embedded Linux target, gcc 9.2. If I link with -rpath=/usr/local/lib, the readelf utility shows me the RPATH entry, as expected. If I link with -rpath=$ORIGIN, readelf shows no RAPTH, and nothing involving ORIGIN. The link command…
Phillip
  • 13
  • 4