public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98682] New: g++ allows goto inside statement expr
@ 2021-01-14 14:07 nbkolchin at gmail dot com
  2021-01-15 17:38 ` [Bug c++/98682] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: nbkolchin at gmail dot com @ 2021-01-14 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98682
           Summary: g++ allows goto inside statement expr
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nbkolchin at gmail dot com
  Target Milestone: ---

The following obviously incorrect program compiles without error under g++:

#include <stdio.h>

int main(int argc, char** argv)
{
    goto L_bug;
    printf("%s, %s %s\n", "Hello", ({ L_bug: ; "world!";}), "What?");
}

gcc produces error: "error: jump into statement expression".

Tested under gcc versions: 6.3.0, 7.5.0, 10.2.0.

This behaviour contradicts with documentation: "Jumping into a statement
expression with goto or using a switch statement outside the statement
expression with a case or default label inside the statement expression is not
permitted."

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

* [Bug c++/98682] g++ allows goto inside statement expr
  2021-01-14 14:07 [Bug c++/98682] New: g++ allows goto inside statement expr nbkolchin at gmail dot com
@ 2021-01-15 17:38 ` pinskia at gcc dot gnu.org
  2021-01-19 13:56 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-01-15 17:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this is a dup of bug 772.

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

* [Bug c++/98682] g++ allows goto inside statement expr
  2021-01-14 14:07 [Bug c++/98682] New: g++ allows goto inside statement expr nbkolchin at gmail dot com
  2021-01-15 17:38 ` [Bug c++/98682] " pinskia at gcc dot gnu.org
@ 2021-01-19 13:56 ` jakub at gcc dot gnu.org
  2021-01-19 13:57 ` jakub at gcc dot gnu.org
  2021-01-19 13:57 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-19 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And PR95465

*** This bug has been marked as a duplicate of bug 775 ***

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

* [Bug c++/98682] g++ allows goto inside statement expr
  2021-01-14 14:07 [Bug c++/98682] New: g++ allows goto inside statement expr nbkolchin at gmail dot com
  2021-01-15 17:38 ` [Bug c++/98682] " pinskia at gcc dot gnu.org
  2021-01-19 13:56 ` jakub at gcc dot gnu.org
@ 2021-01-19 13:57 ` jakub at gcc dot gnu.org
  2021-01-19 13:57 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-19 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-01-19
         Resolution|DUPLICATE                   |---
             Status|RESOLVED                    |REOPENED

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Can't type, sorry

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

* [Bug c++/98682] g++ allows goto inside statement expr
  2021-01-14 14:07 [Bug c++/98682] New: g++ allows goto inside statement expr nbkolchin at gmail dot com
                   ` (2 preceding siblings ...)
  2021-01-19 13:57 ` jakub at gcc dot gnu.org
@ 2021-01-19 13:57 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-19 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|REOPENED                    |RESOLVED

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Dup

*** This bug has been marked as a duplicate of bug 772 ***

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

end of thread, other threads:[~2021-01-19 13:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 14:07 [Bug c++/98682] New: g++ allows goto inside statement expr nbkolchin at gmail dot com
2021-01-15 17:38 ` [Bug c++/98682] " pinskia at gcc dot gnu.org
2021-01-19 13:56 ` jakub at gcc dot gnu.org
2021-01-19 13:57 ` jakub at gcc dot gnu.org
2021-01-19 13:57 ` 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).