(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
allocation-size-multiline-3.c
       1  /* Verify that we warn for incorrect uses of "alloca" (which may be in a 
       2     macro in a system header), and that the output looks correct.  */
       3  
       4  /* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret -fanalyzer-fine-grained" } */
       5  /* { dg-require-effective-target alloca } */
       6  
       7  #include <stdint.h>
       8  #include "test-alloca.h"
       9  
      10  void test_constant_99 (void)
      11  {
      12    int32_t *ptr = alloca (99); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
      13  }
      14  
      15  /* { dg-begin-multiline-output "" }
      16     int32_t *ptr = alloca (99);
      17                    ^~~~~~
      18    'test_constant_99': events 1-2
      19      |
      20      |   int32_t *ptr = alloca (99);
      21      |                  ^~~~~~
      22      |                  |
      23      |                  (1) allocated 99 bytes here
      24      |                  (2) assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
      25      |
      26     { dg-end-multiline-output "" } */
      27  
      28  void test_symbolic (int n)
      29  {
      30    int32_t *ptr = alloca (n * 2); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
      31  }
      32  
      33  /* { dg-begin-multiline-output "" }
      34     int32_t *ptr = alloca (n * 2);
      35                    ^~~~~~
      36    'test_symbolic': events 1-2
      37      |
      38      |   int32_t *ptr = alloca (n * 2);
      39      |                  ^~~~~~
      40      |                  |
      41      |                  (1) allocated 'n * 2' bytes here
      42      |                  (2) assigned to 'int32_t *' {aka '{re:long :re?}int *'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
      43      |
      44     { dg-end-multiline-output "" } */