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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [ext/] [strncpy-chk1.C] - Blame information for rev 399

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// PR c++/40502
2
// { dg-do compile }
3
// { dg-options "-O2" }
4
 
5 399 jeremybenn
struct A { char x[12], y[35]; }; // change to y[32] to get warning on or32
6 301 jeremybenn
struct B { char z[50]; };
7
 
8
inline void
9
foo (char *dest, const char *__restrict src, __SIZE_TYPE__ n)
10
{
11 399 jeremybenn
  __builtin___strncpy_chk (dest, src, n, __builtin_object_size (dest, 0));      // { dg-warning "will always overflow" "" { target { ! or32-*-* } } }
12 301 jeremybenn
}
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.