summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-2983.c
blob: db8873b4a88031421393b95f768ffad5fbf09986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* bug-2093.c
   iCode generation for a cast tried to read a non-literal operand as literal.
 */

#include <testfwk.h>

typedef struct {
    unsigned int v0;
    unsigned int v1;
} test_t;

volatile unsigned char test=0;

int f(void) {
    unsigned int *t4=&((test_t *)0)->v1;
    test=(unsigned char)t4;

    void *t6=(void *)&((test_t *)0)->v1; // Compilation failed with internal error on this line.
    test=(unsigned char)t6;

    return 0;
}

void
testBug(void)
{
	ASSERT (!f());
}