https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93272

            Bug ID: 93272
           Summary: LRA: EH reg allocated to hold local variable
           Product: gcc
           Version: 5.5.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: krebbel at gcc dot gnu.org
  Target Milestone: ---

Created attachment 47655
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47655&action=edit
Reduced testcase

When compiling the attached testcase for IBM Z with r253576
g++ t.cpp -S -march=z196 -mtune=zEC12 -O3 -fPIC -msoft-float -std=c++98

local variable p is live from the try block to the catch block and is being put
into r6 although that register is being used as EH reg on IBM Z.

The problem appears to be triggered by having the assignment in the try block
in a loop. Due to that the allocno in the try block gets a region separate from
the region in the catch block. The allocno used in the catch block is correctly
marked as conflicting with the EH hard regs in ira-lives. The allocno in the
catch handler gets r13 assigned which is fine. The other one r6.

In ira-emit a move between the two regions is being generated. Unfortunately
the move is being put into the catch block making r6 live across the eh edge.

The testcase is correctly compiled with more recent GCCs. However, I'm not sure
that LRA is actively preventing this. It rather looks like recent GCCs just
manage to find a register which is ok for both regions.

Reply via email to