Hi!

I've backported a couple of patches to 4.5 branch and committed them
after bootstrapping/regtesting on x86_64-linux and i686-linux.

Additionally, I've added testcase for PR fortran/48117
to 4.5 (where it is newly fixed) and 4.6/4.7 (where it has been
fixed quite some time ago already by Richard during MEM_REF fixing).

        Jakub
2011-04-07  Jakub Jelinek  <ja...@redhat.com>

        Backported from mainline
        2010-07-01  Richard Guenther  <rguent...@suse.de>

        * omp-low.c (scan_omp_1_op): Don't change type of INTEGER_CSTs
        directly.

--- gcc/omp-low.c       (revision 161654)
+++ gcc/omp-low.c       (revision 161655)
@@ -1916,7 +1916,18 @@ scan_omp_1_op (tree *tp, int *walk_subtr
        {
          *walk_subtrees = 1;
          if (ctx)
-           TREE_TYPE (t) = remap_type (TREE_TYPE (t), &ctx->cb);
+           {
+             tree tem = remap_type (TREE_TYPE (t), &ctx->cb);
+             if (tem != TREE_TYPE (t))
+               {
+                 if (TREE_CODE (t) == INTEGER_CST)
+                   *tp = build_int_cst_wide (tem,
+                                             TREE_INT_CST_LOW (t),
+                                             TREE_INT_CST_HIGH (t));
+                 else
+                   TREE_TYPE (t) = tem;
+               }
+           }
        }
       break;
     }
2011-04-07  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/47391
        * tree-ssa-ccp.c (get_symbol_constant_value): Don't optimize
        if sym is volatile.

        Backport from mainline
        2011-01-21  Jakub Jelinek  <ja...@redhat.com>
 
        PR tree-optimization/47391
        * gcc.dg/pr47391.c: New test.

--- gcc/tree-ssa-ccp.c.jj       2011-03-09 20:44:38.000000000 +0100
+++ gcc/tree-ssa-ccp.c  2011-04-07 17:59:48.003808381 +0200
@@ -277,7 +277,7 @@ tree
 get_symbol_constant_value (tree sym)
 {
   if (TREE_STATIC (sym)
-      && (TREE_READONLY (sym)
+      && ((TREE_READONLY (sym) && !TREE_THIS_VOLATILE (sym))
          || TREE_CODE (sym) == CONST_DECL))
     {
       tree val = DECL_INITIAL (sym);
--- gcc/testsuite/gcc.dg/pr47391.c      (revision 0)
+++ gcc/testsuite/gcc.dg/pr47391.c      (revision 169084)
@@ -0,0 +1,22 @@
+/* PR tree-optimization/47391 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+const volatile int v = 1;
+int i = 0;
+
+void
+foo (void)
+{
+  i = v;
+}
+
+int
+main (void)
+{
+  foo ();
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "i = 1;" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
2011-04-07  Jakub Jelinek  <ja...@redhat.com>

        Backported from mainline
        2011-01-26  Jakub Jelinek  <ja...@redhat.com>

        PR c/47473
        * c-lex.c (interpret_float): If CPP_N_IMAGINARY, ensure
        EXCESS_PRECISION_EXPR is created with COMPLEX_TYPE instead of
        REAL_TYPE.

        * gcc.dg/torture/pr47473.c: New test.

--- gcc/c-lex.c (revision 169298)
+++ gcc/c-lex.c (revision 169299)
@@ -752,8 +752,15 @@ interpret_float (const cpp_token *token,
   /* Create a node with determined type and value.  */
   value = build_real (const_type, real);
   if (flags & CPP_N_IMAGINARY)
-    value = build_complex (NULL_TREE, convert (const_type, integer_zero_node),
-                          value);
+    {
+      value = build_complex (NULL_TREE, convert (const_type,
+                                                integer_zero_node), value);
+      if (type != const_type)
+       {
+         const_type = TREE_TYPE (value);
+         type = build_complex_type (type);
+       }
+    }
 
   if (type != const_type)
     value = build1 (EXCESS_PRECISION_EXPR, type, value);
--- gcc/testsuite/gcc.dg/torture/pr47473.c      (revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr47473.c      (revision 169299)
@@ -0,0 +1,14 @@
+/* PR c/47473 */
+/* { dg-do run } */
+/* { dg-options "-std=c99" } */
+
+int
+main (void)
+{
+  long double _Complex w = 0.2L - 0.3iL;
+  w = w * (0.3L - (0.0F + 1.0iF) * 0.9L);
+  if (__builtin_fabsl (__real__ w + 0.21L) > 0.001L
+      || __builtin_fabsl (__imag__ w + 0.27L) > 0.001L)
+    __builtin_abort ();
+  return 0;
+}
2011-04-07  Jakub Jelinek  <ja...@redhat.com>

        Backported from mainline
        2011-02-19  Jakub Jelinek  <ja...@redhat.com>

        PR c/47809
        * c-common.c (c_fully_fold_internal): Handle VIEW_CONVERT_EXPR.

        * gcc.target/i386/pr47809.c: New test.

--- gcc/c-common.c      (revision 170322)
+++ gcc/c-common.c      (revision 170323)
@@ -1213,6 +1213,7 @@ c_fully_fold_internal (tree expr, bool i
     case FIX_TRUNC_EXPR:
     case FLOAT_EXPR:
     CASE_CONVERT:
+    case VIEW_CONVERT_EXPR:
     case NON_LVALUE_EXPR:
     case NEGATE_EXPR:
     case BIT_NOT_EXPR:
--- gcc/testsuite/gcc.target/i386/pr47809.c     (revision 0)
+++ gcc/testsuite/gcc.target/i386/pr47809.c     (revision 170323)
@@ -0,0 +1,13 @@
+/* PR c/47809 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+#include <emmintrin.h>
+double bar (double, double);
+
+__m128d
+foo (__m128d x)
+{
+  x *= (__m128d) { bar (1.0, 1.0), 0.0 };
+  return (__m128d) ((__m128i) x ^ (__m128i) { 0, 0});
+}
2011-04-07  Jakub Jelinek  <ja...@redhat.com>

        Backported from mainline
        2011-03-03  Jakub Jelinek  <ja...@redhat.com>

        PR c/47963
        * gimplify.c (omp_add_variable): Only call omp_notice_variable
        on TYPE_SIZE_UNIT if it is a DECL.

        * gcc.dg/gomp/pr47963.c: New test.
        * g++.dg/gomp/pr47963.C: New test.

--- gcc/gimplify.c      (revision 170654)
+++ gcc/gimplify.c      (revision 170655)
@@ -5511,7 +5511,8 @@ omp_add_variable (struct gimplify_omp_ct
         For local variables TYPE_SIZE_UNIT might not be gimplified yet,
         in this case omp_notice_variable will be called later
         on when it is gimplified.  */
-      else if (! (flags & GOVD_LOCAL))
+      else if (! (flags & GOVD_LOCAL)
+              && DECL_P (TYPE_SIZE_UNIT (TREE_TYPE (decl))))
        omp_notice_variable (ctx, TYPE_SIZE_UNIT (TREE_TYPE (decl)), true);
     }
   else if (lang_hooks.decls.omp_privatize_by_reference (decl))
--- gcc/testsuite/gcc.dg/gomp/pr47963.c (revision 0)
+++ gcc/testsuite/gcc.dg/gomp/pr47963.c (revision 170655)
@@ -0,0 +1,11 @@
+/* PR c/47963 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void
+foo (float n)
+{
+  int A[n][n]; /* { dg-error "has non-integer type" } */
+#pragma omp parallel private(A)
+  ;
+}
--- gcc/testsuite/g++.dg/gomp/pr47963.C (revision 0)
+++ gcc/testsuite/g++.dg/gomp/pr47963.C (revision 170655)
@@ -0,0 +1,11 @@
+// PR c/47963
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+void
+foo (float n)
+{
+  int A[n][n]; // { dg-error "has non-integral type" }
+#pragma omp parallel private(A)
+  ;
+}
2011-04-07  Jakub Jelinek  <ja...@redhat.com>

        Backported from mainline
        2011-03-17  Jakub Jelinek  <ja...@redhat.com>

        PR rtl-optimization/48141
        * dse.c (record_store): If no positions are needed in an insn
        that cannot be deleted, at least unchain it from active_local_stores.

        * gcc.dg/pr48141.c: New test.

--- gcc/dse.c   (revision 171088)
+++ gcc/dse.c   (revision 171089)
@@ -1530,8 +1530,7 @@ record_store (rtx body, bb_info_t bb_inf
 
       /* An insn can be deleted if every position of every one of
         its s_infos is zero.  */
-      if (any_positions_needed_p (s_info)
-         || ptr->cannot_delete)
+      if (any_positions_needed_p (s_info))
        del = false;
 
       if (del)
@@ -1543,7 +1542,8 @@ record_store (rtx body, bb_info_t bb_inf
          else
            active_local_stores = ptr->next_local_store;
 
-         delete_dead_store_insn (insn_to_delete);
+         if (!insn_to_delete->cannot_delete)
+           delete_dead_store_insn (insn_to_delete);
        }
       else
        last = ptr;
--- gcc/testsuite/gcc.dg/pr48141.c      (revision 0)
+++ gcc/testsuite/gcc.dg/pr48141.c      (revision 171089)
@@ -0,0 +1,17 @@
+/* PR rtl-optimization/48141 */
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-fre" } */
+
+#define A i = 0;
+#define B A A A A A A A A A A
+#define C B B B B B B B B B B
+#define D C C C C C C C C C C
+#define E D D D D D D D D D D
+
+int
+foo (void)
+{
+  volatile int i = 0;
+  E E E E E E E E E E E
+  return 0;
+}
2011-04-07  Jakub Jelinek  <ja...@redhat.com>

        Backported from mainline
        2011-03-24  Jakub Jelinek  <ja...@redhat.com>

        PR debug/48204
        * simplify-rtx.c (simplify_const_unary_operation): Call
        real_convert when changing mode class with FLOAT_EXTEND.

        * gcc.dg/dfp/pr48204.c: New test.

--- gcc/simplify-rtx.c  (revision 171422)
+++ gcc/simplify-rtx.c  (revision 171423)
@@ -1526,7 +1526,8 @@ simplify_const_unary_operation (enum rtx
     }
 
   else if (GET_CODE (op) == CONST_DOUBLE
-          && SCALAR_FLOAT_MODE_P (mode))
+          && SCALAR_FLOAT_MODE_P (mode)
+          && SCALAR_FLOAT_MODE_P (GET_MODE (op)))
     {
       REAL_VALUE_TYPE d, t;
       REAL_VALUE_FROM_CONST_DOUBLE (d, op);
@@ -1549,7 +1550,10 @@ simplify_const_unary_operation (enum rtx
          d = real_value_truncate (mode, d);
          break;
        case FLOAT_EXTEND:
-         /* All this does is change the mode.  */
+         /* All this does is change the mode, unless changing
+            mode class.  */
+         if (GET_MODE_CLASS (mode) != GET_MODE_CLASS (GET_MODE (op)))
+           real_convert (&d, mode, &d);
          break;
        case FIX:
          real_arithmetic (&d, FIX_TRUNC_EXPR, &d, NULL);
--- gcc/testsuite/gcc.dg/dfp/pr48204.c  (revision 0)
+++ gcc/testsuite/gcc.dg/dfp/pr48204.c  (revision 171423)
@@ -0,0 +1,10 @@
+/* PR debug/48204 */
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-ccp -fno-tree-dominator-opts -fno-tree-fre -g" } 
*/
+
+void
+foo (void)
+{
+  float cf = 3.0f;
+  _Decimal64 d64 = cf;
+}
2011-04-07  Jakub Jelinek  <ja...@redhat.com>

        Backported from mainline
        2011-04-06  Jakub Jelinek  <ja...@redhat.com>

        PR debug/48466
        * dwarf2out.c (based_loc_descr): If drap_reg is INVALID_REGNUM, use
        as base_reg whatever register reg has been eliminated to, instead
        of hardcoding STACK_POINTER_REGNUM.

        * gcc.dg/guality/pr36977.c: New test.
        * gcc.dg/guality/pr48466.c: New test.

--- gcc/dwarf2out.c     (revision 172063)
+++ gcc/dwarf2out.c     (revision 172064)
@@ -13545,7 +13545,7 @@ based_loc_descr (rtx reg, HOST_WIDE_INT 
              int base_reg
                = DWARF_FRAME_REGNUM ((fde && fde->drap_reg != INVALID_REGNUM)
                                      ? HARD_FRAME_POINTER_REGNUM
-                                     : STACK_POINTER_REGNUM);
+                                     : REGNO (elim));
              return new_reg_loc_descr (base_reg, offset);
            }
 
--- gcc/testsuite/gcc.dg/guality/pr36977.c      (revision 0)
+++ gcc/testsuite/gcc.dg/guality/pr36977.c      (revision 172064)
@@ -0,0 +1,32 @@
+/* PR debug/36977 */
+/* { dg-do run } */
+/* { dg-options "-g" } */
+/* { dg-skip-if "" { *-*-* }  { "*" } { "-O0" } } */
+
+void
+foo ()
+{
+}
+
+int
+main ()
+{
+  struct { char c[100]; } cbig;
+  struct { int i[800]; } ibig;
+  struct { long l[900]; } lbig;
+  struct { float f[200]; } fbig;
+  struct { double d[300]; } dbig;
+  struct { short s[400]; } sbig;
+
+  ibig.i[0] = 55;              /* { dg-final { gdb-test 30 "ibig.i\[0\]" "55" 
} } */
+  ibig.i[100] = 5;             /* { dg-final { gdb-test 30 "ibig.i\[100\]" "5" 
} } */
+  cbig.c[0] = '\0';            /* { dg-final { gdb-test 30 "cbig.c\[0\]" 
"'\\0'" } } */
+  cbig.c[99] = 'A';            /* { dg-final { gdb-test 30 "cbig.c\[99\]" 
"'A'" } } */
+  fbig.f[100] = 11.0;          /* { dg-final { gdb-test 30 "fbig.f\[100\]" 
"11" } } */
+  dbig.d[202] = 9.0;           /* { dg-final { gdb-test 30 "dbig.d\[202\]" "9" 
} } */
+  sbig.s[90] = 255;            /* { dg-final { gdb-test 30 "sbig.s\[90\]" 
"255" } } */
+  lbig.l[333] = 999;           /* { dg-final { gdb-test 30 "lbig.l\[333\]" 
"999" } } */
+
+  foo ();
+  return 0;
+}
--- gcc/testsuite/gcc.dg/guality/pr48466.c      (revision 0)
+++ gcc/testsuite/gcc.dg/guality/pr48466.c      (revision 172064)
@@ -0,0 +1,41 @@
+/* PR debug/48466 */
+/* { dg-do run } */
+/* { dg-options "-g" } */
+/* { dg-skip-if "" { *-*-* }  { "*" } { "-O0" } } */
+
+struct S { unsigned int a; unsigned int *b; };
+struct T { struct S a; struct S b; };
+struct U { const char *u; };
+int n[10];
+volatile int v;
+
+struct U
+foo (const char *s)
+{
+  struct U r;
+  r.u = s;
+  return r;
+}
+
+void
+bar (struct T *s, int a, int b)
+{
+  s->a.a = a;
+  s->a.b = &s->a.a;
+  s->b.a = b;
+  s->b.b = &s->b.a;
+}
+
+int
+main ()
+{
+  struct T t;
+  struct U x = foo ("this is x");
+  struct S y, z;
+  y.b = n;             /* { dg-final { gdb-test 38 "t.a.a" "17" } } */
+  y.a = 0;             /* { dg-final { gdb-test 38 "*t.a.b" "17" } } */
+  bar (&t, 17, 21);    /* { dg-final { gdb-test 38 "t.b.a" "21" } } */
+  v++;                 /* { dg-final { gdb-test 38 "*t.b.b" "21" } } */
+  z = y;
+  return 0;
+}
2011-04-07  Jakub Jelinek  <ja...@redhat.com>

        PR fortran/48117
        * gfortran.dg/gomp/pr48117.f90: New test.

--- gcc/testsuite/gfortran.dg/gomp/pr48117.f90.jj       2011-01-16 
05:42:39.626675592 +0100
+++ gcc/testsuite/gfortran.dg/gomp/pr48117.f90  2011-04-07 16:43:20.902808325 
+0200
@@ -0,0 +1,11 @@
+! PR fortran/48117
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp" }
+
+subroutine foo(x)
+  character(len=*), optional :: x
+  character(len=80) :: v
+  !$omp master
+    if (present(x)) v = adjustl(x)
+  !$omp end master
+end subroutine foo

Reply via email to