Home | History | Annotate | Download | only in output_tests
      1 #include <stdio.h>
      2 
      3 __attribute__((noinline))
      4 char *Ident(char *x) {
      5   fprintf(stderr, "1: %p\n", x);
      6   return x;
      7 }
      8 
      9 __attribute__((noinline))
     10 char *Func1() {
     11   char local;
     12   return Ident(&local);
     13 }
     14 
     15 __attribute__((noinline))
     16 void Func2(char *x) {
     17   fprintf(stderr, "2: %p\n", x);
     18   *x = 1;
     19   // Check-Common: {{WRITE of size 1 .* thread T0}}
     20   // Check-Common: {{    #0.*Func2.*stack-use-after-return.cc:18}}
     21   // Check-Common: {{is located in frame <.*Func1.*> of T0's stack}}
     22 }
     23 
     24 int main(int argc, char **argv) {
     25   Func2(Func1());
     26   return 0;
     27 }
     28