https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117248
--- Comment #3 from John David Anglin <danglin at gcc dot gnu.org> --- Stage1 cc1 compiles the file without problems. So yes, it seems stage2 cc1 is miscompiled. At commit 04b4a5e4866daa7b6f4a4a3e7ed1a23f7787841d, the fault occurs on this statement: Start it from the beginning? (y or n) y Starting program: /home/dave/gnu/gcc/objdir64/gcc/cc1 -fpreprocessed _umoddi3_di.i -quiet -dumpbase _umoddi3_di.c -dumpbase-ext .c -mlong-calls -g -g -g -O2 -O2 -O2 -Wextra -Wall -Wno-error=narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -version -fno-checking -frandom-seed=fixed-seed -fbuilding-libgcc -fno-stack-protector -frandom-seed=fixed-seed -fexceptions -fnon-call-exceptions -fvisibility=hidden -o _umoddi3_di.s warning: Private mapping of shared library text was not specified by the executable; setting a breakpoint in a shared library which is not privately mapped will not work. See the HP-UX 11i v3 chatr manpage for methods to privately map shared library text. GNU C17 (GCC) version 15.0.0 20241019 (experimental) [remotes/origin/HEAD r15-4493-g04b4a5e4866] (hppa64-hp-hpux11.11) compiled by GNU C version 15.0.0 20241019 (experimental) [remotes/origin/HEAD r15-4493-g04b4a5e4866], GMP version 6.2.1, MPFR version 4.1.1, MPC version 1.2.1, isl version isl-0.25-GMP GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 233c0872571a4ebc9f36108fd2718ccf Breakpoint 1, 0x40000000014dae64 in vectorizable_slp_permutation_1 ( vinfo=0x800000010049aa28, gsi=0x0, node=0x80000001005adf00, perm=..., children=..., dump_p=false) at ../../gcc/gcc/tree-vect-slp.cc:10576 10576 unsigned vi = (lane + p.second) / vnunits; (gdb) c Continuing. Program received signal SIGFPE, Arithmetic exception. 0x40000000025f47a8 in $$divU () at ../../gcc/gcc/tree.h:3787 3787 tree_contains_struct_check_failed (__t, __s, __f, __l, __g); (gdb) bt #0 0x40000000025f47a8 in $$divU () at ../../gcc/gcc/tree.h:3787 #1 0x80000001004c6320 in ?? () #2 0x40000000014dae68 in vectorizable_slp_permutation_1 ( vinfo=0x800000010049aa28, gsi=0x0, node=0x80000001005adf00, perm=..., children=..., dump_p=false) at ../../gcc/gcc/tree-vect-slp.cc:10576 #3 0x40000000014f3d08 in vectorizable_slp_permutation ( vinfo=0x800003ffbf913738, gsi=0x0, node=0x800000010048c0f0, cost_vec=0x1) at ../../gcc/gcc/dumpfile.h:534 #4 vect_slp_analyze_node_operations_1 (vinfo=0x800003ffbf913738, node=0x800000010048c0f0, node_instance=0x80000001005adf00, cost_vec=0x1) at ../../gcc/gcc/tree-vect-slp.cc:7556 #5 vect_slp_analyze_node_operations (vinfo=0x800003ffbf913738, node=<optimized out>, node_instance=0x80000001005adf00, visited_set=..., visited_vec=..., cost_vec=0x1) at ../../gcc/gcc/tree-vect-slp.cc:7779 #6 0x40000000014f3498 in vect_slp_analyze_node_operations ( vinfo=0x800003ffbf913738, node=<optimized out>, node_instance=0x80000001005adf00, visited_set=..., visited_vec=..., cost_vec=0x1) at ../../gcc/gcc/tree-vect-slp.cc:7756 #7 0x40000000014f3498 in vect_slp_analyze_node_operations ( vinfo=0x800003ffbf913738, node=<optimized out>, node_instance=0x80000001005adf00, visited_set=..., visited_vec=..., cost_vec=0x1) at ../../gcc/gcc/tree-vect-slp.cc:7756 #8 0x40000000014f59ac in vect_slp_analyze_operations (vinfo=0x2) ---Type <return> to continue, or q <return> to quit--- at ../../gcc/gcc/tree-vect-slp.cc:8174 #9 0x40000000014fde3c in vect_slp_analyze_bb_1 (bb_vinfo=0x800000010049d180, n_stmts=<optimized out>, fatal=<optimized out>, dataref_groups=0x800003ffbfff1958) at ../../gcc/gcc/tree-vect-slp.cc:9214 #10 vect_slp_region (bbs=..., datarefs=..., dataref_groups=0x800003ffbfff1958, n_stmts=<optimized out>, orig_loop=<optimized out>) at ../../gcc/gcc/tree-vect-slp.cc:9261 #11 vect_slp_bbs (bbs=..., orig_loop=<optimized out>) at ../../gcc/gcc/tree-vect-slp.cc:9484 #12 0x400000000150014c in vect_slp_function (fun=0x800003ffbf913738) at ../../gcc/gcc/tree-vect-slp.cc:9606 #13 0x40000000015073a0 in (anonymous namespace)::pass_slp_vectorize::execute ( this=<optimized out>, fun=0x800000010049d180) at ../../gcc/gcc/tree-vectorizer.cc:1540 #14 0x4000000000f576cc in execute_one_pass (pass=0x800000010049d180) at ../../gcc/gcc/passes.cc:2659 #15 0x4000000000f5840c in execute_pass_list_1 (pass=0x800000010049d180) at ../../gcc/gcc/passes.cc:2768 #16 0x4000000000f58428 in execute_pass_list_1 (pass=0x800000010049d180) at ../../gcc/gcc/passes.cc:2769 #17 0x4000000000f58428 in execute_pass_list_1 (pass=0x800000010049d180) at ../../gcc/gcc/passes.cc:2769 #18 0x4000000000f584a0 in execute_pass_list (fn=<optimized out>, ---Type <return> to continue, or q <return> to quit--- pass=<optimized out>) at ../../gcc/gcc/passes.cc:2779 #19 0x4000000000a2d8d0 in expand (this=0x800000010049d180) at ../../gcc/gcc/context.h:48 #20 cgraph_node::expand (this=0x800000010049d180) at ../../gcc/gcc/cgraphunit.cc:1798 #21 0x4000000000a3047c in expand_all_functions () at ../../gcc/gcc/cgraphunit.cc:2028 #22 symbol_table::compile (this=0x800003ffbf913738) at ../../gcc/gcc/cgraphunit.cc:2404 #23 0x4000000000a33f60 in compile (this=0x2) at ../../gcc/gcc/cgraphunit.cc:2589 #24 symbol_table::finalize_compilation_unit (this=0x2) at ../../gcc/gcc/cgraphunit.cc:2589 #25 0x40000000010dc8ec in compile_file () at ../../gcc/gcc/toplev.cc:478 #26 0x80000001003e4530 in ?? () (gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/dave/gnu/gcc/objdir64/gcc/cc1 -fpreprocessed _umoddi3_di.i -quiet -dumpbase _umoddi3_di.c -dumpbase-ext .c -mlong-calls -g -g -g -O2 -O2 -O2 -Wextra -Wall -Wno-error=narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -version -fno-checking -frandom-seed=fixed-seed -fbuilding-libgcc -fno-stack-protector -frandom-seed=fixed-seed -fexceptions -fnon-call-exceptions -fvisibility=hidden -o _umoddi3_di.s warning: Private mapping of shared library text was not specified by the executable; setting a breakpoint in a shared library which is not privately mapped will not work. See the HP-UX 11i v3 chatr manpage for methods to privately map shared library text. GNU C17 (GCC) version 15.0.0 20241019 (experimental) [remotes/origin/HEAD r15-4493-g04b4a5e4866] (hppa64-hp-hpux11.11) compiled by GNU C version 15.0.0 20241019 (experimental) [remotes/origin/HEAD r15-4493-g04b4a5e4866], GMP version 6.2.1, MPFR version 4.1.1, MPC version 1.2.1, isl version isl-0.25-GMP GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 233c0872571a4ebc9f36108fd2718ccf Breakpoint 2, vectorizable_slp_permutation_1 (vinfo=0x800000010049aa28, gsi=0x0, node=0x80000001005adf00, perm=..., children=..., dump_p=false) at ../../gcc/gcc/tree-vect-slp.cc:10575 10575 unsigned lane = active_lane[p.first].to_constant (); (gdb) p/x $r19 $5 = 0x1 (gdb) p *$r3 $6 = 4 (gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/dave/gnu/gcc/objdir64/gcc/cc1 -fpreprocessed _umoddi3_di.i -quiet -dumpbase _umoddi3_di.c -dumpbase-ext .c -mlong-calls -g -g -g -O2 -O2 -O2 -Wextra -Wall -Wno-error=narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -version -fno-checking -frandom-seed=fixed-seed -fbuilding-libgcc -fno-stack-protector -frandom-seed=fixed-seed -fexceptions -fnon-call-exceptions -fvisibility=hidden -o _umoddi3_di.s warning: Private mapping of shared library text was not specified by the executable; setting a breakpoint in a shared library which is not privately mapped will not work. See the HP-UX 11i v3 chatr manpage for methods to privately map shared library text. GNU C17 (GCC) version 15.0.0 20241019 (experimental) [remotes/origin/HEAD r15-4493-g04b4a5e4866] (hppa64-hp-hpux11.11) compiled by GNU C version 15.0.0 20241019 (experimental) [remotes/origin/HEAD r15-4493-g04b4a5e4866], GMP version 6.2.1, MPFR version 4.1.1, MPC version 1.2.1, isl version isl-0.25-GMP GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 233c0872571a4ebc9f36108fd2718ccf Breakpoint 2, vectorizable_slp_permutation_1 (vinfo=0x800000010049aa28, gsi=0x0, node=0x80000001005adf00, perm=..., children=..., dump_p=false) at ../../gcc/gcc/tree-vect-slp.cc:10575 10575 unsigned lane = active_lane[p.first].to_constant (); (gdb) disass $pc-16,$pc+64 Dump of assembler code from 0x40000000014dae30 to 0x40000000014dae80: 0x40000000014dae30 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1840>: cmpb,<>,n r24,r19,0x40000000014dc248 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+6984> 0x40000000014dae34 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1844>: ldh 36(r26),r19 0x40000000014dae38 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1848>: ldw 4(r5),r25 0x40000000014dae3c <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1852>: mtsarcm r19 => 0x40000000014dae40 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1856>: cmpb,>>= ret0,r25,0x40000000014dc104 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+6660> 0x40000000014dae44 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1860>: depdi,z,* 1,sar,64,r19 ---Type <return> to continue, or q <return> to quit--- 0x40000000014dae48 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1864>: ldd,s r20(r5),r26 0x40000000014dae4c <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1868>: copy ret1,r25 0x40000000014dae50 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1872>: add,l r26,ret1,r26 0x40000000014dae54 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1876>: std ret1,-110(sp) 0x40000000014dae58 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1880>: ldo -1(r19),r19 0x40000000014dae5c <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1884>: and r26,r19,r19 0x40000000014dae60 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1888>: b,l 0x40000000010571c0 <.stub>,rp 0x40000000014dae64 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool---Type <return> to continue, or q <return> to quit--- )+1892>: ldw 4(r3),r20 0x40000000014dae68 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1896>: ldw 0(r3),r26 0x40000000014dae6c <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1900>: extrd,u,* r20,63,32,r25 0x40000000014dae70 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1904>: extrw,u r26,30,31,r26 0x40000000014dae74 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1908>: cmpb,= r25,r26,0x40000000014dc330 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+7216> 0x40000000014dae78 <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1912>: extrd,u,* r19,63,32,r19 0x40000000014dae7c <vectorizable_slp_permutation_1(vec_info*, gimple_stmt_iterator*, slp_tree, lane_permutation_t&, vec<_slp_tree*, va_heap, vl_ptr>&, bool)+1916>: ldo 1(r20),r20 End of assembler dump. (gdb) info address vnunits Symbol "vnunits" is multi-location: Range 0x40000000014dae40-0x40000000014dae5c: a variable in $r19 Range 0x40000000014dae5c-0x40000000014dae60: a complex DWARF expression: 0: DW_OP_breg19 1 [$r19] 2: DW_OP_stack_value Range 0x40000000014dae60-0x40000000014daea0: a complex DWARF expression: 0: DW_OP_lit1 1: DW_OP_const1u 63 3: DW_OP_bregxwarning: Unmapped DWARF DBX Register #60 encountered. register 60 [$] offset 0 6: DW_OP_minus 7: DW_OP_shl 8: DW_OP_stack_value (gdb) p/x $ret1 $13 = 0x0 Not sure what value register $ret1 is supposed to hold, but it is copied to $r25 for call to $$divU routine causing fault.