public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/36470] New: sizeof UTF-32 is 2 on AVR
@ 2008-06-09 3:31 hutchinsonandy at gcc dot gnu dot org
2008-06-09 13:26 ` [Bug c/36470] " kris dot van dot hees at oracle dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: hutchinsonandy at gcc dot gnu dot org @ 2008-06-09 3:31 UTC (permalink / raw)
To: gcc-bugs
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:
sizeof (U'\0')
sizeof (U'\u2029')
sizeof (U'\U00064321')
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))
abort ();
if (sizeof (U'\0') != sizeof (char32_t))
abort ();
if (sizeof (U'\u0024') != sizeof (char32_t))
abort ();
if (sizeof (U'\u2029') != sizeof (char32_t))
abort ();
if (sizeof (U'\U00064321') != sizeof (char32_t))
abort ();
if (c0 != A)
abort ();
if (c1 != 0x0000)
abort ();
if (c2 != D)
abort ();
if (c3 != X)
abort ();
if (c4 != Y)
abort ();
}
--
Summary: sizeof UTF-32 is 2 on AVR
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hutchinsonandy at gcc dot gnu dot org
GCC host triplet: i686-pc-cygwin
GCC target triplet: avr-unknown-none
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36470
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/36470] sizeof UTF-32 is 2 on AVR
2008-06-09 3:31 [Bug c/36470] New: sizeof UTF-32 is 2 on AVR hutchinsonandy at gcc dot gnu dot org
@ 2008-06-09 13:26 ` kris dot van dot hees at oracle dot com
2008-06-10 3:22 ` hutchinsonandy at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: kris dot van dot hees at oracle dot com @ 2008-06-09 13:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from kris dot van dot hees at oracle dot com 2008-06-09 13:25 -------
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.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36470
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/36470] sizeof UTF-32 is 2 on AVR
2008-06-09 3:31 [Bug c/36470] New: sizeof UTF-32 is 2 on AVR hutchinsonandy at gcc dot gnu dot org
2008-06-09 13:26 ` [Bug c/36470] " kris dot van dot hees at oracle dot com
@ 2008-06-10 3:22 ` hutchinsonandy at gcc dot gnu dot org
2009-03-31 20:36 ` jsm28 at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: hutchinsonandy at gcc dot gnu dot org @ 2008-06-10 3:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from hutchinsonandy at gcc dot gnu dot org 2008-06-10 03:21 -------
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.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36470
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/36470] sizeof UTF-32 is 2 on AVR
2008-06-09 3:31 [Bug c/36470] New: sizeof UTF-32 is 2 on AVR hutchinsonandy at gcc dot gnu dot org
2008-06-09 13:26 ` [Bug c/36470] " kris dot van dot hees at oracle dot com
2008-06-10 3:22 ` hutchinsonandy at gcc dot gnu dot org
@ 2009-03-31 20:36 ` jsm28 at gcc dot gnu dot org
2009-03-31 21:09 ` eric dot weddington at atmel dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 20:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jsm28 at gcc dot gnu dot org 2009-03-31 20:36 -------
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.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36470
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/36470] sizeof UTF-32 is 2 on AVR
2008-06-09 3:31 [Bug c/36470] New: sizeof UTF-32 is 2 on AVR hutchinsonandy at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-03-31 20:36 ` jsm28 at gcc dot gnu dot org
@ 2009-03-31 21:09 ` eric dot weddington at atmel dot com
2009-11-21 15:06 ` hutchinsonandy at gcc dot gnu dot org
2009-11-23 22:10 ` hutchinsonandy at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: eric dot weddington at atmel dot com @ 2009-03-31 21:09 UTC (permalink / raw)
To: gcc-bugs
--
eric dot weddington at atmel dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36470
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/36470] sizeof UTF-32 is 2 on AVR
2008-06-09 3:31 [Bug c/36470] New: sizeof UTF-32 is 2 on AVR hutchinsonandy at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-03-31 21:09 ` eric dot weddington at atmel dot com
@ 2009-11-21 15:06 ` hutchinsonandy at gcc dot gnu dot org
2009-11-23 22:10 ` hutchinsonandy at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: hutchinsonandy at gcc dot gnu dot org @ 2009-11-21 15:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from hutchinsonandy at gcc dot gnu dot org 2009-11-21 15:06 -------
Test and now passes for avr and m32 targets.
gcc.dg/utf32-1.c
gcc.dg/utf32-2.c
gcc.dg/utf32-3.c
I will remove XFAIL in cleanup patch.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36470
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/36470] sizeof UTF-32 is 2 on AVR
2008-06-09 3:31 [Bug c/36470] New: sizeof UTF-32 is 2 on AVR hutchinsonandy at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-11-21 15:06 ` hutchinsonandy at gcc dot gnu dot org
@ 2009-11-23 22:10 ` hutchinsonandy at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: hutchinsonandy at gcc dot gnu dot org @ 2009-11-23 22:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from hutchinsonandy at gcc dot gnu dot org 2009-11-23 22:10 -------
Subject: Bug 36470
Author: hutchinsonandy
Date: Mon Nov 23 22:10:18 2009
New Revision: 154471
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154471
Log:
PR testsuite/36470
* 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.
Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/utf-cvt.c
trunk/gcc/testsuite/gcc.dg/utf32-1.c
trunk/gcc/testsuite/gcc.dg/utf32-2.c
trunk/gcc/testsuite/gcc.dg/utf32-3.c
trunk/gcc/testsuite/gcc.dg/utf32-4.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36470
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-11-23 22:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-09 3:31 [Bug c/36470] New: sizeof UTF-32 is 2 on AVR hutchinsonandy at gcc dot gnu dot org
2008-06-09 13:26 ` [Bug c/36470] " kris dot van dot hees at oracle dot com
2008-06-10 3:22 ` hutchinsonandy at gcc dot gnu dot org
2009-03-31 20:36 ` jsm28 at gcc dot gnu dot org
2009-03-31 21:09 ` eric dot weddington at atmel dot com
2009-11-21 15:06 ` hutchinsonandy at gcc dot gnu dot org
2009-11-23 22:10 ` hutchinsonandy at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).