------- Comment #12 from rguenth at gcc dot gnu dot org 2010-05-05 13:13
-------
I see
extern char bb_common_bufsiz1[COMMON_BUFSIZE];
static void add_input_file(FILE *file)
{
fprintf(stderr, "Adding input file %x.\n", file);
(*(struct globals*)&bb_common_bufsiz1).input_file_list =
xrealloc_vector_helper(((*(struct
globals*)&bb_common_bufsiz1).input_file_list), (sizeof(((*(struct
globals*)&bb_common_bufsiz1).input_file_list)[0]) << 8) + (2), ((*(struct
globals*)&bb_common_bufsiz1).input_file_count));
(*(struct globals*)&bb_common_bufsiz1).input_file_list[(*(struct
globals*)&bb_common_bufsiz1).input_file_count++] = file;
fprintf(stderr, "Added input file %x.\n", (*(struct
globals*)&bb_common_bufsiz1).input_file_list[(*(struct
globals*)&bb_common_bufsiz1).input_file_count-1]);
}
and the store to (*(struct
globals*)&bb_common_bufsiz1).input_file_list[(*(struct
globals*)&bb_common_bufsiz1).input_file_count++] is indeed DSEd
at -O1 or by DCE if the printfs are removed.
Testcase:
extern char B[256 * sizeof(void *)];
typedef void *FILE;
typedef struct globals {
int c;
FILE **l;
} T;
void* xrealloc(void *vector, unsigned sizeof_and_shift, int idx);
void add_input_file(FILE *file)
{
(*(T*)&B).l = xrealloc(((*(T*)&B).l),
(sizeof(((*(T*)&B).l)[0]) << 8) + (2),
((*(T*)&B).c));
(*(T*)&B).l[(*(T*)&B).c++] = file;
}
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-05-05 13:13:26
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43987