1 /* Verify warnings and notes for MIN_EXPRs involving either pointers
2 to distinct objects or one to a known object and the other to
3 an unknown one. The relational expressions are strictly invalid
4 but that should be diagnosed by a separate warning.
6 { dg-options "-O2 -Wno-array-bounds" } */
8 /* Verify the note points to the larger of the two objects and mentions
9 the offset into it (although the offset might be better included in
12 extern char a5
[5]; // { dg-message "at offset \[^a-zA-Z\n\r\]*5\[^a-zA-Z0-9\]* into destination object 'a5' of size 5" "note" }
14 void min_a3_a5 (int i
)
19 /* The relational expression below is invalid and should be diagnosed
20 by its own warning independently of -Wstringop-overflow. */
21 char *d
= p
< q
? p
: q
;
23 d
[4] = 0; // { dg-warning "writing 2 bytes into a region of size 1" "" { target { vect_slp_v2qi_store_unalign } } }
24 d
[5] = 0; // { dg-warning "writing 1 byte into a region of size 0" "" { xfail { vect_slp_v2qi_store_unalign } } }
28 // Same as above but with the larger array as the first MIN_EXPR operand.
30 extern char b6
[6]; // { dg-message "at offset \[^a-zA-Z\n\r\]*6\[^a-zA-Z0-9\]* into destination object 'b6' of size 6" "note" }
32 void min_b6_b4 (int i
)
36 char *d
= p
< q
? p
: q
;
38 d
[5] = 0; // { dg-warning "writing 2 bytes into a region of size 1" "" { target { vect_slp_v2qi_store_unalign } } }
39 d
[6] = 0; // { dg-warning "writing 1 byte into a region of size 0" "" { xfail { vect_slp_v2qi_store_unalign } } }
43 /* Same as above but with the first MIN_EXPR operand pointing to an unknown
45 extern char c7
[7]; // { dg-message "at offset 7 into destination object 'c7' of size 7" "note" { xfail { vect_slp_v2qi_store_unalign } } }
47 void min_p_c7 (char *p
, int i
)
50 char *d
= p
< q
? p
: q
;
52 d
[6] = 0; // { dg-warning "writing 2 bytes into a region of size 1" "" { target { vect_slp_v2qi_store_unalign } } }
53 d
[7] = 0; // { dg-warning "writing 1 byte into a region of size 0" "" { xfail { vect_slp_v2qi_store_unalign } } }
57 /* Same as above but with the second MIN_EXPR operand pointing to an unknown
59 extern char d8
[8]; // { dg-message "at offset 8 into destination object 'd8' of size 8" "note" { xfail { vect_slp_v2qi_store_unalign } } }
61 void min_d8_p (char *q
, int i
)
64 char *d
= p
< q
? p
: q
;
66 d
[7] = 0; // { dg-warning "writing 2 bytes into a region of size 1" "" { target { vect_slp_v2qi_store_unalign } } }
67 d
[8] = 0; // { dg-warning "writing 1 byte into a region of size 0" "" { xfail { vect_slp_v2qi_store_unalign } } }
74 char a5
[5]; // { dg-message "at offset 5 into destination object 'a5' of size 5" "note" }
77 void min_A3_A5 (int i
, struct A3_5
*pa3_5
)
79 char *p
= pa3_5
->a3
+ i
;
80 char *q
= pa3_5
->a5
+ i
;
82 char *d
= p
< q
? p
: q
;
85 d
[5] = 0; // { dg-warning "writing 1 byte into a region of size 0" }
92 char b6
[6]; // { dg-message "at offset 6 into destination object 'b6' of size 6" "note" { xfail { vect_slp_v2qi_store_unalign } } }
95 void min_B6_B4 (int i
, struct B4_B6
*pb4_b6
)
97 char *p
= pb4_b6
->b6
+ i
;
98 char *q
= pb4_b6
->b4
+ i
;
99 char *d
= p
< q
? p
: q
;
102 d
[6] = 0; // { dg-warning "writing 1 byte into a region of size 0" "" { xfail { vect_slp_v2qi_store_unalign } } }
108 char c7
[7]; // { dg-message "at offset 7 into destination object 'c7' of size 7" "note" { xfail { vect_slp_v2qi_store_unalign } } }
111 void min_p_C7 (char *p
, int i
, struct C7
*pc7
)
113 char *q
= pc7
->c7
+ i
;
114 char *d
= p
< q
? p
: q
;
117 d
[7] = 0; // { dg-warning "writing 1 byte into a region of size 0" "" { xfail { vect_slp_v2qi_store_unalign } } }
123 char d8
[8]; // { dg-message "at offset 8 into destination object 'd8' of size 8" "note" { xfail { vect_slp_v2qi_store_unalign } } }
126 void min_D8_p (char *q
, int i
, struct D8
*pd8
)
128 char *p
= pd8
->d8
+ i
;
129 char *d
= p
< q
? p
: q
;
132 d
[8] = 0; // { dg-warning "writing 1 byte into a region of size 0" "" { xfail { vect_slp_v2qi_store_unalign } } }