https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83317
Bug ID: 83317 Summary: ICE in lra_eliminate_reg_if_possible compiling Python with -mfpmath=sse on x86 Linux, possible 7 regression Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: makosoft at gmail dot com Target Milestone: --- When compiling Python 3.5.4 or 3.6.3 with -mfpmath=sse on x86 Linux using gcc 7.2.0, I get an ICE/segfault in lra_eliminate_reg_if_possible while compiling cmathmodule.c: building 'cmath' extension gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -O2 -march=native -pipe -fomit-frame-pointer -mfpmath=sse -O2 -march=native -pipe -fomit-frame-pointer -mfpmath=sse -Werror=declaration-after-statement -I./Include -I. -I/home/aidan/src/Python-3.5.4/Include -I/home/aidan/src/Python-3.5.4 -c /home/aidan/src/Python-3.5.4/Modules/cmathmodule.c -o build/temp.linux-i686-3.5/home/aidan/src/Python-3.5.4/Modules/cmathmodule.o In file included from /home/aidan/src/Python-3.5.4/Modules/cmathmodule.c:11:0: /home/aidan/src/Python-3.5.4/Modules/clinic/cmathmodule.c.h: In function ‘cmath_acos’: /home/aidan/src/Python-3.5.4/Modules/clinic/cmathmodule.c.h:44:1: internal compiler error: Segmentation fault } ^ Please submit a full bug report, with preprocessed source if appropriate. C-Reduce produced the following reduced test case which triggers the same ICE/segfault: typedef struct { double a } b; b c; d, e; f() { _setjmp(); b g; if (d) g.a = copysign(e, d); c = g; } A suitable set of compile options to reproduce this using the above test case is: gcc -fPIC -O1 -march=prescott -mfpmath=sse -c cmathmodule-reduced.i The ICE does not appear to occur with gcc 6.4.0, nor does it occur if either of -mfpmath=sse or -fPIC are disabled. It is, however, still present in the gcc 7 branch as of at least r255440. Backtrace is as follows: Program received signal SIGSEGV, Segmentation fault. 0x084cb7f4 in lra_eliminate_reg_if_possible (loc=0xb772ad38) at ../.././gcc/lra-eliminations.c:1385 1385 || ! TEST_HARD_REG_BIT (lra_no_alloc_regs, regno)) (gdb) bt #0 0x084cb7f4 in lra_eliminate_reg_if_possible (loc=0xb772ad38) at ../.././gcc/lra-eliminations.c:1385 #1 0x084bc1f0 in (anonymous namespace)::address_eliminator::address_eliminator (this=0xbfffdb90, ad=<optimized out>) at ../.././gcc/lra-constraints.c:362 #2 0x084bc320 in satisfies_memory_constraint_p (op=op@entry=0xb772ad40, constraint=CONSTRAINT_m) at ../.././gcc/lra-constraints.c:401 #3 0x084c2b3a in process_alt_operands (only_alternative=<optimized out>) at ../.././gcc/lra-constraints.c:2252 #4 curr_insn_transform (check_only_p=check_only_p@entry=false) at ../.././gcc/lra-constraints.c:3848 #5 0x084c5880 in lra_constraints (first_p=false) at ../.././gcc/lra-constraints.c:4863 #6 0x084b620e in lra (f=0x0) at ../.././gcc/lra.c:2392 #7 0x08477648 in do_reload () at ../.././gcc/ira.c:5478 #8 (anonymous namespace)::pass_reload::execute (this=0x96ec4d0) at ../.././gcc/ira.c:5662 #9 0x0853a145 in execute_one_pass (pass=0x96ec4d0) at ../.././gcc/passes.c:2465 #10 0x0853a94f in execute_pass_list_1 (pass=0x96ec4d0) at ../.././gcc/passes.c:2554 #11 0x0853a962 in execute_pass_list_1 (pass=0x96eb950, pass@entry=0x96e9280) at ../.././gcc/passes.c:2555 #12 0x0853a9a9 in execute_pass_list (fn=0xb7720000, pass=0x96e9280) at ../.././gcc/passes.c:2565 #13 0x082c18cc in cgraph_node::expand (this=0xb7726000) at ../.././gcc/cgraphunit.c:2042 #14 0x082c2c08 in expand_all_functions () at ../.././gcc/cgraphunit.c:2178 #15 symbol_table::compile (this=this@entry=0xb76680c4) at ../.././gcc/cgraphunit.c:2535 #16 0x082c48e9 in symbol_table::compile (this=0xb76680c4) at ../.././gcc/cgraphunit.c:2595 #17 symbol_table::finalize_compilation_unit (this=0xb76680c4) at ../.././gcc/cgraphunit.c:2625 #18 0x085f417a in compile_file () at ../.././gcc/toplev.c:492 #19 0x081a14e3 in do_compile () at ../.././gcc/toplev.c:2003 #20 toplev::main (this=0xbfffe8fe, argc=<optimized out>, argv=<optimized out>) at ../.././gcc/toplev.c:2138 #21 0x081a3741 in main (argc=10, argv=0xbfffe9c4) at ../.././gcc/main.c:39