[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[microblaze-uclinux] c++ non-constant initializers



Hi,

I'm trying to port a c++ Framework to microblaze, but there are problems with the generated binaries.

Here is some code to demonstrate the problem:

#include <stdio.h>

const unsigned char seq[] = { 0x54, 0x45, 0x53, 0x54 };  // TEST
const unsigned char seq2[] = { seq[0], seq[1], seq[2], seq[3] };

int main() {
    printf("%x %x %x %x\n", seq[0], seq[1], seq[2], seq[3]);
    printf("%x %x %x %x\n", seq2[0], seq2[1], seq2[2], seq2[3]);
    return 0;
}

Compiling and running on a pc gives:
54 45 53 54
54 45 53 54

builing for mb results in:
54 45 53 54
0 0 0 0

So it seems the initializers are not run. The code above is legal C++, so:
- can somebody reproduce this behavior?
- Are there compiler switches to make the code work?
- Or is this just a bug in microblaze-uclinux-g++?

Thanks
Torsten
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/