typedef __SIZE_TYPE__ size_t;
+/* Prevent equivalent functions from being merged. */
+#define NOIPA __attribute__ ((noipa))
+
#ifndef LINE
# define LINE 0
#endif
argument is in a known range of lengths and one or both of which
exceed the size of the destination. */
-void test_sprintf_chk_string (const char *s, const char *t)
+NOIPA void test_sprintf_chk_string (const char *s, const char *t)
{
#define x x ()
/* Verify that the checker makes use of integer constant propagation
to detect buffer overflow in non-constant cases. */
-void test_sprintf_chk_integer_value (void)
+NOIPA void test_sprintf_chk_integer_value (void)
{
T ( 1, "%i", i ( 0)); /* { dg-warning "nul past the end" } */
T ( 1, "%i", i ( 1)); /* { dg-warning "nul past the end" } */
return val < min || max < val ? min : val;
}
-void test_sprintf_chk_range_schar (void)
+NOIPA void test_sprintf_chk_range_schar (void)
{
#define R(min, max) range_sint (min, max)
T ( 6, "%.3i|%.2i/%i", R (0, 1), R (0, 2), R (0, 3)); /* { dg-warning "./. directive writing 1 byte into a region of size 0" } */
}
-void test_sprintf_chk_range_uchar (void)
+NOIPA void test_sprintf_chk_range_uchar (void)
{
#undef R
#define R(min, max) range_uchar (min, max)
T ( 3, "%i", R (0, 100)); /* { dg-warning "may write a terminating nul past the end of the destination" } */
}
-void test_sprintf_chk_range_sshrt (void)
+NOIPA void test_sprintf_chk_range_sshrt (void)
{
#undef R
#define R(min, max) range_sshrt (min, max)
T ( 4, "%i", R (999, 1000)); /* { dg-warning "may write a terminating nul past the end of the destination" } */
}
-void test_sprintf_chk_range_ushrt (void)
+NOIPA void test_sprintf_chk_range_ushrt (void)
{
#undef R
#define R(min, max) range_ushrt (min, max)
T ( 4, "%i", R (999, 1000)); /* { dg-warning "may write a terminating nul past the end of the destination" } */
}
-void test_sprintf_chk_range_sint (void)
+NOIPA void test_sprintf_chk_range_sint (void)
{
#undef R
#define R(min, max) range_sint (min, max)
T ( 4, "%i", R (999, 1000)); /* { dg-warning "may write a terminating nul past the end of the destination" } */
}
-void test_sprintf_chk_range_uint (void)
+NOIPA void test_sprintf_chk_range_uint (void)
{
#undef R
#define R(min, max) range_uint (min, max)
fail. The latter because due to the limit of ptrdiff_t no object
can be larger than PTRDIFF_MAX bytes. */
-void test_too_large (char *d, int x, __builtin_va_list va)
+NOIPA void test_too_large (char *d, int x, __builtin_va_list va)
{
const size_t imax = __INT_MAX__;
const size_t imax_p1 = imax + 1;
#define TEST_SPRINTF(d, maxsize, objsize, fmt, ...) \
__builtin_sprintf (d, fmt, __VA_ARGS__)
-void test_sprintf_malloc (const char *s, const char *t)
+NOIPA void test_sprintf_malloc (const char *s, const char *t)
{
#define x x ()
#undef ALLOC
#define ALLOC(p, n) (p) = __builtin_alloca (n)
-void test_sprintf_alloca (const char *s, const char *t)
+NOIPA void test_sprintf_alloca (const char *s, const char *t)
{
#define x x ()
#undef ALLOC
#define ALLOC(p, n) char vla [i (n)]; (p) = vla
-void test_sprintf_vla (const char *s, const char *t)
+NOIPA void test_sprintf_vla (const char *s, const char *t)
{
#define x x ()