re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr20739.c
1 /* PR middle-end/20739 */
2
3 /* dg-do compile */
4 /* dg-options "-O" */
5
6 /* We used to fail to compile this because gimplification dropped the
7 conversion that added the const qualifier to the sub-expression
8 involving baz, and then immediately noticed and reported its
9 absence. */
10
11 typedef struct
12 {
13 char chars[5];
14 }
15 baz_t;
16
17 extern baz_t * baz;
18
19 extern void foo (baz_t);
20 int
21 bar (const baz_t * ls)
22 {
23 foo (ls == 0 ? *(&baz[0]) : *ls);
24 }