public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96485] New: Lambda parsing regression in GCCs 9 and onwards
@ 2020-08-05 14:07 s_gccbugzilla at nedprod dot com
  2020-08-05 17:48 ` [Bug c++/96485] " jakub at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: s_gccbugzilla at nedprod dot com @ 2020-08-05 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96485
           Summary: Lambda parsing regression in GCCs 9 and onwards
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: s_gccbugzilla at nedprod dot com
  Target Milestone: ---

As the repro at https://godbolt.org/z/Gvx75e shows, the following code compiled
fine in GCCs up to and including GCC 8.3:

```
void test()
{
    []()
#if 1
    __attribute__((no_sanitize_undefined))
#endif
    ->int {
        return 0;
    };
}
```

>From GCC 9 onwards, we get:

```
<source>: In lambda function:
<source>:7:5: error: expected '{' before '->' token
    7 |     ->int {
      |     ^~
<source>: In function 'void test()':
<source>:7:5: error: base operand of '->' has non-pointer type
'test()::<lambda()>'
<source>:7:7: error: expected unqualified-id before 'int'
    7 |     ->int {
      |       ^~~
Compiler returned: 1
```

This code compiles fine in clang, incidentally, though it doesn't recognise the
attribute.

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

* [Bug c++/96485] Lambda parsing regression in GCCs 9 and onwards
  2020-08-05 14:07 [Bug c++/96485] New: Lambda parsing regression in GCCs 9 and onwards s_gccbugzilla at nedprod dot com
@ 2020-08-05 17:48 ` jakub at gcc dot gnu.org
  2020-08-05 17:50 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-05 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This has changed in r265787.

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

* [Bug c++/96485] Lambda parsing regression in GCCs 9 and onwards
  2020-08-05 14:07 [Bug c++/96485] New: Lambda parsing regression in GCCs 9 and onwards s_gccbugzilla at nedprod dot com
  2020-08-05 17:48 ` [Bug c++/96485] " jakub at gcc dot gnu.org
@ 2020-08-05 17:50 ` jakub at gcc dot gnu.org
  2020-08-05 18:13 ` s_gccbugzilla at nedprod dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-05 17:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
[[gnu::no_sanitize_undefined]] instead of the GNU __attribute__ is accepted,
but as the C++ specification requires it applies to the type not the
declaration and therefore it is ignored.

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

* [Bug c++/96485] Lambda parsing regression in GCCs 9 and onwards
  2020-08-05 14:07 [Bug c++/96485] New: Lambda parsing regression in GCCs 9 and onwards s_gccbugzilla at nedprod dot com
  2020-08-05 17:48 ` [Bug c++/96485] " jakub at gcc dot gnu.org
  2020-08-05 17:50 ` jakub at gcc dot gnu.org
@ 2020-08-05 18:13 ` s_gccbugzilla at nedprod dot com
  2020-08-06  7:32 ` [Bug c++/96485] [9/10/11 Regression] " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: s_gccbugzilla at nedprod dot com @ 2020-08-05 18:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Niall Douglas <s_gccbugzilla at nedprod dot com> ---
(In reply to Jakub Jelinek from comment #2)
> [[gnu::no_sanitize_undefined]] instead of the GNU __attribute__ is accepted,
> but as the C++ specification requires it applies to the type not the
> declaration and therefore it is ignored.

Obviously the above is an extract from production code. We were using lambdas
to wrap individual bits of unsafe code which trips the UB sanitiser. It would
be useful to retain that ability, as having to sprinkle the code with:

struct { auto operator()(auto...) const __attribute__((no_sanitize_undefined))
{ } }()(...); 

... seems retrograde.

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

* [Bug c++/96485] [9/10/11 Regression] Lambda parsing regression in GCCs 9 and onwards
  2020-08-05 14:07 [Bug c++/96485] New: Lambda parsing regression in GCCs 9 and onwards s_gccbugzilla at nedprod dot com
                   ` (2 preceding siblings ...)
  2020-08-05 18:13 ` s_gccbugzilla at nedprod dot com
@ 2020-08-06  7:32 ` rguenth at gcc dot gnu.org
  2021-01-14  9:18 ` rguenth at gcc dot gnu.org
  2021-02-26  4:13 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-06  7:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |9.3.1
           Keywords|                            |rejects-valid
      Known to work|                            |8.3.0
      Known to fail|                            |9.1.0
   Target Milestone|---                         |9.4
            Summary|Lambda parsing regression   |[9/10/11 Regression] Lambda
                   |in GCCs 9 and onwards       |parsing regression in GCCs
                   |                            |9 and onwards

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

* [Bug c++/96485] [9/10/11 Regression] Lambda parsing regression in GCCs 9 and onwards
  2020-08-05 14:07 [Bug c++/96485] New: Lambda parsing regression in GCCs 9 and onwards s_gccbugzilla at nedprod dot com
                   ` (3 preceding siblings ...)
  2020-08-06  7:32 ` [Bug c++/96485] [9/10/11 Regression] " rguenth at gcc dot gnu.org
@ 2021-01-14  9:18 ` rguenth at gcc dot gnu.org
  2021-02-26  4:13 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-14  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/96485] [9/10/11 Regression] Lambda parsing regression in GCCs 9 and onwards
  2020-08-05 14:07 [Bug c++/96485] New: Lambda parsing regression in GCCs 9 and onwards s_gccbugzilla at nedprod dot com
                   ` (4 preceding siblings ...)
  2021-01-14  9:18 ` rguenth at gcc dot gnu.org
@ 2021-02-26  4:13 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2021-02-26  4:13 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Duplicate.

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

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

end of thread, other threads:[~2021-02-26  4:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05 14:07 [Bug c++/96485] New: Lambda parsing regression in GCCs 9 and onwards s_gccbugzilla at nedprod dot com
2020-08-05 17:48 ` [Bug c++/96485] " jakub at gcc dot gnu.org
2020-08-05 17:50 ` jakub at gcc dot gnu.org
2020-08-05 18:13 ` s_gccbugzilla at nedprod dot com
2020-08-06  7:32 ` [Bug c++/96485] [9/10/11 Regression] " rguenth at gcc dot gnu.org
2021-01-14  9:18 ` rguenth at gcc dot gnu.org
2021-02-26  4:13 ` jason 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).