https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69838
Bug ID: 69838 Summary: [regression] Lra deletes EH_REGION Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression Assignee: unassigned at gcc dot gnu.org Reporter: vogt at linux dot vnet.ibm.com Target Milestone: --- Host: s390x Target: s390x Created attachment 37704 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37704&action=edit Ira dump (ok) It looks like Lra does not handle EH_REGION notes correctly. There is at least one Gnat testcase where Lra wrongly deletes all exception handling code (gcc/testsuite/gnat.dg/null_pointer_deref1.adb): -- snip -- procedure Null_Pointer_Deref1 is type Int_Ptr is access all Integer; function Ident return Int_Ptr is begin return null; end; Data : Int_Ptr := Ident; begin Data.all := 1; exception when Constraint_Error | Storage_Error => null; end; -- snip -- The exception handling code vanishes in the reload pass (see attached rtl dumps). As a consequence, the exception is not caugt by the function and the program terminates with an error. With -mno-lra the test case works fine, and the code in reload1.c seems to have special treatment for EH_REGION notes that is missing in ira.c.