public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/111953] New: stringify operator # rejects "\" but not "\ \" as input
@ 2023-10-24 11:03 stephan.stiller at outlook dot com
  2023-10-24 11:39 ` [Bug preprocessor/111953] " schwab@linux-m68k.org
  2023-11-04  5:54 ` [Bug preprocessor/111953] stringify operator # rejects an odd number "\" but not "\ \" (or any even # of them with spaces) " pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: stephan.stiller at outlook dot com @ 2023-10-24 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111953
           Summary: stringify operator # rejects "\" but not "\ \" as
                    input
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stephan.stiller at outlook dot com
  Target Milestone: ---

The code
    #define str(s)  # s
    str(\ \)
(full source file) should lead to UB (the result "\ \" is not a valid string
literal) but doesn't. For a slightly different second line
    str(\)
GCC does in fact give a warning
    warning: invalid string literal, ignoring final '\'
for both C17 (with warnings enabled)
    gcc -E -std=c17 -pedantic -Wall -Wextra
and "gnu17"-C:
    gcc -E

#####

Here is some technical data (output of "gcc -v"):

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-12.2.0/configure --prefix=/mingw64
--with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
--with-native-system-header-dir=/mingw64/include --libexecdir=/mingw64/lib
--enable-bootstrap --enable-checking=release --with-arch=nocona
--with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit
--enable-shared --enable-static --enable-libatomic --enable-threads=posix
--enable-graphite --enable-fully-dynamic-string
--enable-libstdcxx-filesystem-ts --enable-libstdcxx-time
--disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-multilib
--disable-rpath --disable-win32-registry --disable-nls --disable-werror
--disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64
--with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64
--with-pkgversion='Rev10, Built by MSYS2 project'
--with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as
--with-gnu-ld --disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc++
--with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Rev10, Built by MSYS2 project)

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

* [Bug preprocessor/111953] stringify operator # rejects "\" but not "\ \" as input
  2023-10-24 11:03 [Bug preprocessor/111953] New: stringify operator # rejects "\" but not "\ \" as input stephan.stiller at outlook dot com
@ 2023-10-24 11:39 ` schwab@linux-m68k.org
  2023-11-04  5:54 ` [Bug preprocessor/111953] stringify operator # rejects an odd number "\" but not "\ \" (or any even # of them with spaces) " pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: schwab@linux-m68k.org @ 2023-10-24 11:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
str(\ \ \) is warned again.

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

* [Bug preprocessor/111953] stringify operator # rejects an odd number "\" but not "\ \" (or any even # of them with spaces) as input
  2023-10-24 11:03 [Bug preprocessor/111953] New: stringify operator # rejects "\" but not "\ \" as input stephan.stiller at outlook dot com
  2023-10-24 11:39 ` [Bug preprocessor/111953] " schwab@linux-m68k.org
@ 2023-11-04  5:54 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-04  5:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|stringify operator #        |stringify operator #
                   |rejects "\" but not "\ \"   |rejects an odd number "\"
                   |as input                    |but not "\ \" (or any even
                   |                            |# of them with spaces) as
                   |                            |input
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-11-04

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

end of thread, other threads:[~2023-11-04  5:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-24 11:03 [Bug preprocessor/111953] New: stringify operator # rejects "\" but not "\ \" as input stephan.stiller at outlook dot com
2023-10-24 11:39 ` [Bug preprocessor/111953] " schwab@linux-m68k.org
2023-11-04  5:54 ` [Bug preprocessor/111953] stringify operator # rejects an odd number "\" but not "\ \" (or any even # of them with spaces) " pinskia 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).