OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [ext/] [strncpy-chk1.C] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// PR c++/40502
2
// { dg-do compile }
3
// { dg-options "-O2" }
4
 
5
struct A { char x[12], y[35]; };
6
struct B { char z[50]; };
7
 
8
inline void
9
foo (char *dest, const char *__restrict src, __SIZE_TYPE__ n)
10
{
11
  __builtin___strncpy_chk (dest, src, n, __builtin_object_size (dest, 0));      // { dg-warning "will always overflow" }
12
}
13
 
14
void bar (const char *, int);
15
 
16
inline void
17
baz (int i)
18
{
19
  char s[128], t[32];
20
  bar (s, 0);
21
  bar (t, i);
22
  A a;
23
  B b;
24
  foo (a.y, b.z, 36);
25
}
26
 
27
void
28
test ()
29
{
30
  baz (0);
31
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.