[Bug rtl-optimization/46387] [4.6 Regression] ICE in add_stores, at var-tracking.c:5415
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46387 --- Comment #1 from Richard Guenther rguenth at gcc dot gnu.org 2010-11-09 11:01:31 UTC --- Created attachment 22341 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=22341 required stack-protector support patch Required patch. Reducing.
[Bug rtl-optimization/46387] [4.6 Regression] ICE in add_stores, at var-tracking.c:5415
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46387 Richard Guenther rguenth at gcc dot gnu.org changed: What|Removed |Added Target Milestone|--- |4.6.0 --- Comment #2 from Richard Guenther rguenth at gcc dot gnu.org 2010-11-09 11:35:35 UTC --- Reduced testcase, no longer requires stack-protector: typedef signed short gint16; typedef int gint; typedef double gdouble; typedef struct _GdkDrawable GdkPixmap; typedef struct _GdkDrawable GdkWindow; typedef enum { GDK_BUTTON1_MASK = 1 8 } GdkModifierType; typedef struct _GdkEventMotion GdkEventMotion; struct _GdkEventMotion { GdkWindow *window; gdouble x; gdouble y; gint16 is_hint; }; typedef struct _GtkWidget GtkWidget; typedef struct { unsigned char width; } gn_bmp; GdkPixmap *drawingPixmap = ((void *)0); int mouseButtonPushed = 0; gn_bmp bitmap, oldBitmap; int activeTool = 0; gint DrawingAreaMotionNotifyEvent(GtkWidget * widget, GdkEventMotion * event) { int x, y; GdkModifierType state; if (!mouseButtonPushed activeTool != 0) return (!(0)); if (event-is_hint) gdk_window_get_pointer(x, y, state); else { x = event-x; y = event-y; } x = x / (5 + 1); y = y / (5 + 1); if (x 0) x = 0; if (x bitmap.width - 1) x = bitmap.width - 1; switch (activeTool) { case 0: ToolBrush(widget, x, y, 1); } return (!(0)); } ./cc1 -quiet xgnokii_logos.3.i -O2 -g xgnokii_logos.3.i: In function 'DrawingAreaMotionNotifyEvent': xgnokii_logos.3.i:48:1: internal compiler error: in add_stores, at var-tracking.c:5415 Please submit a full bug report, with preprocessed source if appropriate. See http://bugs.opensuse.org/ for instructions. reproducible with a cross to ia64-linux.
[Bug rtl-optimization/46387] [4.6 Regression] ICE in add_stores, at var-tracking.c:5415
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46387 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek jakub at gcc dot gnu.org 2010-11-09 13:19:45 UTC --- Reduced testcase: struct S { double x; double y; short z; }; int a = 0, b = 0, c; void bar (int, int, int); void baz (int *, int *, int *); void foo (struct S *v) { int x, y, z; if (!a b != 0) return; if (v-z) baz (x, y, z); else { x = v-x; y = v-y; } x = x / (5 + 1); y = y / (5 + 1); if (x 0) x = 0; if (x c - 1) x = c - 1; if (b == 0) bar (x, y, 1); return; } Looking into it.
[Bug rtl-optimization/46387] [4.6 Regression] ICE in add_stores, at var-tracking.c:5415
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46387 --- Comment #4 from Jakub Jelinek jakub at gcc dot gnu.org 2010-11-09 15:20:47 UTC --- The interesting insns here are: (insn:TI 70 272 60 5 (set (reg:BI 262 p6 [394]) (ge:BI (reg:SI 16 r16 [orig:347 prephitmp.13 ] [347]) (const_int 0 [0]))) pr46387.c:21 318 {*cmpsi_adjusted} (nil)) (insn 60 70 271 5 (set (mem/c/i:SI (reg/f:DI 32 r33 [409]) [2 x+0 S4 A64]) (reg:SI 16 r16 [380])) pr46387.c:19 4 {movsi_internal} (nil)) ... (insn:TI 75 270 251 5 (cond_exec (eq (reg:BI 262 p6 [394]) (const_int 0 [0])) (set (mem/c/i:SI (reg/f:DI 32 r33 [409]) [2 x+0 S4 A64]) (const_int 0 [0]))) pr46387.c:22 813 {*p movsi_internal} (nil)) ... (insn 57 65 253 5 (set (reg:SI 14 r14 [orig:347 prephitmp.13 ] [347]) (reg:SI 16 r16 [380])) pr46387.c:19 4 {movsi_internal} (expr_list:REG_DEAD (reg:SI 16 r16 [380]) (nil))) ... (insn 4 140 254 5 (cond_exec (eq (reg:BI 262 p6 [394]) (const_int 0 [0])) (set (reg:SI 14 r14 [orig:347 prephitmp.13 ] [347]) (const_int 0 [0]))) pr46387.c:22 813 {*p movsi_internal} (nil)) We use the same VALUE for r14 in insn 4 as for (if_then_else (eq (p6) (0)) (0) (r14)).
[Bug rtl-optimization/46387] [4.6 Regression] ICE in add_stores, at var-tracking.c:5415
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46387 --- Comment #5 from Jakub Jelinek jakub at gcc dot gnu.org 2010-11-09 17:48:04 UTC --- The problem is when processing (insn:TI 75 270 251 5 (cond_exec (eq (reg:BI 262 p6 [394]) (const_int 0 [0])) (set (mem/c/i:SI (reg/f:DI 32 r33 [409]) [2 x+0 S4 A64]) (const_int 0 [0]))) pr46387.c:22 813 {*p movsi_internal} (nil)) we don't invalidate the old mem content. cselib_invalidate_mem is called with mem_rtx: (mem/c/i:SI (reg/f:DI 32 r33 [409]) [2 x+0 S4 A64]) and we see x: (mem/c/i:SI (value/u:DI 23:3920 @0x16199f0/0x1623ec0) [2 x+0 S4 A64]) But canon_true_dependence (mem_rtx, GET_MODE (mem_rtx), mem_addr, x, NULL_RTX, cselib_rtx_varies_p) returns 0, which means it is not invalidated. debug_rtx (((cselib_val *)0x1623ec0)-locs-loc) shows: (reg/f:DI 32 r33 [409]) debug_rtx (((cselib_val *)0x1623ec0)-locs-next-loc) shows: (plus:DI (value/u:DI 1:1 @0x16197e0/0x166c490) (const_int -8 [0xfff8])) and that is the whole list. VALUE 1:1 has only one living location: (reg/f:DI 0 ap) find_base_term of r33 gives r12 as base though (as init_alias_analysis has been run before vt_initialize and doesn't know about the munging vt_initialize performs to replace sp or hfp (+ offset) with cfa_base_rtx (which is either argp or fp). I guess we want to (temporarily, for the rest of var-tracking) set REG_BASE_VALUE (cfa_base_rtx) to REG_BASE_VALUE (frame_pointer_needed ? hard_frame_pointer_rtx : stack_pointer_rtx).