(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
allocation-size-multiline-2.c
       1  /* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret -fanalyzer-fine-grained" } */
       2  /* { dg-require-effective-target alloca } */
       3  
       4  #include <stdint.h>
       5  
       6  void test_constant_1 (void)
       7  {
       8    int32_t *ptr = __builtin_alloca (1); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
       9  }
      10  
      11  /* { dg-begin-multiline-output "" }
      12     int32_t *ptr = __builtin_alloca (1);
      13                    ^~~~~~~~~~~~~~~~~~~~
      14    'test_constant_1': events 1-2
      15      |
      16      |   int32_t *ptr = __builtin_alloca (1);
      17      |                  ^~~~~~~~~~~~~~~~~~~~
      18      |                  |
      19      |                  (1) allocated 1 byte here
      20      |                  (2) assigned to 'int32_t *'
      21      |
      22     { dg-end-multiline-output "" } */
      23  
      24  void test_constant_2 (void)
      25  {
      26    int32_t *ptr = __builtin_alloca (2); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
      27  }
      28  
      29  /* { dg-begin-multiline-output "" }
      30     int32_t *ptr = __builtin_alloca (2);
      31                    ^~~~~~~~~~~~~~~~~~~~
      32    'test_constant_2': events 1-2
      33      |
      34      |   int32_t *ptr = __builtin_alloca (2);
      35      |                  ^~~~~~~~~~~~~~~~~~~~
      36      |                  |
      37      |                  (1) allocated 2 bytes here
      38      |                  (2) assigned to 'int32_t *'
      39      |
      40     { dg-end-multiline-output "" } */
      41  
      42  void test_symbolic (int n)
      43  {
      44    int32_t *ptr = __builtin_alloca (n * 2); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
      45  }
      46  
      47  /* { dg-begin-multiline-output "" }
      48     int32_t *ptr = __builtin_alloca (n * 2);
      49                    ^~~~~~~~~~~~~~~~~~~~~~~~
      50    'test_symbolic': events 1-2
      51      |
      52      |   int32_t *ptr = __builtin_alloca (n * 2);
      53      |                  ^~~~~~~~~~~~~~~~~~~~~~~~
      54      |                  |
      55      |                  (1) allocated 'n * 2' bytes here
      56      |                  (2) assigned to 'int32_t *'
      57      |
      58     { dg-end-multiline-output "" } */
      59  
      60  /* FIXME: am getting a duplicate warning here for some reason
      61     without -fanalyzer-fine-grained (PR PR analyzer/107851).  */
      62