Skip several analyzer socket tests on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / allocation-size-multiline-1.c
blobde1a49c436e82ff5b35a76ce267b76d42495d486
1 /* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
3 #include <stdint.h>
5 void test_constant_1 (void)
7 int32_t *ptr = (int32_t *) __builtin_malloc (1); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
8 __builtin_free (ptr);
11 /* { dg-begin-multiline-output "" }
12 int32_t *ptr = (int32_t *) __builtin_malloc (1);
13 ^~~~~~~~~~~~~~~~~~~~
14 'test_constant_1': events 1-2
16 | int32_t *ptr = (int32_t *) __builtin_malloc (1);
17 | ^~~~~~~~~~~~~~~~~~~~
18 | |
19 | (1) allocated 1 byte here
20 | (2) assigned to 'int32_t *'
22 { dg-end-multiline-output "" { target c } } */
23 /* { dg-begin-multiline-output "" }
24 int32_t *ptr = (int32_t *) __builtin_malloc (1);
25 ~~~~~~~~~~~~~~~~~^~~
26 'void test_constant_1()': events 1-2
28 | int32_t *ptr = (int32_t *) __builtin_malloc (1);
29 | ~~~~~~~~~~~~~~~~~^~~
30 | |
31 | (1) allocated 1 byte here
32 | (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
34 { dg-end-multiline-output "" { target c++ } } */
36 void test_constant_2 (void)
38 int32_t *ptr = (int32_t *) __builtin_malloc (2); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
39 __builtin_free (ptr);
42 /* { dg-begin-multiline-output "" }
43 int32_t *ptr = (int32_t *) __builtin_malloc (2);
44 ^~~~~~~~~~~~~~~~~~~~
45 'test_constant_2': events 1-2
47 | int32_t *ptr = (int32_t *) __builtin_malloc (2);
48 | ^~~~~~~~~~~~~~~~~~~~
49 | |
50 | (1) allocated 2 bytes here
51 | (2) assigned to 'int32_t *'
53 { dg-end-multiline-output "" { target c } } */
55 /* { dg-begin-multiline-output "" }
56 int32_t *ptr = (int32_t *) __builtin_malloc (2);
57 ~~~~~~~~~~~~~~~~~^~~
58 'void test_constant_2()': events 1-2
60 | int32_t *ptr = (int32_t *) __builtin_malloc (2);
61 | ~~~~~~~~~~~~~~~~~^~~
62 | |
63 | (1) allocated 2 bytes here
64 | (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
66 { dg-end-multiline-output "" { target c++ } } */
68 void test_symbolic (int n)
70 int32_t *ptr = (int32_t *) __builtin_malloc (n * 2); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
71 __builtin_free (ptr);
74 /* { dg-begin-multiline-output "" }
75 int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
76 ^~~~~~~~~~~~~~~~~~~~~~~~
77 'test_symbolic': event 1
79 | int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
80 | ^~~~~~~~~~~~~~~~~~~~~~~~
81 | |
82 | (1) allocated 'n * 2' bytes and assigned to 'int32_t *'
84 { dg-end-multiline-output "" { target c } } */
86 /* { dg-begin-multiline-output "" }
87 int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
88 ~~~~~~~~~~~~~~~~~^~~~~~~
89 'void test_symbolic(int)': event 1
91 | int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
92 | ~~~~~~~~~~~~~~~~~^~~~~~~
93 | |
94 | (1) allocated '(n * 2)' bytes and assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
96 { dg-end-multiline-output "" { target c++ } } */