public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/103130] New: comments are parsed differently with -fdirectives-only
@ 2021-11-08 10:19 m.olbrich at pengutronix dot de
  2021-11-08 11:01 ` [Bug preprocessor/103130] [11/12 Regression] \*/ is not detected as the end of a comment " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: m.olbrich at pengutronix dot de @ 2021-11-08 10:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103130
           Summary: comments are parsed differently with -fdirectives-only
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m.olbrich at pengutronix dot de
  Target Milestone: ---

$ gcc --version
gcc (Debian 11.2.0-10) 11.2.0
[...]

Source:
$ cat tst.c 
/*\
 * this is a comment
\*/

int main()
{
        return 0;
}

Preprocessor works just fine:
$ gcc tst.c -E -o tst.i ; echo $?
0

And the preprocessor output looks correct.

But in the presence of -fdirectives-only (which icecream uses), it produces an
error:
$ gcc -fdirectives-only tst.c -E -o tst.i
tst.c:1:1: error: unterminated comment
    1 | /*\
      | ^

I'm not sure if '\*/' is valid to end the comment, but I don't think it should
only fail with -fdirectives-only.

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

* [Bug preprocessor/103130] [11/12 Regression] \*/ is not detected as the end of a comment with -fdirectives-only
  2021-11-08 10:19 [Bug preprocessor/103130] New: comments are parsed differently with -fdirectives-only m.olbrich at pengutronix dot de
@ 2021-11-08 11:01 ` pinskia at gcc dot gnu.org
  2021-11-08 12:48 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-08 11:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.3.0
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |11.1.0, 11.2.0
   Target Milestone|---                         |11.3
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-11-08
            Summary|comments are parsed         |[11/12 Regression] \*/ is
                   |differently with            |not detected as the end of
                   |-fdirectives-only           |a comment with
                   |                            |-fdirectives-only
           Keywords|                            |needs-bisection,
                   |                            |rejects-valid

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, GCC 10.2.0 (and before) all worked.

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

* [Bug preprocessor/103130] [11/12 Regression] \*/ is not detected as the end of a comment with -fdirectives-only
  2021-11-08 10:19 [Bug preprocessor/103130] New: comments are parsed differently with -fdirectives-only m.olbrich at pengutronix dot de
  2021-11-08 11:01 ` [Bug preprocessor/103130] [11/12 Regression] \*/ is not detected as the end of a comment " pinskia at gcc dot gnu.org
@ 2021-11-08 12:48 ` rguenth at gcc dot gnu.org
  2021-11-10 14:27 ` [Bug preprocessor/103130] [11/12 Regression] \*/ is not detected as the end of a comment with -fdirectives-only since r11-206-gb224c3763e018e8b marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-08 12:48 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug preprocessor/103130] [11/12 Regression] \*/ is not detected as the end of a comment with -fdirectives-only since r11-206-gb224c3763e018e8b
  2021-11-08 10:19 [Bug preprocessor/103130] New: comments are parsed differently with -fdirectives-only m.olbrich at pengutronix dot de
  2021-11-08 11:01 ` [Bug preprocessor/103130] [11/12 Regression] \*/ is not detected as the end of a comment " pinskia at gcc dot gnu.org
  2021-11-08 12:48 ` rguenth at gcc dot gnu.org
@ 2021-11-10 14:27 ` marxin at gcc dot gnu.org
  2021-11-16 16:07 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-10 14:27 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12 Regression] \*/ is   |[11/12 Regression] \*/ is
                   |not detected as the end of  |not detected as the end of
                   |a comment with              |a comment with
                   |-fdirectives-only           |-fdirectives-only since
                   |                            |r11-206-gb224c3763e018e8b
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |nathan at gcc dot gnu.org
           Keywords|needs-bisection             |

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r11-206-gb224c3763e018e8b.

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

* [Bug preprocessor/103130] [11/12 Regression] \*/ is not detected as the end of a comment with -fdirectives-only since r11-206-gb224c3763e018e8b
  2021-11-08 10:19 [Bug preprocessor/103130] New: comments are parsed differently with -fdirectives-only m.olbrich at pengutronix dot de
                   ` (2 preceding siblings ...)
  2021-11-10 14:27 ` [Bug preprocessor/103130] [11/12 Regression] \*/ is not detected as the end of a comment with -fdirectives-only since r11-206-gb224c3763e018e8b marxin at gcc dot gnu.org
@ 2021-11-16 16:07 ` jakub at gcc dot gnu.org
  2021-11-17 16:32 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-11-16 16:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

Untested fix.

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

* [Bug preprocessor/103130] [11/12 Regression] \*/ is not detected as the end of a comment with -fdirectives-only since r11-206-gb224c3763e018e8b
  2021-11-08 10:19 [Bug preprocessor/103130] New: comments are parsed differently with -fdirectives-only m.olbrich at pengutronix dot de
                   ` (3 preceding siblings ...)
  2021-11-16 16:07 ` jakub at gcc dot gnu.org
@ 2021-11-17 16:32 ` cvs-commit at gcc dot gnu.org
  2021-11-17 16:33 ` [Bug preprocessor/103130] [11 " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-17 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:049f0efeaa77b43a508172161ca040feb6bb5622

commit r12-5340-g049f0efeaa77b43a508172161ca040feb6bb5622
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Nov 17 17:31:40 2021 +0100

    libcpp: Fix up handling of block comments in -fdirectives-only mode
[PR103130]

    Normal preprocessing, -fdirectives-only preprocessing before the Nathan's
    rewrite, and all other compilers I've tried on godbolt treat even \*/
    as end of a block comment, but the new -fdirectives-only handling doesn't.

    2021-11-17  Jakub Jelinek  <jakub@redhat.com>

            PR preprocessor/103130
            * lex.c (cpp_directive_only_process): Treat even \*/ as end of
block
            comment.

            * c-c++-common/cpp/dir-only-9.c: New test.

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

* [Bug preprocessor/103130] [11 Regression] \*/ is not detected as the end of a comment with -fdirectives-only since r11-206-gb224c3763e018e8b
  2021-11-08 10:19 [Bug preprocessor/103130] New: comments are parsed differently with -fdirectives-only m.olbrich at pengutronix dot de
                   ` (4 preceding siblings ...)
  2021-11-17 16:32 ` cvs-commit at gcc dot gnu.org
@ 2021-11-17 16:33 ` jakub at gcc dot gnu.org
  2021-11-29  8:50 ` cvs-commit at gcc dot gnu.org
  2021-11-29  9:07 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-11-17 16:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12 Regression] \*/ is   |[11 Regression] \*/ is not
                   |not detected as the end of  |detected as the end of a
                   |a comment with              |comment with
                   |-fdirectives-only since     |-fdirectives-only since
                   |r11-206-gb224c3763e018e8b   |r11-206-gb224c3763e018e8b

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

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

* [Bug preprocessor/103130] [11 Regression] \*/ is not detected as the end of a comment with -fdirectives-only since r11-206-gb224c3763e018e8b
  2021-11-08 10:19 [Bug preprocessor/103130] New: comments are parsed differently with -fdirectives-only m.olbrich at pengutronix dot de
                   ` (5 preceding siblings ...)
  2021-11-17 16:33 ` [Bug preprocessor/103130] [11 " jakub at gcc dot gnu.org
@ 2021-11-29  8:50 ` cvs-commit at gcc dot gnu.org
  2021-11-29  9:07 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-29  8:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:0f0c24cf9622a3c74574a0e2d2bb2f51fed3e773

commit r11-9334-g0f0c24cf9622a3c74574a0e2d2bb2f51fed3e773
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Nov 17 17:31:40 2021 +0100

    libcpp: Fix up handling of block comments in -fdirectives-only mode
[PR103130]

    Normal preprocessing, -fdirectives-only preprocessing before the Nathan's
    rewrite, and all other compilers I've tried on godbolt treat even \*/
    as end of a block comment, but the new -fdirectives-only handling doesn't.

    2021-11-17  Jakub Jelinek  <jakub@redhat.com>

            PR preprocessor/103130
            * lex.c (cpp_directive_only_process): Treat even \*/ as end of
block
            comment.

            * c-c++-common/cpp/dir-only-9.c: New test.

    (cherry picked from commit 049f0efeaa77b43a508172161ca040feb6bb5622)

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

* [Bug preprocessor/103130] [11 Regression] \*/ is not detected as the end of a comment with -fdirectives-only since r11-206-gb224c3763e018e8b
  2021-11-08 10:19 [Bug preprocessor/103130] New: comments are parsed differently with -fdirectives-only m.olbrich at pengutronix dot de
                   ` (6 preceding siblings ...)
  2021-11-29  8:50 ` cvs-commit at gcc dot gnu.org
@ 2021-11-29  9:07 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-11-29  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 11.3 too.

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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 10:19 [Bug preprocessor/103130] New: comments are parsed differently with -fdirectives-only m.olbrich at pengutronix dot de
2021-11-08 11:01 ` [Bug preprocessor/103130] [11/12 Regression] \*/ is not detected as the end of a comment " pinskia at gcc dot gnu.org
2021-11-08 12:48 ` rguenth at gcc dot gnu.org
2021-11-10 14:27 ` [Bug preprocessor/103130] [11/12 Regression] \*/ is not detected as the end of a comment with -fdirectives-only since r11-206-gb224c3763e018e8b marxin at gcc dot gnu.org
2021-11-16 16:07 ` jakub at gcc dot gnu.org
2021-11-17 16:32 ` cvs-commit at gcc dot gnu.org
2021-11-17 16:33 ` [Bug preprocessor/103130] [11 " jakub at gcc dot gnu.org
2021-11-29  8:50 ` cvs-commit at gcc dot gnu.org
2021-11-29  9:07 ` 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).