view gcc/testsuite/gcc.dg/uninit-pr19430-O0.c @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do compile } */
/* { dg-options "-O0 -Wuninitialized" } */
extern int bar (int);
extern void baz (int *);

int
foo (int i)
{
  int j; /* { dg-warning "'j' may be used uninitialized in this function" "uninitialized" { xfail *-*-* } } */

  if (bar (i)) {
    baz (&j);
  } else {
  }

  return j;
}

int foo2( void ) {
  int rc;
  return rc; /* { dg-warning "'rc' is used uninitialized in this function" } */
  *&rc = 0;
}

extern int printf(const char *, ...);
void frob(int *pi);

int main(void)
{
  int i; 
  printf("i = %d\n", i); /* { dg-warning "'i' is used uninitialized in this function" } */
  frob(&i);

  return 0;
}

void foo3(int*);
void bar3(void) { 
  int x; 
  if(x) /* { dg-warning "'x' is used uninitialized in this function" } */
    foo3(&x); 
}