[Bug target/59363] [4.9 Regression] r203886 miscompiles git
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Dec 2 20:49:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59363
--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> ---
A testcase:
[hjl@gnu-6 pr59363]$ cat x.h
typedef struct s_mmbuffer {
char *ptr;
long size;
} mmbuffer_t;
typedef struct s_mmfile {
char *ptr;
long size;
} mmfile_t;
typedef struct s_xpparam {
unsigned long flags;
} xpparam_t;
typedef long (*find_func_t)(const char *line, long line_len, char *buffer, long
buffer_size, void *priv);
typedef int (*xdl_emit_hunk_consume_func_t)(void);
typedef struct s_xdemitconf {
long ctxlen;
long interhunkctxlen;
unsigned long flags;
find_func_t find_func;
void *find_func_priv;
xdl_emit_hunk_consume_func_t hunk_func;
} xdemitconf_t;
typedef struct s_xdemitcb {
void *priv;
int (*outf)(void *, mmbuffer_t *, int);
} xdemitcb_t;
extern int xdi_diff(xpparam_t const *xpp,
xdemitconf_t const *xecfg, xdemitcb_t *ecb);
extern int diff_hunks(long ctxlen, xdl_emit_hunk_consume_func_t hunk_func,
void *cb_data);
[hjl@gnu-6 pr59363]$ cat x.c
#include "x.h"
int
xdi_diff(xpparam_t const *xpp,
xdemitconf_t const *xecfg, xdemitcb_t *ecb)
{
if (xecfg->hunk_func == 0)
__builtin_abort ();
return 0;
}
int hunk_func (void)
{
return 0;
}
int
main ()
{
return diff_hunks (1, hunk_func, (void *) 0);
}
[hjl@gnu-6 pr59363]$ cat y.c
#include "x.h"
int diff_hunks(long ctxlen, xdl_emit_hunk_consume_func_t hunk_func,
void *cb_data)
{
xpparam_t xpp = {0};
xdemitconf_t xecfg = {0};
xdemitcb_t ecb = {((void *)0)};
xpp.flags = 0;
xecfg.ctxlen = ctxlen;
xecfg.hunk_func = hunk_func;
ecb.priv = cb_data;
return xdi_diff(&xpp, &xecfg, &ecb);
}
[hjl@gnu-6 pr59363]$ make
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -mtune=amdfam10 -c -o x.o
x.c
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -mtune=amdfam10 -c -o y.o
y.c
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -mtune=amdfam10 -o x x.o
y.o
./x
make: *** [all] Aborted
[hjl@gnu-6 pr59363]$
More information about the Gcc-bugs
mailing list