1  /* { dg-do compile } */
       2  /* { dg-require-effective-target noinit } */
       3  /* { dg-options "-Wattributes" } */
       4  
       5  /* Check warning/error messages for "noinit" attribute misuse.  */
       6  int __attribute__((noinit)) noinit_fn (void); /* { dg-warning "ignoring 'noinit' attribute not set on a variable" } */
       7  int __attribute__((section ("mysection"), noinit)) noinit_section1; /* { dg-warning "because it conflicts with attribute" } */
       8  int __attribute__((noinit, section ("mysection"))) noinit_section2; /* { dg-warning "because it conflicts with attribute" } */
       9  const int __attribute__((noinit)) noinit_const; /* { dg-warning "ignoring 'noinit' attribute set on const variable" } */
      10  /* { dg-error "uninitialized 'const noinit_const'" "" { target c++ } .-1 } */
      11  int __attribute__((noinit)) noinit_init = 42; /* { dg-warning "ignoring 'noinit' attribute set on initialized variable" } */
      12  void foo (void) { int __attribute__((noinit)) local_noinit; } /* { dg-error "'noinit' attribute cannot be specified for local variables" } */