(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
Walloc-size-larger-than-14.c
       1  /* PR middle-end/82063 - issues with arguments enabled by -Wall
       2     { dg-do compile }
       3     { dg-options "-O -Walloc-size-larger-than=123456789123456789123456789123456789 -ftrack-macro-expansion=0" } */
       4  
       5  typedef __SIZE_TYPE__ size_t;
       6  
       7  void sink (void*);
       8  
       9  #define T(x) sink (x)
      10  
      11  /* Verify that an exceedingly large -Walloc-size-larger-than argument
      12     with no suffix is accepted and treated as infinite.  */
      13  
      14  void f (void)
      15  {
      16    size_t n = 0;
      17    T (__builtin_malloc (n));
      18  
      19    n = __PTRDIFF_MAX__;
      20    T (__builtin_malloc (n));
      21  
      22    n += 1;
      23    T (__builtin_malloc (n));
      24  
      25    n = __SIZE_MAX__ - 1;
      26    T (__builtin_malloc (n));
      27  
      28    n = __SIZE_MAX__;
      29    T (__builtin_malloc (n));
      30  }