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
16 | int32_t *ptr = (int32_t *) __builtin_malloc (1);
17 | ^~~~~~~~~~~~~~~~~~~~
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);
26 'void test_constant_1()': events 1-2
28 | int32_t *ptr = (int32_t *) __builtin_malloc (1);
29 | ~~~~~~~~~~~~~~~~~^~~
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" } */
42 /* { dg-begin-multiline-output "" }
43 int32_t *ptr = (int32_t *) __builtin_malloc (2);
45 'test_constant_2': events 1-2
47 | int32_t *ptr = (int32_t *) __builtin_malloc (2);
48 | ^~~~~~~~~~~~~~~~~~~~
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);
58 'void test_constant_2()': events 1-2
60 | int32_t *ptr = (int32_t *) __builtin_malloc (2);
61 | ~~~~~~~~~~~~~~~~~^~~
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" } */
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 | ^~~~~~~~~~~~~~~~~~~~~~~~
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 | ~~~~~~~~~~~~~~~~~^~~~~~~
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++ } } */