re PR c++/80141 (ICE with pragma omp declare)
authorJakub Jelinek <jakub@redhat.com>
Wed, 22 Mar 2017 18:53:47 +0000 (19:53 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 22 Mar 2017 18:53:47 +0000 (19:53 +0100)
PR c++/80141
* semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
processing_template_decl.

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

From-SVN: r246403

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gomp/pr80141.C [new file with mode: 0644]

index 3db9895d5a8cb14da8ac17eb8d37ace6d29c7b0c..4493515ced8dba36b80a53fb3c5053bd60eded10 100644 (file)
@@ -1,3 +1,10 @@
+2017-03-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/80141
+       * semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
+       case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
+       processing_template_decl.
+
 2017-03-21  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/77752
index bcfdd668c3a36ffe943c5d0b8892f6c81c5bed32..ad5299a06eefc6d91c4a1ab93ce08da14c6389ca 100644 (file)
@@ -6416,9 +6416,9 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          else
            {
              t = mark_rvalue_use (t);
-             t = maybe_constant_value (t);
              if (!processing_template_decl)
                {
+                 t = maybe_constant_value (t);
                  if (TREE_CODE (t) != INTEGER_CST
                      || tree_int_cst_sgn (t) != 1)
                    {
@@ -6586,9 +6586,9 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          else
            {
              t = mark_rvalue_use (t);
-             t = maybe_constant_value (t);
              if (!processing_template_decl)
                {
+                 t = maybe_constant_value (t);
                  if (TREE_CODE (t) != INTEGER_CST
                      || tree_int_cst_sgn (t) != 1)
                    {
index add3a14eca52c728239546fef1fab4583f294b30..d8ae1ff3fa7721924ed2cebba21538dfbef6cca4 100644 (file)
@@ -1,5 +1,8 @@
 2017-03-22  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/80141
+       * g++.dg/gomp/pr80141.C: New test.
+
        PR c++/80129
        * g++.dg/torture/pr80129.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/gomp/pr80141.C b/gcc/testsuite/g++.dg/gomp/pr80141.C
new file mode 100644 (file)
index 0000000..53e497a
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/80141
+// { dg-do compile }
+
+#pragma omp declare simd aligned (p : 2 && 2)
+template<int> void foo (int *p);
+
+#pragma omp declare simd simdlen (2 && 2)
+template<int> void bar (int *p);