Hello,

the PR 59150 seems to be fixed:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59150

On arm-rtems (this is virtually the same as ARM EABI) I get the following test failure:

spawn -ignore SIGHUP /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../xg++ -B/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../ /home/sh/archive/gcc-git/gcc/testsuite/g++.dg/gomp/pr59150.C -fno-diagnostics-show-caret -fdiagnostics-color=never -nostdinc++ -I/scratch/git-rtems-testing/gcc/b-arm-gcc/arm-rtems4.11/libstdc++-v3/include/arm-rtems4.11 -I/scratch/git-rtems-testing/gcc/b-arm-gcc/arm-rtems4.11/libstdc++-v3/include -I/home/sh/archive/gcc-git/libstdc++-v3/libsupc++ -I/home/sh/archive/gcc-git/libstdc++-v3/include/backward -I/home/sh/archive/gcc-git/libstdc++-v3/testsuite/util -fmessage-length=0 -std=gnu++98 -O -fopenmp-simd -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dce -S -isystem /scratch/git-rtems-testing/gcc/b-arm-gcc/arm-rtems4.11/./newlib/targ-include -isystem /home/sh/archive/gcc-git/newlib/libc/include -B/scratch/git-rtems-testing/gcc/install-git/arm-rtems4.11/edb7312/lib/ -specs bsp_specs -qrtems -o pr59150.s *** glibc detected *** /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus: double free or corruption (fasttop): 0x000000000191f620 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x766d6)[0x7f838f9e76d6]
/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z14free_data_refs3vecIP14data_reference7va_heap6vl_ptrE+0x3e)[0x10198ee] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z21vect_destroy_datarefsP14_loop_vec_infoP12_bb_vec_info+0x68)[0xd35608] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z21destroy_loop_vec_infoP14_loop_vec_infob+0x17d)[0xd1869d] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z17vect_analyze_loopP4loop+0x134)[0xd1f3b4] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z15vectorize_loopsv+0xb90)[0xd36710] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z16execute_one_passP8opt_pass+0x343)[0xa87253] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z17execute_pass_listP8opt_pass+0x16)[0xa87546] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z17execute_pass_listP8opt_pass+0x28)[0xa87558] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z17execute_pass_listP8opt_pass+0x28)[0xa87558]
/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus[0x8167b3]
/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z7compilev+0x5f9)[0x818669] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z25finalize_compilation_unitv+0x65)[0x818ed5] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z28cp_write_global_declarationsv+0xf5c)[0x6060dc]
/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus[0xb2e8ad]
/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z11toplev_mainiPPc+0xb22)[0xb30622]
/lib64/libc.so.6(__libc_start_main+0xed)[0x7f838f99223d]
/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus[0x51232d]
======= Memory map: ========
00400000-015b9000 r-xp 00000000 08:16 5377862 /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/cc1plus 017b8000-017ba000 r--p 011b8000 08:16 5377862 /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/cc1plus 017ba000-017c5000 rw-p 011ba000 08:16 5377862 /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/cc1plus
017c5000-0193e000 rw-p 00000000 00:00 0                                  [heap]
7f838f35b000-7f838f370000 r-xp 00000000 08:03 131176 /lib64/libgcc_s.so.1 7f838f370000-7f838f56f000 ---p 00015000 08:03 131176 /lib64/libgcc_s.so.1 7f838f56f000-7f838f570000 r--p 00014000 08:03 131176 /lib64/libgcc_s.so.1 7f838f570000-7f838f571000 rw-p 00015000 08:03 131176 /lib64/libgcc_s.so.1
7f838f571000-7f838f971000 rw-p 00000000 00:00 0
7f838f971000-7f838faf8000 r-xp 00000000 08:03 131080 /lib64/libc-2.14.1.so 7f838faf8000-7f838fcf7000 ---p 00187000 08:03 131080 /lib64/libc-2.14.1.so 7f838fcf7000-7f838fcfb000 r--p 00186000 08:03 131080 /lib64/libc-2.14.1.so 7f838fcfb000-7f838fcfc000 rw-p 0018a000 08:03 131080 /lib64/libc-2.14.1.so
7f838fcfc000-7f838fd01000 rw-p 00000000 00:00 0
7f838fd01000-7f838fd57000 r-xp 00000000 08:03 131088 /lib64/libm-2.14.1.so 7f838fd57000-7f838ff56000 ---p 00056000 08:03 131088 /lib64/libm-2.14.1.so 7f838ff56000-7f838ff57000 r--p 00055000 08:03 131088 /lib64/libm-2.14.1.so 7f838ff57000-7f838ff58000 rw-p 00056000 08:03 131088 /lib64/libm-2.14.1.so 7f838ff58000-7f838ff6f000 r-xp 00000000 08:03 131123 /lib64/libz.so.1.2.5 7f838ff6f000-7f839016e000 ---p 00017000 08:03 131123 /lib64/libz.so.1.2.5 7f839016e000-7f839016f000 r--p 00016000 08:03 131123 /lib64/libz.so.1.2.5 7f839016f000-7f8390170000 rw-p 00017000 08:03 131123 /lib64/libz.so.1.2.5 7f8390170000-7f8390172000 r-xp 00000000 08:03 131086 /lib64/libdl-2.14.1.so 7f8390172000-7f8390372000 ---p 00002000 08:03 131086 /lib64/libdl-2.14.1.so 7f8390372000-7f8390373000 r--p 00002000 08:03 131086 /lib64/libdl-2.14.1.so 7f8390373000-7f8390374000 rw-p 00003000 08:03 131086 /lib64/libdl-2.14.1.so 7f8390374000-7f8390394000 r-xp 00000000 08:03 137899 /lib64/ld-2.14.1.so
7f83904fb000-7f8390592000 rw-p 00000000 00:00 0
7f8390592000-7f8390594000 rw-p 00000000 00:00 0
7f8390594000-7f8390595000 r--p 00020000 08:03 137899 /lib64/ld-2.14.1.so 7f8390595000-7f8390596000 rw-p 00021000 08:03 137899 /lib64/ld-2.14.1.so
7f8390596000-7f8390597000 rw-p 00000000 00:00 0
7fff67853000-7fff67877000 rw-p 00000000 00:00 0                          [stack]
7fff678d3000-7fff678d4000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] /home/sh/archive/gcc-git/gcc/testsuite/g++.dg/gomp/pr59150.C: In function 'int foo()': /home/sh/archive/gcc-git/gcc/testsuite/g++.dg/gomp/pr59150.C:8:1: internal compiler error: Aborted
0xb2e34f crash_signal
        /home/sh/archive/gcc-git/gcc/toplev.c:337
0x10198ed free_data_refs(vec<data_reference*, va_heap, vl_ptr>)
        /home/sh/archive/gcc-git/gcc/tree-data-ref.c:4829
0xd35607 vect_destroy_datarefs(_loop_vec_info*, _bb_vec_info*)
        /home/sh/archive/gcc-git/gcc/tree-vectorizer.c:318
0xd1869c destroy_loop_vec_info(_loop_vec_info*, bool)
        /home/sh/archive/gcc-git/gcc/tree-vect-loop.c:1019
0xd1f3b3 vect_analyze_loop(loop*)
        /home/sh/archive/gcc-git/gcc/tree-vect-loop.c:1853
0xd3670f vectorize_loops()
        /home/sh/archive/gcc-git/gcc/tree-vectorizer.c:430
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
compiler exited with status 1
output is:
*** glibc detected *** /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus: double free or corruption (fasttop): 0x000000000191f620 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x766d6)[0x7f838f9e76d6]
/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z14free_data_refs3vecIP14data_reference7va_heap6vl_ptrE+0x3e)[0x10198ee] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z21vect_destroy_datarefsP14_loop_vec_infoP12_bb_vec_info+0x68)[0xd35608] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z21destroy_loop_vec_infoP14_loop_vec_infob+0x17d)[0xd1869d] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z17vect_analyze_loopP4loop+0x134)[0xd1f3b4] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z15vectorize_loopsv+0xb90)[0xd36710] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z16execute_one_passP8opt_pass+0x343)[0xa87253] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z17execute_pass_listP8opt_pass+0x16)[0xa87546] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z17execute_pass_listP8opt_pass+0x28)[0xa87558] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z17execute_pass_listP8opt_pass+0x28)[0xa87558]
/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus[0x8167b3]
/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z7compilev+0x5f9)[0x818669] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z25finalize_compilation_unitv+0x65)[0x818ed5] /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z28cp_write_global_declarationsv+0xf5c)[0x6060dc]
/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus[0xb2e8ad]
/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus(_Z11toplev_mainiPPc+0xb22)[0xb30622]
/lib64/libc.so.6(__libc_start_main+0xed)[0x7f838f99223d]
/scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/testsuite/g++/../../cc1plus[0x51232d]
======= Memory map: ========
00400000-015b9000 r-xp 00000000 08:16 5377862 /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/cc1plus 017b8000-017ba000 r--p 011b8000 08:16 5377862 /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/cc1plus 017ba000-017c5000 rw-p 011ba000 08:16 5377862 /scratch/git-rtems-testing/gcc/b-arm-gcc/gcc/cc1plus
017c5000-0193e000 rw-p 00000000 00:00 0                                  [heap]
7f838f35b000-7f838f370000 r-xp 00000000 08:03 131176 /lib64/libgcc_s.so.1 7f838f370000-7f838f56f000 ---p 00015000 08:03 131176 /lib64/libgcc_s.so.1 7f838f56f000-7f838f570000 r--p 00014000 08:03 131176 /lib64/libgcc_s.so.1 7f838f570000-7f838f571000 rw-p 00015000 08:03 131176 /lib64/libgcc_s.so.1
7f838f571000-7f838f971000 rw-p 00000000 00:00 0
7f838f971000-7f838faf8000 r-xp 00000000 08:03 131080 /lib64/libc-2.14.1.so 7f838faf8000-7f838fcf7000 ---p 00187000 08:03 131080 /lib64/libc-2.14.1.so 7f838fcf7000-7f838fcfb000 r--p 00186000 08:03 131080 /lib64/libc-2.14.1.so 7f838fcfb000-7f838fcfc000 rw-p 0018a000 08:03 131080 /lib64/libc-2.14.1.so
7f838fcfc000-7f838fd01000 rw-p 00000000 00:00 0
7f838fd01000-7f838fd57000 r-xp 00000000 08:03 131088 /lib64/libm-2.14.1.so 7f838fd57000-7f838ff56000 ---p 00056000 08:03 131088 /lib64/libm-2.14.1.so 7f838ff56000-7f838ff57000 r--p 00055000 08:03 131088 /lib64/libm-2.14.1.so 7f838ff57000-7f838ff58000 rw-p 00056000 08:03 131088 /lib64/libm-2.14.1.so 7f838ff58000-7f838ff6f000 r-xp 00000000 08:03 131123 /lib64/libz.so.1.2.5 7f838ff6f000-7f839016e000 ---p 00017000 08:03 131123 /lib64/libz.so.1.2.5 7f839016e000-7f839016f000 r--p 00016000 08:03 131123 /lib64/libz.so.1.2.5 7f839016f000-7f8390170000 rw-p 00017000 08:03 131123 /lib64/libz.so.1.2.5 7f8390170000-7f8390172000 r-xp 00000000 08:03 131086 /lib64/libdl-2.14.1.so 7f8390172000-7f8390372000 ---p 00002000 08:03 131086 /lib64/libdl-2.14.1.so 7f8390372000-7f8390373000 r--p 00002000 08:03 131086 /lib64/libdl-2.14.1.so 7f8390373000-7f8390374000 rw-p 00003000 08:03 131086 /lib64/libdl-2.14.1.so 7f8390374000-7f8390394000 r-xp 00000000 08:03 137899 /lib64/ld-2.14.1.so
7f83904fb000-7f8390592000 rw-p 00000000 00:00 0
7f8390592000-7f8390594000 rw-p 00000000 00:00 0
7f8390594000-7f8390595000 r--p 00020000 08:03 137899 /lib64/ld-2.14.1.so 7f8390595000-7f8390596000 rw-p 00021000 08:03 137899 /lib64/ld-2.14.1.so
7f8390596000-7f8390597000 rw-p 00000000 00:00 0
7fff67853000-7fff67877000 rw-p 00000000 00:00 0                          [stack]
7fff678d3000-7fff678d4000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] /home/sh/archive/gcc-git/gcc/testsuite/g++.dg/gomp/pr59150.C: In function 'int foo()': /home/sh/archive/gcc-git/gcc/testsuite/g++.dg/gomp/pr59150.C:8:1: internal compiler error: Aborted
0xb2e34f crash_signal
        /home/sh/archive/gcc-git/gcc/toplev.c:337
0x10198ed free_data_refs(vec<data_reference*, va_heap, vl_ptr>)
        /home/sh/archive/gcc-git/gcc/tree-data-ref.c:4829
0xd35607 vect_destroy_datarefs(_loop_vec_info*, _bb_vec_info*)
        /home/sh/archive/gcc-git/gcc/tree-vectorizer.c:318
0xd1869c destroy_loop_vec_info(_loop_vec_info*, bool)
        /home/sh/archive/gcc-git/gcc/tree-vect-loop.c:1019
0xd1f3b3 vect_analyze_loop(loop*)
        /home/sh/archive/gcc-git/gcc/tree-vect-loop.c:1853
0xd3670f vectorize_loops()
        /home/sh/archive/gcc-git/gcc/tree-vectorizer.c:430
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

FAIL: g++.dg/gomp/pr59150.C -std=gnu++98 (internal compiler error)
FAIL: g++.dg/gomp/pr59150.C -std=gnu++98 (test for excess errors)

With this GCC version:

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207415 138bc75d-0d04-0410-961f-82ee72b054a4

On 2013-11-26 21:48, Jakub Jelinek wrote:
Hi!

The problem here is that lower_rec_input_clauses for privatized reference
vars in clauses adds u = &u.1; statements, which is usually the right thing,
but if this is a reduction in simd loop for which we are going to handle
using simd arrays, then we want to set DECL_VALUE_EXPR of the var to
something and having statement referencing such value in the IL is
undesirable.  Normally it will be removed as dead before expansion,
but with a few disabled optimizations it can make it through to expansion
and ICE there.

Fixed by deferring addition of the u = &u.1; statement for references
with reductions with placeholders.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

2013-11-26  Jakub Jelinek  <ja...@redhat.com>

        PR middle-end/59150
        * omp-low.c (lower_rec_input_clause): For reduction with placeholder
        of references to constant size types in simd loops, defer emitting
        initializer for the new_var, emit it later on only if not using
        SIMD arrays for it.

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

--- gcc/omp-low.c.jj    2013-11-26 14:20:46.000000000 +0100
+++ gcc/omp-low.c       2013-11-26 15:59:28.478863002 +0100
@@ -3185,15 +3185,26 @@ lower_rec_input_clauses (tree clauses, g
                }
              else if (TREE_CONSTANT (x))
                {
-                 const char *name = NULL;
-                 if (DECL_NAME (var))
-                   name = IDENTIFIER_POINTER (DECL_NAME (new_var));
-
-                 x = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (new_var)),
-                                         name);
-                 gimple_add_tmp_var (x);
-                 TREE_ADDRESSABLE (x) = 1;
-                 x = build_fold_addr_expr_loc (clause_loc, x);
+                 /* For reduction with placeholder in SIMD loop,
+                    defer adding the initialization of the reference,
+                    because if we decide to use SIMD array for it,
+                    the initilization could cause expansion ICE.  */
+                 if (c_kind == OMP_CLAUSE_REDUCTION
+                     && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)
+                     && is_simd)
+                   x = NULL_TREE;
+                 else
+                   {
+                     const char *name = NULL;
+                     if (DECL_NAME (var))
+                       name = IDENTIFIER_POINTER (DECL_NAME (new_var));
+
+                     x = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (new_var)),
+                                             name);
+                     gimple_add_tmp_var (x);
+                     TREE_ADDRESSABLE (x) = 1;
+                     x = build_fold_addr_expr_loc (clause_loc, x);
+                   }
                }
              else
                {
@@ -3201,8 +3212,11 @@ lower_rec_input_clauses (tree clauses, g
                  x = build_call_expr_loc (clause_loc, atmp, 1, x);
                }

-             x = fold_convert_loc (clause_loc, TREE_TYPE (new_var), x);
-             gimplify_assign (new_var, x, ilist);
+             if (x)
+               {
+                 x = fold_convert_loc (clause_loc, TREE_TYPE (new_var), x);
+                 gimplify_assign (new_var, x, ilist);
+               }

              new_var = build_simple_mem_ref_loc (clause_loc, new_var);
            }
@@ -3500,6 +3514,29 @@ lower_rec_input_clauses (tree clauses, g
                        }
                      break;
                    }
+                 /* If this is a reference to constant size reduction var
+                    with placeholder, we haven't emitted the initializer
+                    for it because it is undesirable if SIMD arrays are used.
+                    But if they aren't used, we need to emit the deferred
+                    initialization now.  */
+                 else if (is_reference (var) && is_simd)
+                   {
+                     tree z
+                       = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (new_vard)));
+                     if (TREE_CONSTANT (z))
+                       {
+                         const char *name = NULL;
+                         if (DECL_NAME (var))
+                           name = IDENTIFIER_POINTER (DECL_NAME (new_vard));
+
+                         z = create_tmp_var_raw
+                               (TREE_TYPE (TREE_TYPE (new_vard)), name);
+                         gimple_add_tmp_var (z);
+                         TREE_ADDRESSABLE (z) = 1;
+                         z = build_fold_addr_expr_loc (clause_loc, z);
+                         gimplify_assign (new_vard, z, ilist);
+                       }
+                   }
                  x = lang_hooks.decls.omp_clause_default_ctor
                                (c, new_var, unshare_expr (x));
                  if (x)
--- gcc/testsuite/g++.dg/gomp/pr59150.C.jj      2013-11-26 16:02:00.452084567 
+0100
+++ gcc/testsuite/g++.dg/gomp/pr59150.C 2013-11-26 16:01:41.000000000 +0100
@@ -0,0 +1,25 @@
+// PR middle-end/59150
+// { dg-do compile }
+// { dg-options "-O -fopenmp-simd -fno-tree-ccp -fno-tree-copy-prop 
-fno-tree-dce" }
+
+#pragma omp declare reduction (foo: int: omp_out += omp_in) initializer 
(omp_priv = 0)
+
+int
+foo ()
+{
+  int i, v, &u = v;
+  #pragma omp simd reduction (foo:u)
+    for (i = 0; i < 1024; i++)
+      u = i;
+  return u;
+}
+
+int
+bar ()
+{
+  int i, v, &u = v;
+  #pragma omp simd reduction (foo:u) safelen(1)
+    for (i = 0; i < 1024; i++)
+      u = i;
+  return u;
+}

        Jakub



--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

Reply via email to