Hi all,
I'm reaching the final stages of my port of gcc to a custom microcontroller
and at this point real world examples seem to work, I only have a few dozen
tests of the testsuite which give me trouble.
All those tests involve arithmetics on pointers (or labels), and I'm not
sure if the tests show a real problem in my port or if the tests are not
relevant given the specifics of my microcontroller (size of pointers not
being a "long", "int" not being a natural register etc).
Before going further, a bit of background: this microcontroller is special
in that it can be configured to work in 4 different modes: 8 bit "wide",
16 bit, 16 bit "wide" and 32 bits.
The code below speaks for itself:
#define BITS_PER_UNIT 8
#define UNITS_PER_WORD (TARGET_8W ? 1 : (TARGET_16 || TARGET_16W) ? 2
: 4)
#define SHORT_TYPE_SIZE 16
#define INT_TYPE_SIZE 16
#define LONG_TYPE_SIZE 32
#define LONG_LONG_TYPE_SIZE 64
#define FLOAT_TYPE_SIZE 32
#define DOUBLE_TYPE_SIZE 64
#define LONG_DOUBLE_TYPE_SIZE 64
#define SIZE_TYPE "unsigned int"
#define PTRDIFF_TYPE_SIZE ((TARGET_8W || TARGET_16) ? "int" : "long int")
#define Pmode ((TARGET_8W || TARGET_16) ? HImode : SImode)
#define POINTER_SIZE ((TARGET_8W || TARGET_16) ? 16 : 32)
Now, back to my problems: the following tests fail with
"error: initializer element is not constant":
on TARGET_8W and TARGET_16:
920928-1.c:
1 struct{int c;}v;
2 static long i=((char*)&(v.c)-(char*)&v)
930326-1.c:
1 struct
2 {
3 char a, b, f[3];
4 } s;
5
6 long i = s.f-&s.b;
labels-3.c:
9 int foo (int a)
10 {
11 static const short ar[] = { &&l1 - &&l1, &&l2 - &&l1 };
12 void *p = &&l1 + ar[a];
13 goto *p;
14 l1:
15 return 1;
16 l2:
17 return 2;
18 }
on TARGET_16W and TARGET_32: 20011114-1.c:
1 extern void _text;
2 static __SIZE_TYPE__ x = (__SIZE_TYPE__) &_text - 0x10000000L - 1;
Are those tests expected to fail on my port or is that something I've
obviously done wrong ?
Thanks.
Stelian.
--
Stelian Pop <[email protected]>