public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109490] New: ICE when using custom OpenMP reduction in Lambda in Template Function
@ 2023-04-12 19:37 simon-pfahler at gmx dot de
  2023-04-12 19:50 ` [Bug c++/109490] ICE when declaring custom OpenMP reduction in generic " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: simon-pfahler at gmx dot de @ 2023-04-12 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109490
           Summary: ICE when using custom OpenMP reduction in Lambda in
                    Template Function
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon-pfahler at gmx dot de
  Target Milestone: ---

Created attachment 54844
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54844&action=edit
preprocessed file

g++ throws an ICE when trying to compile the following code:

template <class T> T add(int const &maxs) {
  auto step = [&](auto const &maxs) {
    T a = T(0);
#pragma omp declare reduction(MyRed:T                                         
\
                              : omp_out += omp_in)                            
\
    initializer(omp_priv(omp_orig))
#pragma omp parallel for schedule(dynamic, 10) reduction(MyRed : a)
    for (int s = 0; s <= maxs; ++s) {
      a += T(1);
    }
    return a;
  };

  return step(maxs);
}

int main() { auto a = add<double>(100); }

Additional info:
gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-bootstrap
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.1 20230201 (GCC)

Complete command line:
g++ -fopenmp main.cpp

Compiler output message:
main.cpp: In instantiation of ‘T add(const int&) [with T = double]’:
main.cpp:17:34:   required from here
main.cpp:4:9: internal compiler error: in instantiate_body, at cp/pt.cc:26443
    4 | #pragma omp declare reduction(MyRed:T                                  
       \
      |         ^~~
0x19ea0c8 internal_error(char const*, ...)
        ???:0
0x6543f0 fancy_abort(char const*, int, char const*)
        ???:0
0x7f843c tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7e258f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ???:0
0x7db493 instantiate_decl(tree_node*, bool, bool)
        ???:0
0x7f9a73 instantiate_pending_templates(int)
        ???:0
0x6fe658 c_parse_final_cleanups()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.

Preprocessed file (*.ii) is attached.

Let me know if there is information missing.

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

* [Bug c++/109490] ICE when declaring custom OpenMP reduction in generic Lambda in Template Function
  2023-04-12 19:37 [Bug c++/109490] New: ICE when using custom OpenMP reduction in Lambda in Template Function simon-pfahler at gmx dot de
@ 2023-04-12 19:50 ` pinskia at gcc dot gnu.org
  2023-04-13  8:16 ` [Bug c++/109490] [11/12/13 Regression] ICE when declaring custom OpenMP reduction in generic Lambda in Template Function since r11-3236-g8155316c6fc230 marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-12 19:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
            Summary|ICE when using custom       |ICE when declaring custom
                   |OpenMP reduction in generic |OpenMP reduction in generic
                   |Lambda in Template Function |Lambda in Template Function
   Last reconfirmed|                            |2023-04-12

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced:
```
template <class T> void add(int const &maxs) {
  auto step = [&](auto const &maxs) {
    #pragma omp declare reduction(MyRed:double : omp_out += omp_in)
  };

  return step(maxs);
}

int main() { add<double>(100); }
```

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

* [Bug c++/109490] [11/12/13 Regression] ICE when declaring custom OpenMP reduction in generic Lambda in Template Function since r11-3236-g8155316c6fc230
  2023-04-12 19:37 [Bug c++/109490] New: ICE when using custom OpenMP reduction in Lambda in Template Function simon-pfahler at gmx dot de
  2023-04-12 19:50 ` [Bug c++/109490] ICE when declaring custom OpenMP reduction in generic " pinskia at gcc dot gnu.org
@ 2023-04-13  8:16 ` marxin at gcc dot gnu.org
  2023-04-13 11:22 ` rguenth at gcc dot gnu.org
  2023-05-29 10:08 ` [Bug c++/109490] [11/12/13/14 " jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-04-13  8:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org
            Summary|ICE when declaring custom   |[11/12/13 Regression] ICE
                   |OpenMP reduction in generic |when declaring custom
                   |Lambda in Template Function |OpenMP reduction in generic
                   |                            |Lambda in Template Function
                   |                            |since
                   |                            |r11-3236-g8155316c6fc230

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

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

* [Bug c++/109490] [11/12/13 Regression] ICE when declaring custom OpenMP reduction in generic Lambda in Template Function since r11-3236-g8155316c6fc230
  2023-04-12 19:37 [Bug c++/109490] New: ICE when using custom OpenMP reduction in Lambda in Template Function simon-pfahler at gmx dot de
  2023-04-12 19:50 ` [Bug c++/109490] ICE when declaring custom OpenMP reduction in generic " pinskia at gcc dot gnu.org
  2023-04-13  8:16 ` [Bug c++/109490] [11/12/13 Regression] ICE when declaring custom OpenMP reduction in generic Lambda in Template Function since r11-3236-g8155316c6fc230 marxin at gcc dot gnu.org
@ 2023-04-13 11:22 ` rguenth at gcc dot gnu.org
  2023-05-29 10:08 ` [Bug c++/109490] [11/12/13/14 " jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-13 11:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.4
           Priority|P3                          |P2

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

* [Bug c++/109490] [11/12/13/14 Regression] ICE when declaring custom OpenMP reduction in generic Lambda in Template Function since r11-3236-g8155316c6fc230
  2023-04-12 19:37 [Bug c++/109490] New: ICE when using custom OpenMP reduction in Lambda in Template Function simon-pfahler at gmx dot de
                   ` (2 preceding siblings ...)
  2023-04-13 11:22 ` rguenth at gcc dot gnu.org
@ 2023-05-29 10:08 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-29 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.4                        |11.5

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.4 is being released, retargeting bugs to GCC 11.5.

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

end of thread, other threads:[~2023-05-29 10:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-12 19:37 [Bug c++/109490] New: ICE when using custom OpenMP reduction in Lambda in Template Function simon-pfahler at gmx dot de
2023-04-12 19:50 ` [Bug c++/109490] ICE when declaring custom OpenMP reduction in generic " pinskia at gcc dot gnu.org
2023-04-13  8:16 ` [Bug c++/109490] [11/12/13 Regression] ICE when declaring custom OpenMP reduction in generic Lambda in Template Function since r11-3236-g8155316c6fc230 marxin at gcc dot gnu.org
2023-04-13 11:22 ` rguenth at gcc dot gnu.org
2023-05-29 10:08 ` [Bug c++/109490] [11/12/13/14 " 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).