public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/103192] New: [12 Regression] ICE on libgomp target-in-reduction-2.{C,c}
@ 2021-11-11 14:39 jakub at gcc dot gnu.org
  2021-11-11 15:31 ` [Bug tree-optimization/103192] " jakub at gcc dot gnu.org
                   ` (25 more replies)
  0 siblings, 26 replies; 27+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-11-11 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103192
           Summary: [12 Regression] ICE on libgomp
                    target-in-reduction-2.{C,c}
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

I see ICE when compiling these testcases in a bootstrapped compiler:
../configure --enable-languages=default,ada,obj-c++,lto,go,d
--enable-checking=yes,rtl,extra && make -j32 bootstrap
cd x86_64-*/libgomp
make check RUNTESTFLAGS='c.exp=target-in-reduction-2.c
c++.exp=target-in-reduction-2*'
FAIL: libgomp.c/../libgomp.c-c++-common/target-in-reduction-2.c (internal
compiler error)
FAIL: libgomp.c/../libgomp.c-c++-common/target-in-reduction-2.c (test for
excess errors)
UNRESOLVED: libgomp.c/../libgomp.c-c++-common/target-in-reduction-2.c
compilation failed to produce executable
FAIL: libgomp.c++/../libgomp.c-c++-common/target-in-reduction-2.c (internal
compiler error)
FAIL: libgomp.c++/../libgomp.c-c++-common/target-in-reduction-2.c (test for
excess errors)
UNRESOLVED: libgomp.c++/../libgomp.c-c++-common/target-in-reduction-2.c
compilation failed to produce executable
FAIL: libgomp.c++/target-in-reduction-2.C (internal compiler error)
FAIL: libgomp.c++/target-in-reduction-2.C (test for excess errors)
UNRESOLVED: libgomp.c++/target-in-reduction-2.C compilation failed to produce
executable
but can't reproduce that with stage1 gcc.
The ICE is in omp_add_variable being called with NULL first argument, but the
source code has:
          omp_add_variable (ctx, decl, flags);
          if ((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
               || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_IN_REDUCTION
               || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_TASK_REDUCTION)
              && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
            {
              struct gimplify_omp_ctx *pctx
                = code == OMP_TARGET ? outer_ctx : ctx;
              if (pctx)
                omp_add_variable (pctx, OMP_CLAUSE_REDUCTION_PLACEHOLDER (c),
                                  GOVD_LOCAL | GOVD_SEEN);
                ^^^^^^^^^^^^^^^^ Inside of the above call
              if (pctx
                  && OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER (c)
                  && walk_tree (&OMP_CLAUSE_REDUCTION_INIT (c),
                                find_decl_expr,
                                OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER (c),
                                NULL) == NULL_TREE)
                omp_add_variable (pctx,
                                  OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER (c),
                                  GOVD_LOCAL | GOVD_SEEN);
outer_ctx can be NULL, ctx may not, but the source really should guarantee that
when code is OMP_TARGET (this case) and outer_ctx is NULL, then
omp_add_variable is not called.
In *.strlen1 dump I still see
  <bb 1285> [local count: 22959172]:
  [../../gcc/gimplify.c:10067:33] # DEBUG pctx => iftmp.2373_1469
  [../../gcc/gimplify.c:10069:8] # DEBUG BEGIN_STMT
  [../../gcc/gimplify.c:10069:8] if (iftmp.2373_1469 != 0B)
    goto <bb 1286>; [70.00%]
  else
    goto <bb 1289>; [30.00%]

  <bb 1286> [local count: 38024558]:
  [../../gcc/gimplify.c:10067:33] # DEBUG pctx => NULL
  [../../gcc/gimplify.c:10070:3] # DEBUG BEGIN_STMT
  [../../gcc/gimplify.c:10070:51] _761 = omp_clause_range_check (c_4680, 5, 7,
[../../gcc/gimplify.c:10070:51] "../../gcc/gimplify.c", 10070,
[../../gcc/gimplify.c:10070:51] "gimplify_scan_omp_clauses");
  [../../gcc/gimplify.c:10070:51] _762 = omp_clause_elt_check (_761, 3,
[../../gcc/gimplify.c:10070:51] "../../gcc/gimplify.c", 10070,
[../../gcc/gimplify.c:10070:51] "gimplify_scan_omp_clauses");
  [../../gcc/gimplify.c:10070:20] _763 = [../../gcc/gimplify.c:10070:20] *_762;
  [../../gcc/gimplify.c:10070:20] omp_add_variable (iftmp.2373_1469, _763,
129);
but in threadfull2 dump I see:
  [../../gcc/gimplify.c:10065:12] _3356 = [../../gcc/gimplify.c:10065:12]
MEM[(union tree_node * *)c_4680 + 80B];
  [../../gcc/gimplify.c:10065:8] if (_3356 != 0B)
    goto <bb 1286>; [70.00%]
  else
    goto <bb 1621>; [30.00%]
...
  <bb 1286> [local count: 38024558]:
  [../../gcc/gimplify.c:10067:8] # DEBUG BEGIN_STMT
  [../../gcc/gimplify.c:10067:33] # DEBUG pctx => NULL
  [../../gcc/gimplify.c:10067:33] # DEBUG pctx => NULL
  [../../gcc/gimplify.c:10070:3] # DEBUG BEGIN_STMT
  [../../gcc/gimplify.c:10070:51] _761 = omp_clause_range_check (c_4680, 5, 7,
[../../gcc/gimplify.c:10070:51] "../../gcc/gimplify.c", 10070,
[../../gcc/gimplify.c:10070:51] "gimplify_scan_omp_clauses");
  [../../gcc/gimplify.c:10070:51] _762 = omp_clause_elt_check (_761, 3,
[../../gcc/gimplify.c:10070:51] "../../gcc/gimplify.c", 10070,
[../../gcc/gimplify.c:10070:51] "gimplify_scan_omp_clauses");
  [../../gcc/gimplify.c:10070:20] _763 = [../../gcc/gimplify.c:10070:20] *_762;
  [../../gcc/gimplify.c:10070:20] omp_add_variable (iftmp.2373_1469, _763,
129);
which looks like OMP_CLAUSE_REDUCTION_PLACEHOLDER (c) check to me.

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

end of thread, other threads:[~2022-05-11  6:23 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 14:39 [Bug tree-optimization/103192] New: [12 Regression] ICE on libgomp target-in-reduction-2.{C,c} jakub at gcc dot gnu.org
2021-11-11 15:31 ` [Bug tree-optimization/103192] " jakub at gcc dot gnu.org
2021-11-11 17:28 ` pinskia at gcc dot gnu.org
2021-11-12  7:28 ` rguenth at gcc dot gnu.org
2021-11-12  8:15 ` aldyh at gcc dot gnu.org
2021-11-12 10:28 ` aldyh at gcc dot gnu.org
2021-11-12 11:13 ` jamborm at gcc dot gnu.org
2021-11-12 11:22 ` aldyh at gcc dot gnu.org
2021-11-12 11:31 ` jakub at gcc dot gnu.org
2021-11-12 11:38 ` aldyh at gcc dot gnu.org
2021-11-12 11:40 ` jakub at gcc dot gnu.org
2021-11-12 13:28 ` aldyh at gcc dot gnu.org
2021-11-12 13:30 ` aldyh at gcc dot gnu.org
2021-11-13 18:27 ` jakub at gcc dot gnu.org
2021-11-13 19:07 ` hubicka at gcc dot gnu.org
2021-11-15 20:30 ` amacleod at redhat dot com
2021-11-15 22:08 ` amacleod at redhat dot com
2021-11-16  3:12 ` law at gcc dot gnu.org
2021-11-16  8:37 ` jakub at gcc dot gnu.org
2021-11-16 12:17 ` aldyh at gcc dot gnu.org
2021-11-16 13:34 ` jakub at gcc dot gnu.org
2021-11-16 13:51 ` jakub at gcc dot gnu.org
2021-11-17 13:19 ` cvs-commit at gcc dot gnu.org
2021-11-22 17:45 ` jakub at gcc dot gnu.org
2021-11-29  8:49 ` cvs-commit at gcc dot gnu.org
2022-05-10  8:21 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:23 ` 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).