[Bug c/91254] Wrong generate code with a series of array access
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jul 24 22:30:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91254
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |msebor at gcc dot gnu.org
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
I only quickly glanced at the attached test program but the first thing I
noticed is that the memset call clears only a subset of the array elements. If
the rest of the test case depends on the array being zeroed out as it seems to
it's not going to behave predictably.
#define ARRAY_SIZE 128000
int main(int argc, char **argv)
{
int casas = argc == 2 ? atoi(argv[1]) : 1000;
int x[ARRAY_SIZE];
int xc;
memset(x, 0, ARRAY_SIZE); <<<
Presumably this should be:
memset(x, 0, sizeof x);
More information about the Gcc-bugs
mailing list