This shows up on aarch64-darwin but can be repeated with -fno-cfi-asm on
Linux, tested on x86_64, aarch64-linux, aarch64-darwin, OK for trunk?
thanks
Iain

--- 8< ---

The RTL front end can start at a pass later than the initialisation of
the cie/cfi vector and so we must cater for it being unset.

This fires for RTL testcases on platform which do not use cfi instructions.

gcc/ChangeLog:

        * dwarf2out.cc (output_call_frame_info): Check for unset cie/cfi
        vector before iteration.

Signed-off-by: Iain Sandoe <[email protected]>
---
 gcc/dwarf2out.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index e8a6019f72e..4e8a2ddfc75 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -943,8 +943,12 @@ output_call_frame_info (int for_eh)
                             eh_data_format_name (fde_encoding));
     }
 
-  FOR_EACH_VEC_ELT (*cie_cfi_vec, i, cfi)
-    output_cfi (cfi, NULL, for_eh);
+  /* cie_cfi_vec is created lazily by the dwarf2 frame pass.
+     The RTL front end allows for starting from a pass after that so that
+     this can be absent.  */
+  if (cie_cfi_vec)
+    FOR_EACH_VEC_ELT (*cie_cfi_vec, i, cfi)
+      output_cfi (cfi, NULL, for_eh);
 
   /* Pad the CIE out to an address sized boundary.  */
   ASM_OUTPUT_ALIGN (asm_out_file,
-- 
2.50.1 (Apple Git-155)

Reply via email to