OSDN Git Service

PR fortran/39354
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Mar 2009 16:43:42 +0000 (16:43 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Mar 2009 16:43:42 +0000 (16:43 +0000)
* gimplify.c (goa_stabilize_expr): Handle tcc_comparison,
TRUTH_ANDIF_EXPR and TRUTH_ORIF_EXPR.

* gfortran.dg/gomp/pr39354.f90: New test.

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

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr39354.f90 [new file with mode: 0644]

index e71e642..3869882 100644 (file)
@@ -1,3 +1,9 @@
+2009-03-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/39354
+       * gimplify.c (goa_stabilize_expr): Handle tcc_comparison,
+       TRUTH_ANDIF_EXPR and TRUTH_ORIF_EXPR.
+
 2009-03-03  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/39272
index ae12424..02d4923 100644 (file)
@@ -6047,12 +6047,27 @@ goa_stabilize_expr (tree *expr_p, gimple_seq *pre_p, tree lhs_addr,
   switch (TREE_CODE_CLASS (TREE_CODE (expr)))
     {
     case tcc_binary:
+    case tcc_comparison:
       saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 1), pre_p, lhs_addr,
                                     lhs_var);
     case tcc_unary:
       saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 0), pre_p, lhs_addr,
                                     lhs_var);
       break;
+    case tcc_expression:
+      switch (TREE_CODE (expr))
+       {
+       case TRUTH_ANDIF_EXPR:
+       case TRUTH_ORIF_EXPR:
+         saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 1), pre_p,
+                                        lhs_addr, lhs_var);
+         saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 0), pre_p,
+                                        lhs_addr, lhs_var);
+         break;
+       default:
+         break;
+       }
+      break;
     default:
       break;
     }
index 3bb4d97..a4bfe79 100644 (file)
@@ -1,5 +1,8 @@
 2009-03-03  Jakub Jelinek  <jakub@redhat.com>
 
+       PR fortran/39354
+       * gfortran.dg/gomp/pr39354.f90: New test.
+
        PR tree-optimization/39343
        * gcc.dg/pr39343.c: New test.
 
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr39354.f90 b/gcc/testsuite/gfortran.dg/gomp/pr39354.f90
new file mode 100644 (file)
index 0000000..3b9c327
--- /dev/null
@@ -0,0 +1,37 @@
+! PR fortran/39354
+! { dg-do compile }
+! { dg-options "-fopenmp" }
+      SUBROUTINE ltest(l1, l2, l3, l4, r1, r2, r3, r4)
+      LOGICAL l1, l2, l3, l4, r1, r2, r3, r4
+!$OMP ATOMIC
+      l1 = l1 .and. r1
+!$OMP ATOMIC
+      l2 = l2 .or. r2
+!$OMP ATOMIC
+      l3 = l3 .eqv. r3
+!$OMP ATOMIC
+      l4 = l4 .neqv. r4
+      END
+      SUBROUTINE itest(l1, l2, l3, l4, l5, l6, l7, l8, l9, &
+&                      r1, r2, r3, r4, r5, r6, r7, r8, r9)
+      INTEGER l1, l2, l3, l4, l5, l6, l7, l8, l9, &
+&             r1, r2, r3, r4, r5, r6, r7, r8, r9
+!$OMP ATOMIC
+      l1 = l1 + r1
+!$OMP ATOMIC
+      l2 = l2 - r2
+!$OMP ATOMIC
+      l3 = l3 * r3
+!$OMP ATOMIC
+      l4 = l4 / r4
+!$OMP ATOMIC
+      l5 = max (l5, r1, r5)
+!$OMP ATOMIC
+      l6 = min (r1, r6, l6)
+!$OMP ATOMIC
+      l7 = iand (l7, r7)
+!$OMP ATOMIC
+      l8 = ior (r8, l8)
+!$OMP ATOMIC
+      l9 = ieor (l9, r9)
+      END