Bug ID: 85393
           Summary: [8 Regression] Miscompilation with hot/cold
                    partitioning starting with r254832
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot
          Reporter: jakub at gcc dot
  Target Milestone: ---

#include <stdexcept>
#include <vector>

void foo (char const *s);

struct S {
  ~S () noexcept (false) {
    throw std::runtime_error ("foo");

main(int argc, char *argv[])
  std::vector <std::vector <char>> args;
        S k;
        foo ("A");

      if (argv)
        throw std::runtime_error ("foo");
      args.push_back ({});
  catch (std::runtime_error const& e)
void foo (char const *) {}

g++ -g -O2 -o test{,.C,2.C}
segfaults because vector dtor is called with NULL this.  My bisection points to 
r254832, Marek's to r250360 (I've used 7.x STL headers, dunno what has Marek
used).  In any case, the segfault goes away with
-fno-reorder-blocks-and-partition, and the only r254832 vs. r254831 differences
in *.optimized dump I see are branch probabilities, so it must be RTL
optimization related (or target issue).

Reply via email to