public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp
@ 2023-09-02 12:38 dcb314 at hotmail dot com
  2023-09-02 13:56 ` [Bug c++/111274] " dcb314 at hotmail dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: dcb314 at hotmail dot com @ 2023-09-02 12:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111274
           Summary: ice in fixup_blocks_walker with -O1 and -fopenmp
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Created attachment 55831
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55831&action=edit
gzipped C++ source code

The attached C++ code does this with recent gcc trunk:

foundBugs $ /home/dcb38/gcc/results.20230825.asan.ubsan/bin/gcc -c -w -O1
-fopenmp bug956.cc
foundBugs $ /home/dcb38/gcc/results.20230829.asan.ubsan/bin/gcc -c -w -O1
-fopenmp bug956.cc
BipartiteGraphPartialColoring/BipartiteGraphPartialOrdering.cpp: In member
function ‘int
ColPack::BipartiteGraphPartialOrdering::RowSmallestLastOrdering_OMP()’:
BipartiteGraphPartialColoring/BipartiteGraphPartialOrdering.cpp:388:3: internal
compiler error: Segmentation fault
0x1156c49 crash_signal(int)
        ../../trunk.year/gcc/toplev.cc:314
0x978dda tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../trunk.year/gcc/tree.h:3579
0x978dda fixup_blocks_walker(tree_node**, int*, void*)
        ../../trunk.year/gcc/cp/parser.cc:44487

The bug first seems to appear sometime between g:449ab115dece8ac8
and g:f30d6a48635b5b18.

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
@ 2023-09-02 13:56 ` dcb314 at hotmail dot com
  2023-09-02 15:36 ` dcb314 at hotmail dot com
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: dcb314 at hotmail dot com @ 2023-09-02 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
Reduced C++ code seems to be:

struct _Vector_base {
  ~_Vector_base();
};
int ColumnSmallestLastOrdering_OMP_i_MaxNumThreads,
    ColumnSmallestLastOrdering_OMP_i_MaxDegree;
void ColumnSmallestLastOrdering_OMP() {
#pragma omp for
  for (int i = 0; i < ColumnSmallestLastOrdering_OMP_i_MaxNumThreads; i++)
    new _Vector_base[ColumnSmallestLastOrdering_OMP_i_MaxDegree];
}

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
  2023-09-02 13:56 ` [Bug c++/111274] " dcb314 at hotmail dot com
@ 2023-09-02 15:36 ` dcb314 at hotmail dot com
  2023-09-02 15:47 ` dcb314 at hotmail dot com
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: dcb314 at hotmail dot com @ 2023-09-02 15:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from David Binderman <dcb314 at hotmail dot com> ---
In git, there are 71 commits, so trying g:c28c579f0dd9cd27.

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
  2023-09-02 13:56 ` [Bug c++/111274] " dcb314 at hotmail dot com
  2023-09-02 15:36 ` dcb314 at hotmail dot com
@ 2023-09-02 15:47 ` dcb314 at hotmail dot com
  2023-09-02 16:36 ` dcb314 at hotmail dot com
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: dcb314 at hotmail dot com @ 2023-09-02 15:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---
All the OpenMP commits in that range are by Sandra Loosemore
<sandra@codesourcery.com>.

Not sure yet, but a likely candidate so far.

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2023-09-02 15:47 ` dcb314 at hotmail dot com
@ 2023-09-02 16:36 ` dcb314 at hotmail dot com
  2023-09-02 16:58 ` dcb314 at hotmail dot com
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: dcb314 at hotmail dot com @ 2023-09-02 16:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from David Binderman <dcb314 at hotmail dot com> ---
Git range is g:4024ddbe50c2d1cb .. g:87f9b6c2cfd7b829,
so 9 commits left.

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2023-09-02 16:36 ` dcb314 at hotmail dot com
@ 2023-09-02 16:58 ` dcb314 at hotmail dot com
  2023-09-02 17:34 ` dcb314 at hotmail dot com
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: dcb314 at hotmail dot com @ 2023-09-02 16:58 UTC (permalink / raw)
  To: gcc-bugs

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

David Binderman <dcb314 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sandra at codesourcery dot com

--- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
As expected, one for Sandra. List of commits in the good .. bad range
are

commit 87f9b6c2cfd7b8299b2ab50bf587e864ced43185
commit b7c4a12a9df3170090a431fa4364b97b30b87752
commit 410df0843dbf08280813165bca72cfdaa21c8f23
commit 53891f18f32588d86ba0ec1c5e6206df63be714b
commit 143151ac2013c22e471dd674d02c7dec0798d3bd

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2023-09-02 16:58 ` dcb314 at hotmail dot com
@ 2023-09-02 17:34 ` dcb314 at hotmail dot com
  2023-09-02 17:53 ` sandra at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: dcb314 at hotmail dot com @ 2023-09-02 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from David Binderman <dcb314 at hotmail dot com> ---
$ git bisect good 143151ac2013c22e
53891f18f32588d86ba0ec1c5e6206df63be714b is the first bad commit
commit 53891f18f32588d86ba0ec1c5e6206df63be714b
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Thu Aug 24 17:35:00 2023 +0000

    OpenMP: C++ support for imperfectly-nested loops

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2023-09-02 17:34 ` dcb314 at hotmail dot com
@ 2023-09-02 17:53 ` sandra at gcc dot gnu.org
  2023-09-03  4:17 ` sandra at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: sandra at gcc dot gnu.org @ 2023-09-02 17:53 UTC (permalink / raw)
  To: gcc-bugs

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

sandra at gcc dot gnu.org changed:

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

--- Comment #7 from sandra at gcc dot gnu.org ---
I'll take a peek.  Thanks for the reduced testcase!

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2023-09-02 17:53 ` sandra at gcc dot gnu.org
@ 2023-09-03  4:17 ` sandra at gcc dot gnu.org
  2023-09-03  4:27 ` sandra at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: sandra at gcc dot gnu.org @ 2023-09-03  4:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from sandra at gcc dot gnu.org ---
Created attachment 55832
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55832&action=edit
first attempt at fix

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2023-09-03  4:17 ` sandra at gcc dot gnu.org
@ 2023-09-03  4:27 ` sandra at gcc dot gnu.org
  2023-09-04  7:30 ` dcb314 at hotmail dot com
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: sandra at gcc dot gnu.org @ 2023-09-03  4:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from sandra at gcc dot gnu.org ---
The problem is that it's tripping over a BIND_EXPR with a null BIND_EXPR_BLOCK.
The attached patch stops the testcase from ICE'ing but hasn't been otherwise
tested yet.

I'm not sure what a null BIND_EXPR_BLOCK actually means, or if it might be a
bug elsewhere that such a thing is being created?  The comments on BIND_EXPR in
tree.def seem to imply that there is always an associated block.  If it's
permissible, maybe the fix ought to pass through the superblock pointer in the
recursive call instead of the null block pointer.

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
                   ` (8 preceding siblings ...)
  2023-09-03  4:27 ` sandra at gcc dot gnu.org
@ 2023-09-04  7:30 ` dcb314 at hotmail dot com
  2023-09-05  5:10 ` sandra at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: dcb314 at hotmail dot com @ 2023-09-04  7:30 UTC (permalink / raw)
  To: gcc-bugs

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

David Binderman <dcb314 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #10 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to sandra from comment #9)
> I'm not sure what a null BIND_EXPR_BLOCK actually means, or if it might be a
> bug elsewhere that such a thing is being created?  The comments on BIND_EXPR
> in tree.def seem to imply that there is always an associated block.  If it's
> permissible, maybe the fix ought to pass through the superblock pointer in
> the recursive call instead of the null block pointer.

My best guess is to ask Richard. If he doesn't know, he is likely
to know someone who will.

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
                   ` (9 preceding siblings ...)
  2023-09-04  7:30 ` dcb314 at hotmail dot com
@ 2023-09-05  5:10 ` sandra at gcc dot gnu.org
  2023-09-07 16:26 ` sandra at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: sandra at gcc dot gnu.org @ 2023-09-05  5:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from sandra at gcc dot gnu.org ---
OK, I've been digging around in the code.  do_poplevel() only fills in
BIND_EXPR_BLOCK if stmts_are_full_exprs_p() is true.  I haven't figured out the
control flow that affects the latter predicate or how the vars in a BIND_EXPR
end up associated with some other block, but I understand what a
full-expression is in C++, so I think I can go off and come up with some test
cases to exercise that and figure out what the right thing to do with the tree
coming in to this restructuring is.

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
                   ` (10 preceding siblings ...)
  2023-09-05  5:10 ` sandra at gcc dot gnu.org
@ 2023-09-07 16:26 ` sandra at gcc dot gnu.org
  2023-09-07 17:52 ` cvs-commit at gcc dot gnu.org
  2023-09-07 17:54 ` sandra at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: sandra at gcc dot gnu.org @ 2023-09-07 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from sandra at gcc dot gnu.org ---
Improved and tested patch posted here:

https://gcc.gnu.org/pipermail/gcc-patches/2023-September/629616.html

IIUC the temporaries introduced in non-full-expressions are bound in a block
that encloses the entire full-expression.  The restructuring that moves
intervening code into the loop body operates on whole statements, not
subexpressions, so I convinced myself there should be nothing to do here.

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
                   ` (11 preceding siblings ...)
  2023-09-07 16:26 ` sandra at gcc dot gnu.org
@ 2023-09-07 17:52 ` cvs-commit at gcc dot gnu.org
  2023-09-07 17:54 ` sandra at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-07 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Sandra Loosemore <sandra@gcc.gnu.org>:

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

commit r14-3791-gab4bdad49716eb1c60e22e0e617d5eb56b0bac6f
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Thu Sep 7 16:12:20 2023 +0000

    OpenMP: Fix ICE in fixup_blocks_walker [PR111274]

    This ICE was caused by an invalid assumption that all BIND_EXPRs have
    a non-null BIND_EXPR_BLOCK.  In C++ these do exist and are used for
    temporaries introduced in expressions that are not full-expressions.
    Since they have no block to fix up, the traversal can just ignore
    these tree nodes.

    gcc/cp/ChangeLog
            PR c++/111274
            * parser.cc (fixup_blocks_walker): Check for null BIND_EXPR_BLOCK.

    gcc/testsuite/ChangeLog
            PR c++/111274
            * g++.dg/gomp/pr111274.C: New test case.

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

* [Bug c++/111274] ice in fixup_blocks_walker with -O1 and -fopenmp
  2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
                   ` (12 preceding siblings ...)
  2023-09-07 17:52 ` cvs-commit at gcc dot gnu.org
@ 2023-09-07 17:54 ` sandra at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: sandra at gcc dot gnu.org @ 2023-09-07 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

sandra at gcc dot gnu.org changed:

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

--- Comment #14 from sandra at gcc dot gnu.org ---
Should be fixed now.

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

end of thread, other threads:[~2023-09-07 17:54 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-02 12:38 [Bug c++/111274] New: ice in fixup_blocks_walker with -O1 and -fopenmp dcb314 at hotmail dot com
2023-09-02 13:56 ` [Bug c++/111274] " dcb314 at hotmail dot com
2023-09-02 15:36 ` dcb314 at hotmail dot com
2023-09-02 15:47 ` dcb314 at hotmail dot com
2023-09-02 16:36 ` dcb314 at hotmail dot com
2023-09-02 16:58 ` dcb314 at hotmail dot com
2023-09-02 17:34 ` dcb314 at hotmail dot com
2023-09-02 17:53 ` sandra at gcc dot gnu.org
2023-09-03  4:17 ` sandra at gcc dot gnu.org
2023-09-03  4:27 ` sandra at gcc dot gnu.org
2023-09-04  7:30 ` dcb314 at hotmail dot com
2023-09-05  5:10 ` sandra at gcc dot gnu.org
2023-09-07 16:26 ` sandra at gcc dot gnu.org
2023-09-07 17:52 ` cvs-commit at gcc dot gnu.org
2023-09-07 17:54 ` sandra 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).