public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110341] New: [C++26] P1854R4 - Making non-encodable string literals ill-formed
@ 2023-06-21 16:08 mpolacek at gcc dot gnu.org
  2023-06-21 22:37 ` [Bug c++/110341] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-06-21 16:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110341
           Summary: [C++26] P1854R4 - Making non-encodable string literals
                    ill-formed
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

See <https://wg21.link/P1854R4>.

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

* [Bug c++/110341] [C++26] P1854R4 - Making non-encodable string literals ill-formed
  2023-06-21 16:08 [Bug c++/110341] New: [C++26] P1854R4 - Making non-encodable string literals ill-formed mpolacek at gcc dot gnu.org
@ 2023-06-21 22:37 ` pinskia at gcc dot gnu.org
  2023-06-21 22:48 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-21 22:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I don't think there is anything to do for this paper:
`GCC exposes the same behavior(the one proposed by this paper) in all language
modes.`

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

* [Bug c++/110341] [C++26] P1854R4 - Making non-encodable string literals ill-formed
  2023-06-21 16:08 [Bug c++/110341] New: [C++26] P1854R4 - Making non-encodable string literals ill-formed mpolacek at gcc dot gnu.org
  2023-06-21 22:37 ` [Bug c++/110341] " pinskia at gcc dot gnu.org
@ 2023-06-21 22:48 ` mpolacek at gcc dot gnu.org
  2023-08-25 15:49 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-06-21 22:48 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-06-21
     Ever confirmed|0                           |1

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
It's possible/likely; I haven't actually read the paper yet.  We want to add
any possible testcases.  I should be able to address this by the end of next
week if nobody beats me to it.

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

* [Bug c++/110341] [C++26] P1854R4 - Making non-encodable string literals ill-formed
  2023-06-21 16:08 [Bug c++/110341] New: [C++26] P1854R4 - Making non-encodable string literals ill-formed mpolacek at gcc dot gnu.org
  2023-06-21 22:37 ` [Bug c++/110341] " pinskia at gcc dot gnu.org
  2023-06-21 22:48 ` mpolacek at gcc dot gnu.org
@ 2023-08-25 15:49 ` jakub at gcc dot gnu.org
  2023-11-14 17:32 ` cvs-commit at gcc dot gnu.org
  2023-11-14 17:33 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-08-25 15:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 55795
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55795&action=edit
gcc14-pr110341.patch

Untested implementation.

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

* [Bug c++/110341] [C++26] P1854R4 - Making non-encodable string literals ill-formed
  2023-06-21 16:08 [Bug c++/110341] New: [C++26] P1854R4 - Making non-encodable string literals ill-formed mpolacek at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-08-25 15:49 ` jakub at gcc dot gnu.org
@ 2023-11-14 17:32 ` cvs-commit at gcc dot gnu.org
  2023-11-14 17:33 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-14 17:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:194825f20619a1c4b51eaea84f20432fefc0db03

commit r14-5454-g194825f20619a1c4b51eaea84f20432fefc0db03
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Nov 14 18:28:34 2023 +0100

    c++: Implement C++26 P1854R4 - Making non-encodable string literals
ill-formed [PR110341]

    This paper voted in as DR makes some multi-character literals ill-formed.
    'abcd' stays valid, but e.g. 'á' is newly invalid in UTF-8 exec charset
    while valid e.g. in ISO-8859-1, because it is a single character which
needs
    2 bytes to be encoded.

    The following patch does that by checking (only pedantically, especially
    because it is a DR) if we'd emit a -Wmultichar warning because character
    constant has more than one byte in it whether the number of source
characters
    is equal to the number of bytes in the multichar string.
    If it is, it is normal multi-character literal constant
    and is diagnosed normally with -Wmultichar, otherwise at least one of the
    c-chars in the sequence was encoded as 2+ bytes.

    2023-11-14  Jakub Jelinek  <jakub@redhat.com>

            PR c++/110341
    libcpp/
            * charset.cc: Implement C++26 P1854R4 - Making non-encodable string
            literals ill-formed.
            (one_count_chars, convert_count_chars, count_source_chars): New
            functions.
            (narrow_str_to_charconst): Change last arg type from cpp_ttype to
            const cpp_token *.  For C++ if pedantic and i > 1 in CPP_CHAR
            interpret token also as CPP_STRING32 and if number of characters
            in the CPP_STRING32 is larger than number of bytes in CPP_CHAR,
            pedwarn on it.  Make the diagnostics more detailed.
            (wide_str_to_charconst): Change last arg type from cpp_ttype to
            const cpp_token *.  Make the diagnostics more detailed.
            (cpp_interpret_charconst): Adjust narrow_str_to_charconst and
            wide_str_to_charconst callers.
    gcc/testsuite/
            * g++.dg/cpp26/literals1.C: New test.
            * g++.dg/cpp26/literals2.C: New test.
            * g++.dg/cpp23/wchar-multi1.C: Adjust expected diagnostic wordings.
            * g++.dg/cpp23/wchar-multi2.C: Likewise.
            * gcc.dg/c23-utf8char-3.c: Likewise.
            * gcc.dg/cpp/charconst-4.c: Likewise.
            * gcc.dg/cpp/charconst.c: Likewise.
            * gcc.dg/cpp/if-2.c: Likewise.
            * gcc.dg/utf16-4.c: Likewise.
            * gcc.dg/utf32-4.c: Likewise.
            * g++.dg/cpp1z/utf8-neg.C: Likewise.
            * g++.dg/cpp2a/ucn2.C: Likewise.
            * g++.dg/ext/utf16-4.C: Likewise.
            * g++.dg/ext/utf32-4.C: Likewise.

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

* [Bug c++/110341] [C++26] P1854R4 - Making non-encodable string literals ill-formed
  2023-06-21 16:08 [Bug c++/110341] New: [C++26] P1854R4 - Making non-encodable string literals ill-formed mpolacek at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-11-14 17:32 ` cvs-commit at gcc dot gnu.org
@ 2023-11-14 17:33 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-11-14 17:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Implemented for GCC 14 now.

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

end of thread, other threads:[~2023-11-14 17:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-21 16:08 [Bug c++/110341] New: [C++26] P1854R4 - Making non-encodable string literals ill-formed mpolacek at gcc dot gnu.org
2023-06-21 22:37 ` [Bug c++/110341] " pinskia at gcc dot gnu.org
2023-06-21 22:48 ` mpolacek at gcc dot gnu.org
2023-08-25 15:49 ` jakub at gcc dot gnu.org
2023-11-14 17:32 ` cvs-commit at gcc dot gnu.org
2023-11-14 17:33 ` jakub at gcc dot gnu.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).