1 /* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
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" } */
11 /* { dg-begin-multiline-output "" }
12 int32_t *ptr = (int32_t *) __builtin_malloc (1);
14 'test_constant_1': events 1-2
15 int32_t *ptr = (int32_t *) __builtin_malloc (1);
18 (1) allocated 1 byte here
19 (2) assigned to 'int32_t *'
20 { dg-end-multiline-output "" { target c } } */
21 /* { dg-begin-multiline-output "" }
22 int32_t *ptr = (int32_t *) __builtin_malloc (1);
24 'void test_constant_1()': events 1-2
25 int32_t *ptr = (int32_t *) __builtin_malloc (1);
28 (1) allocated 1 byte here
29 (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
30 { dg-end-multiline-output "" { target c++ } } */
32 void test_constant_2 (void)
34 int32_t *ptr
= (int32_t *) __builtin_malloc (2); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
38 /* { dg-begin-multiline-output "" }
39 int32_t *ptr = (int32_t *) __builtin_malloc (2);
41 'test_constant_2': events 1-2
42 int32_t *ptr = (int32_t *) __builtin_malloc (2);
45 (1) allocated 2 bytes here
46 (2) assigned to 'int32_t *'
47 { dg-end-multiline-output "" { target c } } */
49 /* { dg-begin-multiline-output "" }
50 int32_t *ptr = (int32_t *) __builtin_malloc (2);
52 'void test_constant_2()': events 1-2
53 int32_t *ptr = (int32_t *) __builtin_malloc (2);
56 (1) allocated 2 bytes here
57 (2) assigned to 'int32_t*' {aka '{re:long :re?}int*'} here; 'sizeof (int32_t {aka {re:long :re?}int})' is '4'
58 { dg-end-multiline-output "" { target c++ } } */
60 void test_symbolic (int n
)
62 int32_t *ptr
= (int32_t *) __builtin_malloc (n
* 2); /* { dg-warning "allocated buffer size is not a multiple of the pointee's size" } */
66 /* { dg-begin-multiline-output "" }
67 int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
68 ^~~~~~~~~~~~~~~~~~~~~~~~
69 'test_symbolic': event 1
70 int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
71 ^~~~~~~~~~~~~~~~~~~~~~~~
73 (1) allocated 'n * 2' bytes and assigned to 'int32_t *'
74 { dg-end-multiline-output "" { target c } } */
76 /* { dg-begin-multiline-output "" }
77 int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
78 ~~~~~~~~~~~~~~~~~^~~~~~~
79 'void test_symbolic(int)': event 1
80 int32_t *ptr = (int32_t *) __builtin_malloc (n * 2);
81 ~~~~~~~~~~~~~~~~~^~~~~~~
83 (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'
84 { dg-end-multiline-output "" { target c++ } } */