public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/103446] New: Invalid wide multibyte character constant
@ 2021-11-26 22:36 zloten at mail dot ru
  2021-11-26 22:37 ` [Bug c/103446] " zloten at mail dot ru
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zloten at mail dot ru @ 2021-11-26 22:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103446

            Bug ID: 103446
           Summary: Invalid wide multibyte character constant
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zloten at mail dot ru
  Target Milestone: ---

assert('Z' == 0x5A);
assert('Ы' == 0xD0AB);
assert('闩' == 0x00E997A9);
assert('𠂡' == 0xF0A082A1);
assert(U'Z' == 0x5A);
assert(U'Ы' == 0x042B);
assert(U'闩' == 0x95E9);
assert(U'𠂡' == 0x000200A1);
assert(L'Z' == 0x5A);
assert(L'Ы' == 0x042B);
assert(L'闩' == 0x95E9);
assert(L'𠂡' == 56481); ==> warning: character constant too long for its type   
         BUT MUST BE 0xDCA1D840

This problem occurs only with non-bmp wide supplementary characters.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/103446] Invalid wide multibyte character constant
  2021-11-26 22:36 [Bug c/103446] New: Invalid wide multibyte character constant zloten at mail dot ru
@ 2021-11-26 22:37 ` zloten at mail dot ru
  2021-11-26 22:40 ` [Bug preprocessor/103446] " pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zloten at mail dot ru @ 2021-11-26 22:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103446

--- Comment #1 from Zloten <zloten at mail dot ru> ---
56481 = 0xDCA1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug preprocessor/103446] Invalid wide multibyte character constant
  2021-11-26 22:36 [Bug c/103446] New: Invalid wide multibyte character constant zloten at mail dot ru
  2021-11-26 22:37 ` [Bug c/103446] " zloten at mail dot ru
@ 2021-11-26 22:40 ` pinskia at gcc dot gnu.org
  2021-11-26 23:17 ` zloten at mail dot ru
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-26 22:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103446

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Is there a full testcase including what options you used?
Did you use "-finput-charset=" and -fexec-charset= options?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug preprocessor/103446] Invalid wide multibyte character constant
  2021-11-26 22:36 [Bug c/103446] New: Invalid wide multibyte character constant zloten at mail dot ru
  2021-11-26 22:37 ` [Bug c/103446] " zloten at mail dot ru
  2021-11-26 22:40 ` [Bug preprocessor/103446] " pinskia at gcc dot gnu.org
@ 2021-11-26 23:17 ` zloten at mail dot ru
  2021-11-26 23:25 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zloten at mail dot ru @ 2021-11-26 23:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103446

--- Comment #3 from Zloten <zloten at mail dot ru> ---
No. Just - O2.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug preprocessor/103446] Invalid wide multibyte character constant
  2021-11-26 22:36 [Bug c/103446] New: Invalid wide multibyte character constant zloten at mail dot ru
                   ` (2 preceding siblings ...)
  2021-11-26 23:17 ` zloten at mail dot ru
@ 2021-11-26 23:25 ` pinskia at gcc dot gnu.org
  2021-11-26 23:27 ` zloten at mail dot ru
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-26 23:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103446

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
What target and what is the host?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug preprocessor/103446] Invalid wide multibyte character constant
  2021-11-26 22:36 [Bug c/103446] New: Invalid wide multibyte character constant zloten at mail dot ru
                   ` (3 preceding siblings ...)
  2021-11-26 23:25 ` pinskia at gcc dot gnu.org
@ 2021-11-26 23:27 ` zloten at mail dot ru
  2021-11-26 23:32 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zloten at mail dot ru @ 2021-11-26 23:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103446

--- Comment #5 from Zloten <zloten at mail dot ru> ---
I use the latest MinGW, target-host are Windows, x86-64.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug preprocessor/103446] Invalid wide multibyte character constant
  2021-11-26 22:36 [Bug c/103446] New: Invalid wide multibyte character constant zloten at mail dot ru
                   ` (4 preceding siblings ...)
  2021-11-26 23:27 ` zloten at mail dot ru
@ 2021-11-26 23:32 ` pinskia at gcc dot gnu.org
  2021-11-29 21:37 ` zloten at mail dot ru
  2021-11-29 21:39 ` zloten at mail dot ru
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-26 23:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103446

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Wide charater (wchar_t) on mingw is short (16bits) only.

That is why L'𠂡' does not fit into wchar_t.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug preprocessor/103446] Invalid wide multibyte character constant
  2021-11-26 22:36 [Bug c/103446] New: Invalid wide multibyte character constant zloten at mail dot ru
                   ` (5 preceding siblings ...)
  2021-11-26 23:32 ` pinskia at gcc dot gnu.org
@ 2021-11-29 21:37 ` zloten at mail dot ru
  2021-11-29 21:39 ` zloten at mail dot ru
  7 siblings, 0 replies; 9+ messages in thread
From: zloten at mail dot ru @ 2021-11-29 21:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103446

--- Comment #7 from Zloten <zloten at mail dot ru> ---
It's very very strange. I've tested GCC 11.2.0(x86-64) and MinGW(x86-64). Both
have the same problem.
Let's do not use L suffix (it's implementation-defined). 
Let's use u suffix.
For both:

int test() {
    return   *(int*)u"𠂡"; // returns valid value 0xDCA1D840
}

int test2() {
   return u'𠂡'; // throws warning "character constant too long for its type"
                 // and returns invalid value 0xDCA1
}

Why we have no possibility to use non-BMP UTF-16 encoded value? 
It can be simply treated by compiler like a 32-bit integer constant.

Sorry for my bad English.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug preprocessor/103446] Invalid wide multibyte character constant
  2021-11-26 22:36 [Bug c/103446] New: Invalid wide multibyte character constant zloten at mail dot ru
                   ` (6 preceding siblings ...)
  2021-11-29 21:37 ` zloten at mail dot ru
@ 2021-11-29 21:39 ` zloten at mail dot ru
  7 siblings, 0 replies; 9+ messages in thread
From: zloten at mail dot ru @ 2021-11-29 21:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103446

--- Comment #8 from Zloten <zloten at mail dot ru> ---
Sorry for my late reply

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-11-29 21:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-26 22:36 [Bug c/103446] New: Invalid wide multibyte character constant zloten at mail dot ru
2021-11-26 22:37 ` [Bug c/103446] " zloten at mail dot ru
2021-11-26 22:40 ` [Bug preprocessor/103446] " pinskia at gcc dot gnu.org
2021-11-26 23:17 ` zloten at mail dot ru
2021-11-26 23:25 ` pinskia at gcc dot gnu.org
2021-11-26 23:27 ` zloten at mail dot ru
2021-11-26 23:32 ` pinskia at gcc dot gnu.org
2021-11-29 21:37 ` zloten at mail dot ru
2021-11-29 21:39 ` zloten at mail dot ru

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).