(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
allocation-size-multiline-1.c
       1  /* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
       2  
       3  #include <stdint.h>
       4  
       5  void test_constant_1 (void)
       6  {
       7    int32_t *ptr = __builtin_malloc (1); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
       8    __builtin_free (ptr);
       9  }
      10  
      11  /* { dg-begin-multiline-output "" }
      12     int32_t *ptr = __builtin_malloc (1);
      13                    ^~~~~~~~~~~~~~~~~~~~
      14    'test_constant_1': events 1-2
      15      |
      16      |   int32_t *ptr = __builtin_malloc (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_malloc (2); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
      27    __builtin_free (ptr);
      28  }
      29  
      30  /* { dg-begin-multiline-output "" }
      31     int32_t *ptr = __builtin_malloc (2);
      32                    ^~~~~~~~~~~~~~~~~~~~
      33    'test_constant_2': events 1-2
      34      |
      35      |   int32_t *ptr = __builtin_malloc (2);
      36      |                  ^~~~~~~~~~~~~~~~~~~~
      37      |                  |
      38      |                  (1) allocated 2 bytes here
      39      |                  (2) assigned to 'int32_t *'
      40      |
      41     { dg-end-multiline-output "" } */
      42  
      43  void test_symbolic (int n)
      44  {
      45    int32_t *ptr = __builtin_malloc (n * 2); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
      46    __builtin_free (ptr);
      47  }
      48  
      49  /* { dg-begin-multiline-output "" }
      50     int32_t *ptr = __builtin_malloc (n * 2);
      51                    ^~~~~~~~~~~~~~~~~~~~~~~~
      52    'test_symbolic': event 1
      53      |
      54      |   int32_t *ptr = __builtin_malloc (n * 2);
      55      |                  ^~~~~~~~~~~~~~~~~~~~~~~~
      56      |                  |
      57      |                  (1) allocated 'n * 2' bytes and assigned to 'int32_t *'
      58      |
      59     { dg-end-multiline-output "" } */