https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85817
Bug ID: 85817 Summary: [9 Regression] ICE in expand_call at gcc/calls.c:4291 Product: gcc Version: unknown Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: marxin at gcc dot gnu.org, prathamesh3492 at gcc dot gnu.org Target Milestone: --- Starting from r260250 I see ICE in GIMP being built with -O3 and -flto. Unfortunately it happens in ltrans, thus it's hard to reduce a reproducer. So: $ ./lto1 -quiet -dumpdir .libs/ -dumpbase gimp-2.9.ltrans3 -mtune=generic -march=x86-64 -mtune=generic -march=x86-64 -auxbase-strip gimp-2.9.ltrans3.ltrans.o -O3 -O3 -O3 -Werror=missing-prototypes -Wtype-limits -version -fno-openacc -fno-common -fdiagnostics-show-option -fopenmp -fltrans /home/marxin/BIG/buildbot/slave/source/gimp/app/gimp-2.9.ltrans3.o -o gimp-2.9.ltrans3.s GNU GIMPLE (GCC) version 9.0.0 20180515 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 7.3.1 20180323 [gcc-7-branch revision 258812], GMP version 6.1.2, MPFR version 4.0.1-p6, MPC version 1.1.0, isl version isl-0.19-GMP GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU GIMPLE (GCC) version 9.0.0 20180515 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 7.3.1 20180323 [gcc-7-branch revision 258812], GMP version 6.1.2, MPFR version 4.0.1-p6, MPC version 1.1.0, isl version isl-0.19-GMP GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 during RTL pass: expand gimpwindow.c: In function ‘gimp_window_key_press_event’: gimpwindow.c:200:9: internal compiler error: Segmentation fault 0xf336c9 crash_signal ../../gcc/toplev.c:325 0x8d2290 expand_call(tree_node*, rtx_def*, int) ../../gcc/calls.c:4287 0xa954be expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) ../../gcc/expr.c:11011 0xa8734c expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) ../../gcc/expr.c:8235 0x8e4c27 expand_expr ../../gcc/expr.h:280 0x8ede19 expand_call_stmt ../../gcc/cfgexpand.c:2690 0x8f1661 expand_gimple_stmt_1 ../../gcc/cfgexpand.c:3644 0x8f1dbb expand_gimple_stmt ../../gcc/cfgexpand.c:3810 0x8fab6e expand_gimple_basic_block ../../gcc/cfgexpand.c:5839 0x8fc7f9 execute ../../gcc/cfgexpand.c:6445 (gdb) p valreg $2 = (rtx) 0x0 (gdb) p debug_tree(exp) <call_expr 0x7ffff648a2d0 type <void_type 0x7ffff67bbf18 void VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality pointer_to_this <pointer_type 0x7ffff67c20a8>> side-effects nothrow fn <addr_expr 0x7ffff64adc40 type <pointer_type 0x7ffff65ea150 type <function_type 0x7ffff65dd348> unsigned DI size <integer_cst 0x7ffff67a7be8 constant 64> unit-size <integer_cst 0x7ffff67a7c00 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality context <translation_unit_decl 0x7ffff67b1168 app.c>> constant arg:0 <function_decl 0x7ffff6699300 gimp_lebl_dialog type <function_type 0x7ffff65e11f8> addressable used nothrow public external function-specific-target function-specific-opt QI lebl-dialog.c:774:1 align:8 warn_if_not_align:0 context <translation_unit_decl 0x7ffff67b1348 lebl-dialog.c> (mem:QI (symbol_ref:DI ("gimp_lebl_dialog") [flags 0x43] <function_decl 0x7ffff6699300 gimp_lebl_dialog>) [0 S1 A8])>> gimpwindow.c:200:9 start: gimpwindow.c:200:9 finish: gimpwindow.c:200:9> Optimized dump looks as follows: ;; Function gimp_window_key_press_event (gimp_window_key_press_event, funcdef_no=194, decl_uid=6164, cgraph_uid=264, symbol_order=54507) gimp_window_key_press_event (struct GtkWidget * widget, struct GdkEventKey * event) { struct GtkWidgetClass * widget_class; static guint32 val = 0; gboolean __r; GType __t; gboolean __r; GType __t; gboolean __r; GType __t; static const char __func__[28] = <<< error >>>; gboolean handled; gboolean enable_mnemonics; GdkModifierType accel_mods; struct GtkWidget * focus; struct GtkWindow * window; struct GimpWindow * gimp_window; long unsigned int _1; long unsigned int _2; struct GTypeClass * _3; long unsigned int _4; struct GtkWidget * _9; <unnamed type> _10; unsigned int _11; unsigned int _12; unsigned int _13; unsigned int _14; unsigned int _15; unsigned int _16; unsigned int _17; struct GimpWindowPrivate * _19; struct GtkWidget * _20; unsigned int _23; unsigned int _24; <unnamed type> _25; unsigned int _26; <unnamed type> _27; unsigned int _28; unsigned int _29; unsigned int _30; <unnamed type> _31; unsigned int _32; long unsigned int _33; gboolean (*<T879>) (struct GtkWidget *, struct GdkEventKey *) _34; <unnamed type> _35; unsigned int _36; int _41; <unnamed type> _187; unsigned int prephitmp_189; unsigned int pretmp_191; struct GtkSettings * _195; int _197; unsigned int pretmp_199; struct GtkSettings * _205; int _207; <bb 2> [local count: 1073741825]: _1 = gimp_window_get_type (); gimp_window_54 = g_type_check_instance_cast (widget_52(D), _1); _2 = gtk_window_get_type (); window_56 = g_type_check_instance_cast (widget_52(D), _2); focus_58 = gtk_window_get_focus (window_56); if (focus_58 != 0B) goto <bb 3>; [70.00%] else goto <bb 11>; [30.00%] <bb 3> [local count: 751619277]: __t_59 = gtk_editable_get_type (); _3 = MEM[(struct GTypeInstance *)focus_58].g_class; if (_3 != 0B) goto <bb 4>; [70.00%] else goto <bb 43>; [30.00%] <bb 4> [local count: 526133494]: _4 = _3->g_type; if (_4 == __t_59) goto <bb 5>; [34.00%] else goto <bb 41>; [66.00%] <bb 5> [local count: 743388553]: handled_71 = gtk_window_propagate_key_event (window_56, event_69(D)); if (handled_71 != 0) goto <bb 9>; [50.00%] else goto <bb 8>; [50.00%] <bb 6> [local count: 83138624]: # __t_219 = PHI <__t_212(39), __t_210(37)> __r_66 = g_type_check_instance_is_a (focus_58, __t_219); if (__r_66 != 0) goto <bb 5>; [67.00%] else goto <bb 7>; [33.00%] <bb 7> [local count: 27435746]: _9 = gtk_widget_get_ancestor (focus_58, __t_219); if (_9 != 0B) goto <bb 5>; [70.00%] else goto <bb 11>; [30.00%] <bb 8> [local count: 371694277]: pretmp_199 = event_69(D)->keyval; goto <bb 13>; [100.00%] <bb 9> [local count: 371694276]: _10 = gimp_log_flags; _11 = _10 & 16384; if (_11 != 0) goto <bb 10>; [33.00%] else goto <bb 36>; [67.00%] <bb 10> [local count: 122659111]: gimp_log (16384, &__func__, 193, "handled by gtk_window_propagate_key_event(text_widget)"); goto <bb 36>; [100.00%] <bb 11> [local count: 330353271]: _12 = val; _13 = _12 << 8; _14 = event_69(D)->keyval; _15 = _14 & 255; _16 = _13 | _15; val = _16; _17 = _16 % 141650939; if (_17 == 62515060) goto <bb 12>; [20.24%] else goto <bb 13>; [79.76%] <bb 12> [local count: 66863502]: gimp_lebl_dialog (); pretmp_191 = event_69(D)->keyval; <bb 13> [local count: 702047548]: # prephitmp_189 = PHI <pretmp_199(8), pretmp_191(12), _14(11)> if (prephitmp_189 == 65307) goto <bb 14>; [34.00%] else goto <bb 35>; [66.00%] <bb 14> [local count: 238696166]: _19 = gimp_window_54->private; _20 = _19->primary_focus_widget; if (_20 != 0B) goto <bb 15>; [54.59%] else goto <bb 35>; [45.41%] <bb 15> [local count: 130304237]: if (_20 != focus_58) goto <bb 16>; [70.00%] else goto <bb 17>; [30.00%] <bb 16> [local count: 91212966]: gtk_widget_grab_focus (_20); goto <bb 33>; [100.00%] <bb 17> [local count: 39091271]: gtk_widget_error_bell (widget_52(D)); goto <bb 33>; [100.00%] <bb 18> [local count: 188675290]: _187 = gtk_window_get_mnemonic_modifier (window_56); accel_mods_186 = _187 | accel_mods_203; goto <bb 20>; [100.00%] <bb 19> [local count: 122659114]: gtk_window_get_mnemonic_modifier (window_56); goto <bb 33>; [100.00%] <bb 20> [local count: 471718793]: # accel_mods_218 = PHI <accel_mods_186(18), accel_mods_203(35)> _23 = event_69(D)->state; _24 = _23 & accel_mods_218; if (_24 != 0) goto <bb 21>; [33.00%] else goto <bb 24>; [67.00%] <bb 21> [local count: 155667202]: handled_86 = gtk_window_activate_key (window_56, event_69(D)); if (handled_86 != 0) goto <bb 22>; [50.00%] else goto <bb 24>; [50.00%] <bb 22> [local count: 77833601]: _25 = gimp_log_flags; _26 = _25 & 16384; if (_26 != 0) goto <bb 23>; [33.00%] else goto <bb 33>; [67.00%] <bb 23> [local count: 25685088]: gimp_log (16384, &__func__, 233, "handled by gtk_window_activate_key(modified)"); goto <bb 33>; [100.00%] <bb 24> [local count: 393885193]: handled_89 = gtk_window_propagate_key_event (window_56, event_69(D)); if (handled_89 != 0) goto <bb 25>; [50.00%] else goto <bb 34>; [50.00%] <bb 25> [local count: 155667202]: _27 = gimp_log_flags; _28 = _27 & 16384; if (_28 != 0) goto <bb 26>; [33.00%] else goto <bb 33>; [67.00%] <bb 26> [local count: 51370177]: gimp_log (16384, &__func__, 243, "handled by gtk_window_propagate_key_event(other_widget)"); goto <bb 33>; [100.00%] <bb 27> [local count: 155667202]: handled_92 = gtk_window_activate_key (window_56, event_69(D)); if (handled_92 != 0) goto <bb 28>; [50.00%] else goto <bb 30>; [50.00%] <bb 28> [local count: 77833601]: _31 = gimp_log_flags; _32 = _31 & 16384; if (_32 != 0) goto <bb 29>; [33.00%] else goto <bb 33>; [67.00%] <bb 29> [local count: 25685088]: gimp_log (16384, &__func__, 253, "handled by gtk_window_activate_key(unmodified)"); goto <bb 33>; [100.00%] <bb 30> [local count: 393885193]: _33 = g_type_parent (_2); widget_class_96 = g_type_class_peek_static (_33); _34 = widget_class_96->key_press_event; handled_98 = _34 (widget_52(D), event_69(D)); if (handled_98 != 0) goto <bb 31>; [50.00%] else goto <bb 33>; [50.00%] <bb 31> [local count: 155667202]: _35 = gimp_log_flags; _36 = _35 & 16384; if (_36 != 0) goto <bb 32>; [33.00%] else goto <bb 33>; [67.00%] <bb 32> [local count: 51370177]: gimp_log (16384, &__func__, 267, "handled by widget_class->key_press_event()"); <bb 33> [local count: 1073741825]: # _41 = PHI <1(17), 1(16), handled_92(29), handled_86(22), handled_98(32), handled_92(28), handled_86(23), handled_89(26), handled_89(25), handled_71(19), handled_98(30), handled_98(31), handled_71(36)> enable_mnemonics ={v} {CLOBBER}; return _41; <bb 34> [local count: 471718793]: _29 = event_69(D)->state; _30 = _29 & accel_mods_218; if (_30 == 0) goto <bb 27>; [33.00%] else goto <bb 30>; [67.00%] <bb 35> [local count: 571743307]: accel_mods_203 = gtk_widget_get_modifier_mask (widget_52(D), 0); _205 = gtk_widget_get_settings (widget_52(D)); g_object_get (_205, "gtk-enable-mnemonics", &enable_mnemonics, 0B); _207 = enable_mnemonics; if (_207 != 0) goto <bb 18>; [33.00%] else goto <bb 20>; [67.00%] <bb 36> [local count: 371694277]: gtk_widget_get_modifier_mask (widget_52(D), 0); _195 = gtk_widget_get_settings (widget_52(D)); g_object_get (_195, "gtk-enable-mnemonics", &enable_mnemonics, 0B); _197 = enable_mnemonics; if (_197 != 0) goto <bb 19>; [33.00%] else goto <bb 33>; [67.00%] <bb 37> [local count: 76374065]: __t_210 = gimp_canvas_get_type (); if (_4 == __t_210) goto <bb 5>; [34.00%] else goto <bb 6>; [66.00%] <bb 38> [local count: 132301528]: __r_211 = g_type_check_instance_is_a (focus_58, __t_214); if (__r_211 != 0) goto <bb 5>; [42.27%] else goto <bb 37>; [57.73%] <bb 39> [local count: 32731741]: __t_212 = gimp_canvas_get_type (); goto <bb 6>; [100.00%] <bb 40> [local count: 200456862]: __t_214 = gtk_text_view_get_type (); if (_4 == __t_214) goto <bb 5>; [34.00%] else goto <bb 38>; [66.00%] <bb 41> [local count: 347248104]: __r_215 = g_type_check_instance_is_a (focus_58, __t_59); if (__r_215 != 0) goto <bb 5>; [42.27%] else goto <bb 40>; [57.73%] <bb 42> [local count: 85910083]: __t_216 = gtk_text_view_get_type (); __r_213 = g_type_check_instance_is_a (focus_58, __t_216); if (__r_213 != 0) goto <bb 5>; [61.90%] else goto <bb 39>; [38.10%] <bb 43> [local count: 225485781]: __r_217 = g_type_check_instance_is_a (focus_58, __t_59); if (__r_217 != 0) goto <bb 5>; [61.90%] else goto <bb 42>; [38.10%] } Is it related to fact that the function is void and does not return?