User account creation filtered due to spam.
AVR fails gcc.dg/utf32-1.c execution test.
As AVR has 16 bit int, I tried fixing this by using unsigned long for char_32.
This failed, I was surprised to find this is apparently due to incorrect size of UTF-32 characters so that:
all give value of 2.
So it would seem size has been set as sizeof(int) perhaps?
I can assign 32 bit values ok - just that sizeof says they are only 16 bits.
The modified testcase using 32 bit char_32t compiles to abort(), so I figure its not a target issue.
/****** Change this to unsigned long for AVR********/
typedef unsigned int char32_t;
extern void abort (void);
char32_t c0 = U'a';
char32_t c1 = U'\0';
char32_t c2 = U'\u0024';
char32_t c3 = U'\u2029';
char32_t c4 = U'\U00064321';
#define A 0x00000061
#define D 0x00000024
#define X 0x00002029
#define Y 0x00064321
int main ()
if (sizeof (U'a') != sizeof (char32_t))
if (sizeof (U'\0') != sizeof (char32_t))
if (sizeof (U'\u0024') != sizeof (char32_t))
if (sizeof (U'\u2029') != sizeof (char32_t))
if (sizeof (U'\U00064321') != sizeof (char32_t))
if (c0 != A)
if (c1 != 0x0000)
if (c2 != D)
if (c3 != X)
if (c4 != Y)
It sound like AVR will need a different specification for CHAR32_TYPE given that the default in c-common.c (unsigned int) won't work. Which would go in the appropriate file in gcc/config/avr, similar to how WCHAR_TYPE is defined. That still won't solve the hardcoded specification of the typedef in the test, but that is going to be addressed "Real Soon Now" in an upcoming patch to provide a macro (by the compiler) for the underlying types that are used for char16_t and char32_t, which will then be used in the tests to get rid of the hardcoded underlying type in the typedefs.
Fixing the testcase is easy, That is how i found problem. Two wrongs make a right!
It is not a priority but it seems like the suggestions is right way to fix.
I'll mark as XFAIL sometime soon.
I believe my patch for bug 448 should fix this, by using appropriate defaults
(taken from newlib) on all bare-metal targets. It's possible the newlib
type settings aren't the same as those used on AVR, but that's another issue.
Test and now passes for avr and m32 targets.
I will remove XFAIL in cleanup patch.
Subject: Bug 36470
Date: Mon Nov 23 22:10:18 2009
New Revision: 154471
* gcc.dg/utf-cvt.c: Skip int test for 16bit int targets.
Enable short test for avr target.
* gcc.dg/utf32-1.c: Enable test for avr and m32 targets.
* gcc.dg/utf32-2.c: Ditto.
* gcc.dg/utf32-3.c: Ditto.
* gcc.dg/utf32-4.c: Enable test for non-32bit targets.