------- Additional Comments From jakub at gcc dot gnu dot org  2005-05-27 17:14 
-------
I can't reproduce the segfault, but that's only because the problem manifests
as use of uninitialized variable.

/* PR c/21536 */
/* { dg-do compile } */
/* { dg-options "-O2 -Wuninitialized" } */

typedef __SIZE_TYPE__ size_t;
extern void *malloc (size_t);

void
foo (int x, int y)
{
  void *d = malloc (10 * 10 * sizeof (double));
  double (*e)[x][y] = d;
  if (x > 8)
    (*e)[x - 2][y - 2] = 0.0;
  else
    (*e)[x - 1][y - 1] = 1.0;
}

int
main ()
{
  foo (10, 10);
  return 0;
}

reproduces the problem reliably (by checking if it issued a bogus warning:
warning: '.0' is used uninitialized in this function).


-- 


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

Reply via email to