public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108607] New: [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003
@ 2023-01-30 20:09 gscfq@t-online.de
  2023-01-31  8:52 ` [Bug c++/108607] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gscfq@t-online.de @ 2023-01-30 20:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108607
           Summary: [12/13 Regression] ICE in
                    potential_constant_expression_1, at
                    cp/constexpr.cc:10003
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20210808 and 20210822 :


$ cat z1.cc
constexpr int bar (int x);
constexpr int foo (int x)
{
  [[omp::directive (scope nowait)]]
  return bar (x);
}


$ g++-13-20230129 -c z1.cc -fopenmp
z1.cc: In function 'constexpr int foo(int)':
z1.cc:5:16: error: invalid exit from OpenMP structured block
    5 |   return bar (x);
      |                ^
z1.cc:6:1: sorry, unimplemented: unexpected AST of kind omp_scope
    6 | }
      | ^
z1.cc:6:1: internal compiler error: in potential_constant_expression_1, at
cp/constexpr.cc:10003
0x893ef0 potential_constant_expression_1
        ../../gcc/cp/constexpr.cc:10003
0x89536a potential_constant_expression_1(tree_node*, bool, bool, bool, bool,
int)
        ../../gcc/cp/constexpr.cc:10027
0x896166 potential_rvalue_constant_expression(tree_node*)
        ../../gcc/cp/constexpr.cc:10047
0x896166 maybe_save_constexpr_fundef(tree_node*)
        ../../gcc/cp/constexpr.cc:959
0x926a31 finish_function(bool)
        ../../gcc/cp/decl.cc:18204
0xa64e03 cp_parser_function_definition_after_declarator
        ../../gcc/cp/parser.cc:31998
0xa6633c cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.cc:31912
0xa6633c cp_parser_init_declarator
        ../../gcc/cp/parser.cc:22777
0xa36572 cp_parser_simple_declaration
        ../../gcc/cp/parser.cc:15390
0xa6dd1b cp_parser_declaration
        ../../gcc/cp/parser.cc:15076
0xa6e838 cp_parser_translation_unit
        ../../gcc/cp/parser.cc:5131
0xa6e838 c_parse_file()
        ../../gcc/cp/parser.cc:49472
0xc169e1 c_common_parse_file()
        ../../gcc/c-family/c-opts.cc:1248

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

* [Bug c++/108607] [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003
  2023-01-30 20:09 [Bug c++/108607] New: [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003 gscfq@t-online.de
@ 2023-01-31  8:52 ` rguenth at gcc dot gnu.org
  2023-01-31 16:01 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-31  8:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.3
           Keywords|                            |error-recovery

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

* [Bug c++/108607] [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003
  2023-01-30 20:09 [Bug c++/108607] New: [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003 gscfq@t-online.de
  2023-01-31  8:52 ` [Bug c++/108607] " rguenth at gcc dot gnu.org
@ 2023-01-31 16:01 ` jakub at gcc dot gnu.org
  2023-02-01  9:43 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-31 16:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-01-31
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54376
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54376&action=edit
gcc13-pr108607.patch

Untested fix.

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

* [Bug c++/108607] [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003
  2023-01-30 20:09 [Bug c++/108607] New: [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003 gscfq@t-online.de
  2023-01-31  8:52 ` [Bug c++/108607] " rguenth at gcc dot gnu.org
  2023-01-31 16:01 ` jakub at gcc dot gnu.org
@ 2023-02-01  9:43 ` cvs-commit at gcc dot gnu.org
  2023-02-01  9:45 ` [Bug c++/108607] [12 " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-01  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:bfc070595bfb00abef88a002eee5d9117f5b86a7

commit r13-5621-gbfc070595bfb00abef88a002eee5d9117f5b86a7
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Feb 1 10:38:46 2023 +0100

    c++, openmp: Handle some OMP_*/OACC_* constructs during constant expression
evaluation [PR108607]

    While potential_constant_expression_1 handled most of OMP_* codes (by
saying that
    they aren't potential constant expressions), OMP_SCOPE was missing in that
list.
    I've also added OMP_SCAN, though that is less important (similarly to
OMP_SECTION
    it ought to appear solely inside of OMP_{FOR,SIMD} resp. OMP_SECTIONS).
    As the testcase shows, it isn't enough, potential_constant_expression_1
    can catch only some cases, as soon as one uses switch or ifs where at least
    one of the possible paths could be constant expression, we can run into the
    same codes during cxx_eval_constant_expression, so this patch handles those
    there as well.

    2023-02-01  Jakub Jelinek  <jakub@redhat.com>

            PR c++/108607
            * constexpr.cc (cxx_eval_constant_expression): Handle OMP_*
            and OACC_* constructs as non-constant.
            (potential_constant_expression_1): Handle OMP_SCAN and OMP_SCOPE.

            * g++.dg/gomp/pr108607.C: New test.

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

* [Bug c++/108607] [12 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003
  2023-01-30 20:09 [Bug c++/108607] New: [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-02-01  9:43 ` cvs-commit at gcc dot gnu.org
@ 2023-02-01  9:45 ` jakub at gcc dot gnu.org
  2023-02-10 17:46 ` 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 @ 2023-02-01  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12/13 Regression] ICE in   |[12 Regression] ICE in
                   |potential_constant_expressi |potential_constant_expressi
                   |on_1, at                    |on_1, at
                   |cp/constexpr.cc:10003       |cp/constexpr.cc:10003

--- Comment #3 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 c++/108607] [12 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003
  2023-01-30 20:09 [Bug c++/108607] New: [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2023-02-01  9:45 ` [Bug c++/108607] [12 " jakub at gcc dot gnu.org
@ 2023-02-10 17:46 ` cvs-commit at gcc dot gnu.org
  2023-02-10 18:01 ` 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 @ 2023-02-10 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:a62d952064c896eaf94e70d7999e6e27343babcf

commit r12-9148-ga62d952064c896eaf94e70d7999e6e27343babcf
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Feb 1 10:38:46 2023 +0100

    c++, openmp: Handle some OMP_*/OACC_* constructs during constant expression
evaluation [PR108607]

    While potential_constant_expression_1 handled most of OMP_* codes (by
saying that
    they aren't potential constant expressions), OMP_SCOPE was missing in that
list.
    I've also added OMP_SCAN, though that is less important (similarly to
OMP_SECTION
    it ought to appear solely inside of OMP_{FOR,SIMD} resp. OMP_SECTIONS).
    As the testcase shows, it isn't enough, potential_constant_expression_1
    can catch only some cases, as soon as one uses switch or ifs where at least
    one of the possible paths could be constant expression, we can run into the
    same codes during cxx_eval_constant_expression, so this patch handles those
    there as well.

    2023-02-01  Jakub Jelinek  <jakub@redhat.com>

            PR c++/108607
            * constexpr.cc (cxx_eval_constant_expression): Handle OMP_*
            and OACC_* constructs as non-constant.
            (potential_constant_expression_1): Handle OMP_SCAN and OMP_SCOPE.

            * g++.dg/gomp/pr108607.C: New test.

    (cherry picked from commit bfc070595bfb00abef88a002eee5d9117f5b86a7)

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

* [Bug c++/108607] [12 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003
  2023-01-30 20:09 [Bug c++/108607] New: [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2023-02-10 17:46 ` cvs-commit at gcc dot gnu.org
@ 2023-02-10 18:01 ` jakub at gcc dot gnu.org
  2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
  2023-05-03 15:21 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-02-10 18:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug c++/108607] [12 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003
  2023-01-30 20:09 [Bug c++/108607] New: [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2023-02-10 18:01 ` jakub at gcc dot gnu.org
@ 2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
  2023-05-03 15:21 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-02 20:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:c5956b8cea7bf9b383a31af83e71f7cfc1a56bf1

commit r11-10705-gc5956b8cea7bf9b383a31af83e71f7cfc1a56bf1
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Feb 1 10:38:46 2023 +0100

    c++, openmp: Handle some OMP_*/OACC_* constructs during constant expression
evaluation [PR108607]

    While potential_constant_expression_1 handled most of OMP_* codes (by
saying that
    they aren't potential constant expressions), OMP_SCOPE was missing in that
list.
    I've also added OMP_SCAN, though that is less important (similarly to
OMP_SECTION
    it ought to appear solely inside of OMP_{FOR,SIMD} resp. OMP_SECTIONS).
    As the testcase shows, it isn't enough, potential_constant_expression_1
    can catch only some cases, as soon as one uses switch or ifs where at least
    one of the possible paths could be constant expression, we can run into the
    same codes during cxx_eval_constant_expression, so this patch handles those
    there as well.

    2023-02-01  Jakub Jelinek  <jakub@redhat.com>

            PR c++/108607
            * constexpr.c (cxx_eval_constant_expression): Handle OMP_*
            and OACC_* constructs as non-constant.
            (potential_constant_expression_1): Handle OMP_SCAN.

            * g++.dg/gomp/pr108607.C: New test.

    (cherry picked from commit bfc070595bfb00abef88a002eee5d9117f5b86a7)

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

* [Bug c++/108607] [12 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003
  2023-01-30 20:09 [Bug c++/108607] New: [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
@ 2023-05-03 15:21 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-03 15:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:bd28648bf4923592462a938b31069a06ee39caea

commit r10-11360-gbd28648bf4923592462a938b31069a06ee39caea
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Feb 1 10:38:46 2023 +0100

    c++, openmp: Handle some OMP_*/OACC_* constructs during constant expression
evaluation [PR108607]

    While potential_constant_expression_1 handled most of OMP_* codes (by
saying that
    they aren't potential constant expressions), OMP_SCOPE was missing in that
list.
    I've also added OMP_SCAN, though that is less important (similarly to
OMP_SECTION
    it ought to appear solely inside of OMP_{FOR,SIMD} resp. OMP_SECTIONS).
    As the testcase shows, it isn't enough, potential_constant_expression_1
    can catch only some cases, as soon as one uses switch or ifs where at least
    one of the possible paths could be constant expression, we can run into the
    same codes during cxx_eval_constant_expression, so this patch handles those
    there as well.

    2023-02-01  Jakub Jelinek  <jakub@redhat.com>

            PR c++/108607
            * constexpr.c (cxx_eval_constant_expression): Handle OMP_*
            and OACC_* constructs as non-constant.
            (potential_constant_expression_1): Handle OMP_SCAN.

            * g++.dg/gomp/pr108607.C: New test.

    (cherry picked from commit bfc070595bfb00abef88a002eee5d9117f5b86a7)

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

end of thread, other threads:[~2023-05-03 15:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30 20:09 [Bug c++/108607] New: [12/13 Regression] ICE in potential_constant_expression_1, at cp/constexpr.cc:10003 gscfq@t-online.de
2023-01-31  8:52 ` [Bug c++/108607] " rguenth at gcc dot gnu.org
2023-01-31 16:01 ` jakub at gcc dot gnu.org
2023-02-01  9:43 ` cvs-commit at gcc dot gnu.org
2023-02-01  9:45 ` [Bug c++/108607] [12 " jakub at gcc dot gnu.org
2023-02-10 17:46 ` cvs-commit at gcc dot gnu.org
2023-02-10 18:01 ` jakub at gcc dot gnu.org
2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
2023-05-03 15:21 ` cvs-commit 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).