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

            Bug ID: 114905
           Summary: aarch64 locally_streaming function ICE in dwarf2cfi
                    due to mismatched CFA instructions in
                    prologue/epilogue
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matmal01 at gcc dot gnu.org
  Target Milestone: ---

Bug observed (testcase + ICE) is below.  I believe this happens because we use
`aarch64_add_sp` to adjust the stack pointer when `maybe_ne (sve_callee_saves,
0)` in `aarch64_expand_epilogue`.  This marks the adjustment as adjusting the
CFA.  However in `aarch64_expand_prologue` we might have set the CFA to the
frame pointer (instead of the stack pointer) if `frame_pointer_needed &&
frame_size.is_constant()`.
Hence when both these conditions are held we have a CFA adjust note that
affects a different register to the current CFA register.



vshcmd: > cat streaming-prologues.c                                             
[[arm::locally_streaming,arm::streaming_compatible]] void                       
no_gprs_saved_very_streaming (__SVBool_t x)                                     
{                                                                               
  asm ("");                                                                     
}                                                                               

gnu-work [13:47:36] $                                                           
vshcmd: > ${install_dir}/aarch64-none-linux-gnu-gcc \                           
vshcmd: >         streaming-prologues.c \                                       
vshcmd: >         -fdiagnostics-plain-output -O -fomit-frame-pointer
-fstack-clash-protection\                                                       
vshcmd: >         -march=armv9-a+sme -mtune=generic -moverride=tune=none \      
vshcmd: >         -fdump-rtl-all-all \                                          
vshcmd: >         -S -o locally_streaming_1_scp.s                               
gnu-work [13:47:38] $ > > > > > during RTL pass: dwarf2                         
dump file: locally_streaming_1_scp.c.356r.dwarf2                                
streaming-prologues.c: In function ‘no_gprs_saved_very_streaming’:              
streaming-prologues.c:5:1: internal compiler error: in
dwarf2out_frame_debug_adjust_cfa, at dwarf2cfi.cc:1339                          
0xa540bd dwarf2out_frame_debug_adjust_cfa                                       
        /workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/dwarf2cfi.cc:1339        
0xa540bd dwarf2out_frame_debug                                                  
        /workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/dwarf2cfi.cc:2277        
0xa540bd scan_insn_after                                                        
        /workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/dwarf2cfi.cc:2726        
0xa557e0 scan_trace                                                             
        /workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/dwarf2cfi.cc:2893        
0xa562cf create_cfi_notes                                                       
        /workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/dwarf2cfi.cc:2938        
0xa562cf execute_dwarf2_frame                                                   
        /workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/dwarf2cfi.cc:3309        
0xa562cf execute                                                                
        /workspace/GNU-toolchain/fsf-trunk/src/gcc/gcc/dwarf2cfi.cc:3797        
Please submit a full bug report, with preprocessed source (by using
-freport-bug).                                                                  
Please include the complete backtrace with any bug report.                      
See <https://gcc.gnu.org/bugs/> for instructions.                               
gnu-work [13:47:39] $

Reply via email to