[Bug target/59363] [4.9 Regression] r203886 miscompiles git

octoploid at yandex dot com gcc-bugzilla@gcc.gnu.org
Mon Dec 2 15:51:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59363

--- Comment #5 from Markus Trippelsdorf <octoploid at yandex dot com> ---
(In reply to Markus Trippelsdorf from comment #2)
> 22209 static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen,
> 22210         xdl_emit_hunk_consume_func_t hunk_func, void *cb_data)
> 22211 {
> 22212  xpparam_t xpp = {0};
> 22213  xdemitconf_t xecfg = {0};
> 22214  xdemitcb_t ecb = {((void *)0)};
> 22215
> 22216  xpp.flags = xdl_opts;
> 22217  xecfg.ctxlen = ctxlen;
> 22218  xecfg.hunk_func = hunk_func;
> 22219  ecb.priv = cb_data;
> 22220  return xdi_diff(file_a, file_b, &xpp, &xecfg, &ecb);
> 22221 }
> 22222

The problem seems to be that xecfg.hunk_func is empty even though
hunk_func is not. 
So the assignment might get overwritten by the initialization.

...
(gdb) up
#5  0x00000000004104df in diff_hunks (file_a=<optimized out>, file_b=<optimized
out>, ctxlen=ctxlen@entry=0, hunk_func=hunk_func@entry=0x411320
<blame_chunk_cb>, 
    cb_data=cb_data@entry=0x7fffffffd830) at builtin/blame.c:105
105             return xdi_diff(file_a, file_b, &xpp, &xecfg, &ecb);
(gdb) l
100
101             xpp.flags = xdl_opts;
102             xecfg.ctxlen = ctxlen;
103             xecfg.hunk_func = hunk_func;
104             ecb.priv = cb_data;
105             return xdi_diff(file_a, file_b, &xpp, &xecfg, &ecb);
106     }
107
108     /*
109      * Prepare diff_filespec and convert it using diff textconv API
(gdb) p hunk_func
$1 = (xdl_emit_hunk_consume_func_t) 0x411320 <blame_chunk_cb>
(gdb) p xecfg.hunk_func
$2 = (xdl_emit_hunk_consume_func_t) 0x0



More information about the Gcc-bugs mailing list