aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wobjsize-1.c
blob: 988b8bcbf35d8ff2635c196fa7ec6c8a501ddcec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* { dg-do compile } */
/* { dg-options "-O2 -Wall -Wno-array-bounds" } */

#include "Wobjsize-1.h"

char buf[6];

int main(int argc, char **argv)
{
  strcpy (buf,"hello ");
  return 0;
}

/* { dg-warning "\\\[-Wstringop-overflow" "warning" { target *-*-* } 0 }
   { dg-message "file included" "included" { target *-*-* } 0 }
   { dg-message "inlined from" "inlined" { target *-*-* } 0 }

   The test might emit two warnings, one for the strcpy call and
   another for the inlined call to __builtin___strcpy_chk() called
   from strcpy().
   { dg-prune-output "writing 7 bytes into a region of size 6" } */