Programs compiled with g++ using certain optimization flags segfaults

Solution Verified - Updated -

Issue

  • Program written in g++ segfaults when compiled using certain optimization flags: -O2 -flto.
  • If you compile a program with compiler flags -O2 -flto, it will segfault.

Environment

  • Red Hat Enterprise Linux 8
  • g++
  • binutils package, version: 2.30-81

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content