aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/alias-1.c
blob: 9d2349424fd19ab43a79fa0bb0cdd119e79a2425 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* PR c/111884 */
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */
/* { dg-additional-options "-std=c++20" { target c++ } } */
/* { dg-additional-options "-std=c23" { target c } } */

int f(int i)
{
    int f = 1;
    return i[(unsigned char *)&f];
}

int g(int i)
{
    int f = 1;
    return i[(signed char *)&f];
}

int h(int i)
{
    int f = 1;
    return i[(char *)&f];
}