Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/ext/strncpy-chk1.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 // PR c++/40502 | 1 // PR c++/40502 - [4.5 Regression] crash in cp_diagnostic_starter |
2 // { dg-do compile } | 2 // { dg-do compile } |
3 // { dg-options "-O2" } | 3 // { dg-options "-O2" } |
4 // { dg-skip-if "packed attribute missing for struct A" { "epiphany-*-*" } } | 4 // { dg-skip-if "packed attribute missing for struct A" { "epiphany-*-*" } } |
5 | 5 |
6 struct A { char x[12], y[35]; }; | 6 struct A { char x[12], y[35]; }; |
7 struct B { char z[50]; }; | 7 struct B { char z[50]; }; |
8 | 8 |
9 inline void | 9 inline void |
10 foo (char *dest, const char *__restrict src, __SIZE_TYPE__ n) | 10 foo (char *dest, const char *__restrict src, __SIZE_TYPE__ n) |
11 { | 11 { |
12 __builtin___strncpy_chk (dest, src, n, __builtin_object_size (dest, 0)); // { dg-warning "specified bound 36 exceeds destination size 35" } | 12 // This triggers a -Wstringop-overflow warning (pruned below). |
13 __builtin___strncpy_chk (dest, src, n, __builtin_object_size (dest, 0)); | |
13 } | 14 } |
14 | 15 |
15 void bar (const char *, int); | 16 void bar (const char *, int); |
16 | 17 |
17 inline void | 18 inline void |
28 void | 29 void |
29 test () | 30 test () |
30 { | 31 { |
31 baz (0); | 32 baz (0); |
32 } | 33 } |
34 | |
35 // { dg-prune-output "\\\[-Wstringop-overflow=]" } |