1 /* PR tree-optimization/83369 - Missing diagnostics during inlining
3 { dg-options "-O2 -Wall" } */
5 extern __SIZE_TYPE__
strlen (const char *__s
)
6 __attribute ((pure
)) __attribute ((nonnull (1)));
7 extern void *memcpy (void *__restrict __dest
, const void *__restrict __src
,
8 __SIZE_TYPE__ __n
) __attribute ((nonnull (1, 2)));
18 __attribute ((nonnull (1, 2)))
20 my_strcpy (char *restrict dst
, const char *restrict src
, __SIZE_TYPE__ size
)
22 __SIZE_TYPE__ len
= strlen (src
); /* { dg-warning "argument 1 null where non-null expected" } */
24 memcpy (dst
, src
, len
+ 1); /* { dg-warning "argument 2 null where non-null expected" } */
27 memcpy (dst
, src
, size
- 1); /* { dg-warning "argument 2 null where non-null expected" } */
33 void test (struct Test
* test
)
36 my_strcpy (buf
, test
->s1
, sizeof buf
);
38 my_strcpy (buf
, test
->s2
, sizeof buf
);
40 my_strcpy (buf
, test
->s2
, sizeof buf
);
43 /* Verify that the inlining context is printed for -Wnonnull:
44 { dg-message "function .my_strcpy..*inlined from .test." "" { target *-*-* } 0 } */