view gcc/testsuite/gcc.dg/tree-ssa/pr79275.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* PR middle-end/79275 - -Wformat-overflow false positive exceeding INT_MAX
   in glibc sysdeps/posix/tempname.c
   { dg-do compile }
   { dg-options "-O2 -Wall -Wformat-overflow=1 -ftrack-macro-expansion=0" } */

typedef __SIZE_TYPE__ size_t;

void f (char *dst, size_t n, const char *s)
{
  if (n < 2 || __INT_MAX__ - 2 < n)
    n = 2;

  __builtin_sprintf (dst, "%.*s %.*s", (int)n, s, (int)n, s);   /* { dg-bogus "INT_MAX" } */
}