public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108829] New: internal compiler error: in is_capture_proxy, at cp/lambda.cc:272
@ 2023-02-16 18:42 v.barinov at samsung dot com
  2023-02-16 18:43 ` [Bug c++/108829] " v.barinov at samsung dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: v.barinov at samsung dot com @ 2023-02-16 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108829
           Summary: internal compiler error: in is_capture_proxy, at
                    cp/lambda.cc:272
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: v.barinov at samsung dot com
  Target Milestone: ---

Created attachment 54474
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54474&action=edit
Reduced test case

Found an ICE during build of gdal-3.5.3 library

 gdal-3.6.2/ogr/ogrsf_frmts/openfilegdb/filegdbindex_write.cpp: In
instantiation of ‘bool OpenFileGDB::WriteIndex(VSILFILE*,
std::vector<ValueOIDPair>&, void (*)(std::vector<unsigned char>&, const
typename ValueOIDPair::first_type&, int), int&, int) [with ValueOIDPair =
std::pair<long int, int>; VSILFILE = FILE; typename ValueOIDPair::first_type =
long int]’:
 gdal-3.6.2/ogr/ogrsf_frmts/openfilegdb/filegdbindex_write.cpp:1300:27:  
required from here
 gdal-3.6.2/ogr/ogrsf_frmts/openfilegdb/filegdbindex_write.cpp:500:9: internal
compiler error: in is_capture_proxy, at cp/lambda.cc:272

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

* [Bug c++/108829] internal compiler error: in is_capture_proxy, at cp/lambda.cc:272
  2023-02-16 18:42 [Bug c++/108829] New: internal compiler error: in is_capture_proxy, at cp/lambda.cc:272 v.barinov at samsung dot com
@ 2023-02-16 18:43 ` v.barinov at samsung dot com
  2023-02-16 18:46 ` mpolacek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: v.barinov at samsung dot com @ 2023-02-16 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Slava Barinov <v.barinov at samsung dot com> ---
Created attachment 54475
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54475&action=edit
Result of -freport-bug

Added full output of -freport-bug call

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

* [Bug c++/108829] internal compiler error: in is_capture_proxy, at cp/lambda.cc:272
  2023-02-16 18:42 [Bug c++/108829] New: internal compiler error: in is_capture_proxy, at cp/lambda.cc:272 v.barinov at samsung dot com
  2023-02-16 18:43 ` [Bug c++/108829] " v.barinov at samsung dot com
@ 2023-02-16 18:46 ` mpolacek at gcc dot gnu.org
  2023-02-16 18:48 ` [Bug c++/108829] [13 Regression] " pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-02-16 18:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-02-16
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I can see the ICE but the reduced test seems overreduced and invalid; do you
have the original .ii file?

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

* [Bug c++/108829] [13 Regression] internal compiler error: in is_capture_proxy, at cp/lambda.cc:272
  2023-02-16 18:42 [Bug c++/108829] New: internal compiler error: in is_capture_proxy, at cp/lambda.cc:272 v.barinov at samsung dot com
  2023-02-16 18:43 ` [Bug c++/108829] " v.barinov at samsung dot com
  2023-02-16 18:46 ` mpolacek at gcc dot gnu.org
@ 2023-02-16 18:48 ` pinskia at gcc dot gnu.org
  2023-02-16 18:49 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-16 18:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |13.0
           Keywords|                            |ice-on-valid-code,
                   |                            |needs-bisection
   Last reconfirmed|2023-02-16 00:00:00         |
            Summary|internal compiler error: in |[13 Regression] internal
                   |is_capture_proxy, at        |compiler error: in
                   |cp/lambda.cc:272            |is_capture_proxy, at
                   |                            |cp/lambda.cc:272
      Known to work|                            |12.2.0

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced better (to a valid testcase):
```
template <int>
void f(void) {
  constexpr int IDX_PAGE_SIZE = 4096;
  int abyPage = [=, abyPage] { return IDX_PAGE_SIZE; }();
}
void h() {
  f<1>();
}
```

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

* [Bug c++/108829] [13 Regression] internal compiler error: in is_capture_proxy, at cp/lambda.cc:272
  2023-02-16 18:42 [Bug c++/108829] New: internal compiler error: in is_capture_proxy, at cp/lambda.cc:272 v.barinov at samsung dot com
                   ` (2 preceding siblings ...)
  2023-02-16 18:48 ` [Bug c++/108829] [13 Regression] " pinskia at gcc dot gnu.org
@ 2023-02-16 18:49 ` pinskia at gcc dot gnu.org
  2023-02-16 18:50 ` [Bug c++/108829] [12/13 " pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-16 18:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #2)
> I can see the ICE but the reduced test seems overreduced and invalid; do you
> have the original .ii file?

It was attached in comment #1 too.

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

* [Bug c++/108829] [12/13 Regression] internal compiler error: in is_capture_proxy, at cp/lambda.cc:272
  2023-02-16 18:42 [Bug c++/108829] New: internal compiler error: in is_capture_proxy, at cp/lambda.cc:272 v.barinov at samsung dot com
                   ` (3 preceding siblings ...)
  2023-02-16 18:49 ` pinskia at gcc dot gnu.org
@ 2023-02-16 18:50 ` pinskia at gcc dot gnu.org
  2023-02-16 18:55 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-16 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.3
            Summary|[13 Regression] internal    |[12/13 Regression] internal
                   |compiler error: in          |compiler error: in
                   |is_capture_proxy, at        |is_capture_proxy, at
                   |cp/lambda.cc:272            |cp/lambda.cc:272

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

* [Bug c++/108829] [12/13 Regression] internal compiler error: in is_capture_proxy, at cp/lambda.cc:272
  2023-02-16 18:42 [Bug c++/108829] New: internal compiler error: in is_capture_proxy, at cp/lambda.cc:272 v.barinov at samsung dot com
                   ` (4 preceding siblings ...)
  2023-02-16 18:50 ` [Bug c++/108829] [12/13 " pinskia at gcc dot gnu.org
@ 2023-02-16 18:55 ` mpolacek at gcc dot gnu.org
  2023-02-20 14:18 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-02-16 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |
           Priority|P3                          |P2
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Oop, I overlooked that.

Started with r12-6065.  So I guess we just need to add the missing
STRIP_ANY_LOCATION_WRAPPER somewhere.

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

* [Bug c++/108829] [12/13 Regression] internal compiler error: in is_capture_proxy, at cp/lambda.cc:272
  2023-02-16 18:42 [Bug c++/108829] New: internal compiler error: in is_capture_proxy, at cp/lambda.cc:272 v.barinov at samsung dot com
                   ` (5 preceding siblings ...)
  2023-02-16 18:55 ` mpolacek at gcc dot gnu.org
@ 2023-02-20 14:18 ` cvs-commit at gcc dot gnu.org
  2023-02-20 15:48 ` [Bug c++/108829] [12 " mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-20 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:02d8ab3e4e2f3d9dc12157a98c976d6698e71e29

commit r13-6141-g02d8ab3e4e2f3d9dc12157a98c976d6698e71e29
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Feb 16 17:41:24 2023 -0500

    c++: ICE with redundant capture [PR108829]

    Here we crash in is_capture_proxy:

      /* Location wrappers should be stripped or otherwise handled by the
         caller before using this predicate.  */
      gcc_checking_assert (!location_wrapper_p (decl));

    We only crash with the redundant capture:

      int abyPage = [=, abyPage] { ... }

    because prune_lambda_captures is only called when there was a default
    capture, and with [=] only abyPage won't be in LAMBDA_EXPR_CAPTURE_LIST.

    The problem is that LAMBDA_CAPTURE_EXPLICIT_P wasn't propagated
    correctly and so var_to_maybe_prune proceeded where it shouldn't.

    Co-Authored by: Patrick Palka <ppalka@redhat.com>

            PR c++/108829

    gcc/cp/ChangeLog:

            * pt.cc (prepend_one_capture): Set LAMBDA_CAPTURE_EXPLICIT_P.
            (tsubst_lambda_expr): Pass LAMBDA_CAPTURE_EXPLICIT_P to
            prepend_one_capture.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/lambda/lambda-108829-2.C: New test.
            * g++.dg/cpp0x/lambda/lambda-108829.C: New test.

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

* [Bug c++/108829] [12 Regression] internal compiler error: in is_capture_proxy, at cp/lambda.cc:272
  2023-02-16 18:42 [Bug c++/108829] New: internal compiler error: in is_capture_proxy, at cp/lambda.cc:272 v.barinov at samsung dot com
                   ` (6 preceding siblings ...)
  2023-02-20 14:18 ` cvs-commit at gcc dot gnu.org
@ 2023-02-20 15:48 ` mpolacek at gcc dot gnu.org
  2023-02-20 17:27 ` cvs-commit at gcc dot gnu.org
  2023-02-20 17:28 ` mpolacek at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-02-20 15:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12/13 Regression] internal |[12 Regression] internal
                   |compiler error: in          |compiler error: in
                   |is_capture_proxy, at        |is_capture_proxy, at
                   |cp/lambda.cc:272            |cp/lambda.cc:272

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk so far.

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

* [Bug c++/108829] [12 Regression] internal compiler error: in is_capture_proxy, at cp/lambda.cc:272
  2023-02-16 18:42 [Bug c++/108829] New: internal compiler error: in is_capture_proxy, at cp/lambda.cc:272 v.barinov at samsung dot com
                   ` (7 preceding siblings ...)
  2023-02-20 15:48 ` [Bug c++/108829] [12 " mpolacek at gcc dot gnu.org
@ 2023-02-20 17:27 ` cvs-commit at gcc dot gnu.org
  2023-02-20 17:28 ` mpolacek at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-20 17:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:12cdc0e266f02c3ba4e80c3d971463ff507e049b

commit r12-9191-g12cdc0e266f02c3ba4e80c3d971463ff507e049b
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Feb 16 17:41:24 2023 -0500

    c++: ICE with redundant capture [PR108829]

    Here we crash in is_capture_proxy:

      /* Location wrappers should be stripped or otherwise handled by the
         caller before using this predicate.  */
      gcc_checking_assert (!location_wrapper_p (decl));

    We only crash with the redundant capture:

      int abyPage = [=, abyPage] { ... }

    because prune_lambda_captures is only called when there was a default
    capture, and with [=] only abyPage won't be in LAMBDA_EXPR_CAPTURE_LIST.

    The problem is that LAMBDA_CAPTURE_EXPLICIT_P wasn't propagated
    correctly and so var_to_maybe_prune proceeded where it shouldn't.

    Co-Authored by: Patrick Palka <ppalka@redhat.com>

            PR c++/108829

    gcc/cp/ChangeLog:

            * pt.cc (prepend_one_capture): Set LAMBDA_CAPTURE_EXPLICIT_P.
            (tsubst_lambda_expr): Pass LAMBDA_CAPTURE_EXPLICIT_P to
            prepend_one_capture.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/lambda/lambda-108829-2.C: New test.
            * g++.dg/cpp0x/lambda/lambda-108829.C: New test.

    (cherry picked from commit 02d8ab3e4e2f3d9dc12157a98c976d6698e71e29)

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

* [Bug c++/108829] [12 Regression] internal compiler error: in is_capture_proxy, at cp/lambda.cc:272
  2023-02-16 18:42 [Bug c++/108829] New: internal compiler error: in is_capture_proxy, at cp/lambda.cc:272 v.barinov at samsung dot com
                   ` (8 preceding siblings ...)
  2023-02-20 17:27 ` cvs-commit at gcc dot gnu.org
@ 2023-02-20 17:28 ` mpolacek at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-02-20 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-02-20 17:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-16 18:42 [Bug c++/108829] New: internal compiler error: in is_capture_proxy, at cp/lambda.cc:272 v.barinov at samsung dot com
2023-02-16 18:43 ` [Bug c++/108829] " v.barinov at samsung dot com
2023-02-16 18:46 ` mpolacek at gcc dot gnu.org
2023-02-16 18:48 ` [Bug c++/108829] [13 Regression] " pinskia at gcc dot gnu.org
2023-02-16 18:49 ` pinskia at gcc dot gnu.org
2023-02-16 18:50 ` [Bug c++/108829] [12/13 " pinskia at gcc dot gnu.org
2023-02-16 18:55 ` mpolacek at gcc dot gnu.org
2023-02-20 14:18 ` cvs-commit at gcc dot gnu.org
2023-02-20 15:48 ` [Bug c++/108829] [12 " mpolacek at gcc dot gnu.org
2023-02-20 17:27 ` cvs-commit at gcc dot gnu.org
2023-02-20 17:28 ` mpolacek 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).