Re: [PATCH] Partial Transition fix attempt

2012-03-22 Thread Richard Guenther
On Wed, Mar 21, 2012 at 6:44 PM, redbrain redbr...@gcc.gnu.org wrote:
 in tree-mudflap.c to change usage of fold_conver to build_int_cst 
 http://gcc.gnu.org/wiki/Partial_Transitions. I am not 100% sure this is 
 correct but maybe someone can shed some light.

Doesn't look ok - how do you know you even have constants here?
Remember that fold_convert
handles non-constants just fine.

Richard.

 ---
  gcc/tree-mudflap.c |   38 --
  1 files changed, 20 insertions(+), 18 deletions(-)

 diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
 index e4f6ec0..684b7b4 100644
 --- a/gcc/tree-mudflap.c
 +++ b/gcc/tree-mudflap.c
 @@ -567,8 +567,7 @@ mf_build_check_statement_for (tree base, tree limit,

   /* Build: __mf_base = (uintptr_t) base address expression.  */
   seq = gimple_seq_alloc ();
 -  t = fold_convert_loc (location, mf_uintptr_type,
 -                       unshare_expr (base));
 +  t = build_int_cst_type (mf_uintptr_type, TREE_INT_CST_LOW (unshare_expr 
 (base)));
   t = force_gimple_operand (t, stmts, false, NULL_TREE);
   gimple_seq_add_seq (seq, stmts);
   g = gimple_build_assign (mf_base, t);
 @@ -576,8 +575,7 @@ mf_build_check_statement_for (tree base, tree limit,
   gimple_seq_add_stmt (seq, g);

   /* Build: __mf_limit = (uintptr_t) limit address expression.  */
 -  t = fold_convert_loc (location, mf_uintptr_type,
 -                       unshare_expr (limit));
 +  t = build_int_cst_type (mf_uintptr_type, TREE_INT_CST_LOW (unshare_expr 
 (limit)));
   t = force_gimple_operand (t, stmts, false, NULL_TREE);
   gimple_seq_add_seq (seq, stmts);
   g = gimple_build_assign (mf_limit, t);
 @@ -853,18 +851,21 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
            if (elt)
              elt = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (elt)),
                            elt);
 -            addr = fold_convert_loc (location, ptr_type_node, elt ? elt : 
 base);
 +           addr = build_int_cst_type (ptr_type_node, elt ? TREE_INT_CST_LOW 
 (elt) :
 +                                      TREE_INT_CST_LOW (base));
             addr = fold_build_pointer_plus_loc (location,
                                                addr, byte_position (field));
           }
         else
           addr = build1 (ADDR_EXPR, build_pointer_type (type), t);
 -
 +
         limit = fold_build2_loc (location, MINUS_EXPR, mf_uintptr_type,
 -                             fold_build2_loc (location, PLUS_EXPR, 
 mf_uintptr_type,
 -                                         fold_convert (mf_uintptr_type, 
 addr),
 -                                         size),
 -                             integer_one_node);
 +                                fold_build2_loc (location, PLUS_EXPR, 
 mf_uintptr_type,
 +                                                 build_int_cst_type 
 (mf_uintptr_type,
 +                                                                     
 TREE_INT_CST_LOW (addr)),
 +
 +                                                 size),
 +                                integer_one_node);
       }
       break;

 @@ -908,17 +909,17 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
           return;

         bpu = bitsize_int (BITS_PER_UNIT);
 -        ofs = fold_convert (bitsizetype, TREE_OPERAND (t, 2));
 +       ofs = build_int_cst_type (bitsizetype, TREE_INT_CST_LOW (TREE_OPERAND 
 (t, 2)));
         rem = size_binop_loc (location, TRUNC_MOD_EXPR, ofs, bpu);
         ofs = size_binop_loc (location, TRUNC_DIV_EXPR, ofs, bpu);

 -        size = fold_convert (bitsizetype, TREE_OPERAND (t, 1));
 +        size = build_int_cst_type (bitsizetype, TREE_INT_CST_LOW 
 (TREE_OPERAND (t, 1)));
         size = size_binop_loc (location, PLUS_EXPR, size, rem);
         size = size_binop_loc (location, CEIL_DIV_EXPR, size, bpu);
 -        size = fold_convert (sizetype, size);
 +        size = build_int_cst_type (sizetype, TREE_INT_CST_LOW (size));

         addr = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
 -        addr = fold_convert (ptr_type_node, addr);
 +        addr = build_int_cst_type (ptr_type_node, TREE_INT_CST_LOW (addr));
         addr = fold_build_pointer_plus_loc (location, addr, ofs);

         base = addr;
 @@ -1048,8 +1049,8 @@ mx_register_decls (tree decl, gimple_seq seq, 
 location_t location)

          /* Variable-sized objects should have sizes already been
             gimplified when we got here. */
 -         size = fold_convert (size_type_node,
 -                              TYPE_SIZE_UNIT (TREE_TYPE (decl)));
 +         size = build_int_cst_type (size_type_node,
 +                                    TREE_INT_CST_LOW (TYPE_SIZE_UNIT 
 (TREE_TYPE (decl;
          gcc_assert (is_gimple_val (size));


 @@ -1233,11 +1234,12 @@ mudflap_register_call (tree obj, tree object_size, 
 tree varname)
   tree arg, call_stmt;

   arg = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (obj)), obj);
 -  arg = fold_convert (ptr_type_node, arg);
 +  arg = 

Re: [PATCH][Testsuite] XFAIL scev-3/4.c and add scev-5.c

2012-03-22 Thread Richard Guenther
On Thu, Mar 22, 2012 at 3:19 AM, Jiangning Liu jiangning@arm.com wrote:
 Hi,

 This patch is to XFAIL scev-3.c and scev-5.c.

 The bug is going to be fixed after Richard Guenther fix a serials of
 problems related to POINTER_PLUS_EXPR and sizetype precision.

Ok.

Thanks,
Richard.

 Thanks,
 -Jiangning

 ChangeLog for testsuite:

 2012-03-21  Jiangning Liu  jiangning@arm.com

        PR tree-optimization/52563
        * gcc.dg/tree-ssa/scev-3.c: XFAIL on lp64.
        * gcc.dg/tree-ssa/scev-4.c: XFAIL on lp64.
        * gcc.dg/tree-ssa/scev-5.c: New.

 Thanks,
 -Jiangning

 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/scev-3.c
 b/gcc/testsuite/gcc.dg/tree-ssa/scev-3.c
 index 28d5c93..ed63a18 100644
 --- a/gcc/testsuite/gcc.dg/tree-ssa/scev-3.c
 +++ b/gcc/testsuite/gcc.dg/tree-ssa/scev-3.c
 @@ -14,5 +14,5 @@ f(int k)
         }
  }

 -/* { dg-final { scan-tree-dump-times a 1 optimized } } */
 +/* { dg-final { scan-tree-dump-times a 1 optimized { xfail lp64 }
 +} } */
  /* { dg-final { cleanup-tree-dump optimized } } */ diff --git
 a/gcc/testsuite/gcc.dg/tree-ssa/scev-4.c
 b/gcc/testsuite/gcc.dg/tree-ssa/scev-4.c
 index 6c1e530..a538c32 100644
 --- a/gcc/testsuite/gcc.dg/tree-ssa/scev-4.c
 +++ b/gcc/testsuite/gcc.dg/tree-ssa/scev-4.c
 @@ -19,5 +19,5 @@ f(int k)
         }
  }

 -/* { dg-final { scan-tree-dump-times a 1 optimized } } */
 +/* { dg-final { scan-tree-dump-times a 1 optimized { xfail lp64 }
 +} } */
  /* { dg-final { cleanup-tree-dump optimized } } */ diff --git
 a/gcc/testsuite/gcc.dg/tree-ssa/scev-5.c
 b/gcc/testsuite/gcc.dg/tree-ssa/scev-5.c
 new file mode 100644
 index 000..b9de36a
 --- /dev/null
 +++ b/gcc/testsuite/gcc.dg/tree-ssa/scev-5.c
 @@ -0,0 +1,18 @@
 +/* { dg-do compile } */
 +/* { dg-options -O2 -fdump-tree-optimized } */
 +
 +int *a_p;
 +int a[1000];
 +
 +f(int k)
 +{
 +        long long i;
 +
 +        for (i=k; i1000; i+=k) {
 +                a_p = a[i];
 +                *a_p = 100;
 +        }
 +}
 +
 +/* { dg-final { scan-tree-dump-times a 1 optimized } } */
 +/* { dg-final { cleanup-tree-dump optimized } } */





[PATCH] Fix PR52459

2012-03-22 Thread Richard Guenther

This fixes PR52459, we re-use VN reference to encode calls but
we are not interested in restricting call insertions in
PREs inhibit_phi_insertion (we at most have pure calls).

Boostrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2012-03-21  Richard Guenther  rguent...@suse.de

PR tree-optimization/52459
* tree-ssa-pre.c (inhibit_phi_insertion): Do not inhibit
PHI insertion for calls.

Index: gcc/tree-ssa-pre.c
===
*** gcc/tree-ssa-pre.c  (revision 185597)
--- gcc/tree-ssa-pre.c  (working copy)
*** inhibit_phi_insertion (basic_block bb, p
*** 3242,3247 
--- 3242,3251 
  {
switch (op-opcode)
{
+   case CALL_EXPR:
+ /* Calls are not a problem.  */
+ return false;
+ 
case ARRAY_REF:
case ARRAY_RANGE_REF:
  if (TREE_CODE (op-op0) != SSA_NAME)


Re: [PATCH, alpha]: Use generic config/elfos.h headers

2012-03-22 Thread Uros Bizjak
On Wed, Mar 21, 2012 at 11:37 PM, Richard Henderson r...@redhat.com wrote:

 Attached patch enables alpha to use generic config/elfos.h headers on
 linux and *bsd targets. The most important difference to generic
 elfos.h is in

       * config/alpha/elf.h (TARGET_ASM_FILE_START_FILE_DIRECTIVE): Undefine.

 This one can be deleted, since

No, we are still calling default_file_start in alpha_file_start, so we
have to signal that we don't want start file directive. In committed
patch, I have redefined T_A_F_S_F_D as false for this purpose:

+/* Do not output a .file directive at the beginning of the input file.  */
+
+#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE false

 +#undef USER_LABEL_PREFIX
  #define USER_LABEL_PREFIX 

 This ought to be deletable.

  /* We use the default ASCII-output routine, except that we don't write more
     than 50 characters since the assembler doesn't support very long lines.  
 */

 +#undef ASM_OUTPUT_ASCII
  #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \

 Likewise.  Since RO deleted all non-gas support.

Both removed.

Attached is the patch that was re-tested and committed.

Thanks,
Uros.
Index: config/alpha/elf.h
===
--- config/alpha/elf.h  (revision 185597)
+++ config/alpha/elf.h  (working copy)
@@ -19,95 +19,18 @@
 along with GCC; see the file COPYING3.  If not see
 http://www.gnu.org/licenses/.  */
 
-#define OBJECT_FORMAT_ELF
-
-#define DWARF2_DEBUGGING_INFO 1
-
-#undef  PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
-
-#undef ASM_FINAL_SPEC
-
-/* alpha/ doesn't use elfos.h for some reason.  */
-#define TARGET_OBJFMT_CPP_BUILTINS()   \
-  do   \
-{  \
-   builtin_define (__ELF__); \
-}  \
-  while (0)
-
 #undef  CC1_SPEC
 #define CC1_SPEC  %{G*}
 
 #undef  ASM_SPEC
 #define ASM_SPEC  %{G*} %{relax:-relax} 
%{!gstabs*:-no-mdebug}%{gstabs*:-mdebug}
 
-#undef  IDENT_ASM_OP
-#define IDENT_ASM_OP \t.ident\t
+/* Do not output a .file directive at the beginning of the input file.  */
+ 
+#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE false
 
-/* Output #ident as a .ident.  */
-#undef  ASM_OUTPUT_IDENT
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
-  fprintf (FILE, %s\%s\\n, IDENT_ASM_OP, NAME);
-
-/* This is how to allocate empty space in some section.  The .zero
-   pseudo-op is used for this on most svr4 assemblers.  */
-
-#undef  SKIP_ASM_OP
-#define SKIP_ASM_OP\t.zero\t
-
-#undef  ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE, SIZE) \
-  fprintf (FILE, %sHOST_WIDE_INT_PRINT_UNSIGNED\n, SKIP_ASM_OP, (SIZE))
-
-/* Output the label which precedes a jumptable.  Note that for all svr4
-   systems where we actually generate jumptables (which is to say every
-   svr4 target except i386, where we use casesi instead) we put the jump-
-   tables into the .rodata section and since other stuff could have been
-   put into the .rodata section prior to any given jumptable, we have to
-   make sure that the location counter for the .rodata section gets pro-
-   perly re-aligned prior to the actual beginning of the jump table.  */
-
-#undef  ALIGN_ASM_OP
-#define ALIGN_ASM_OP \t.align\t
-
-#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
-#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \
-  ASM_OUTPUT_ALIGN ((FILE), 2);
-#endif
-
-#undef  ASM_OUTPUT_CASE_LABEL
-#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE)\
-  do { \
-ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE)
\
-(*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); 
\
-  } while (0)
-
-/* The standard SVR4 assembler seems to require that certain builtin
-   library routines (e.g. .udiv) be explicitly declared as .globl
-   in each assembly file where they are referenced.  */
-
-#undef  ASM_OUTPUT_EXTERNAL_LIBCALL
-#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
-  (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
-
 /* This says how to output assembler code to declare an
-   uninitialized external linkage data object.  Under SVR4,
-   the linker seems to want the alignment of data objects
-   to depend on their types.  We do exactly that here.  */
-
-#undef  COMMON_ASM_OP
-#define COMMON_ASM_OP  \t.comm\t
-
-#undef  ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
-do {   \
-  fprintf ((FILE), %s, COMMON_ASM_OP);   \
-  assemble_name ((FILE), (NAME));  \
-  fprintf ((FILE), , HOST_WIDE_INT_PRINT_UNSIGNED ,%u\n, (SIZE), (ALIGN) / 
BITS_PER_UNIT); \

Re: [RFC][PATCH] A change to do_while_loop_p()

2012-03-22 Thread Richard Guenther
On Wed, 21 Mar 2012, Razya Ladelsky wrote:

 Hi,
 
 I need to use do_while_loop_p, but I'm not sure its functionality is what 
 I expected it to be.
 
 This is the part that I do not understand:
 
 /* If the header contains just a condition, it is not a do-while loop.  */
   stmt = last_and_only_stmt (loop-header);
  if (stmt
gimple_code (stmt) == GIMPLE_COND)
 return false;
 
 The header could contain a condition which is not the loop's exit 
 condition,
 but rather a part of its body, then  why do we rule out this loop as a 
 do_while loop?
 
 I ran into this in a loop (the outer loop) extracted from bwaves 
 benchmark:
 
   do k=1,nz
  km1=mod(k+nz-2,nz)+1
  kp1=mod(k,nz)+1
  do j=1,ny
 jm1=mod(j+ny-2,ny)+1
 jp1=mod(j,ny)+1
 .
  enddo
   enddo
  
 which was translated to:
 
 D.2361_17 = *ny_16(D);
 
 bb 5:
   # k_3 = PHI 1(4), k_562(25)
   if (D.2361_17  0)
 goto bb 8;
   else
 goto bb 6;
 
 bb 6:
   k_562 = k_3 + 1;
   # DEBUG k = k_562
   if (k_3 == D.1583_270)
 goto bb 7;  ---   return
   else
 goto bb 25;
 
 bb 25:
   goto bb 5;
 
 bb 8:  -- starting the body of the the second loop
   pretmp.318_776 = (integer(kind=8)) k_3;
   pretmp.318_777 = stride.92_20 * pretmp.318_776;
 ... 
 
 
 
 bb 5 is the header of the outer loop, and bb 25 is the latch.
 According to do_while_loop_p ()  this is NOT a do while loop, but it
 seems that it should be.
 
  I am attaching a patch to change do_while_loop_p() assuming that what I 
 understand is indeed correct,
  Please let me know if I'm right,

Not sure what your new tests should do - the patch lacks an update
to the comment.  Note that this predicate is first of all used
in loop header copying to say whether we should avoid copying
a header.  In this case the condition is not what should prevent
copying of the header, but your patch seems to make it so, no?

So, please clarify your change.

Richard.


[PATCH, MIPS] Add -march=xlp

2012-03-22 Thread Maxim Kuvyrkov
This patch adds basic support for Broadcom XLP (formerly NetLogic XLP) to GCC.

Tested by building a mips64-linux-gnu toolchain with -march=xlp.

OK to check in?

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics




gcc-basic-xlp.ChangeLog
Description: Binary data


gcc-basic-xlp.patch
Description: Binary data


[Patch V2] libgfortran: do not assume libm

2012-03-22 Thread Tristan Gingold
Hi,

this is version 2 of the patch.

The initial problem is that libgfortran configure.ac used AC_CHECK_LIB([m]…) to 
check wether several math functions are available.  That doesn't work on VMS, 
because there is no such things as a libm.

It seems to me that there are no autoconf macro to check wether a function is 
available: AC_CHECK_FUNC[S] don't allow to specify additional include files 
(necessary on VMS as some math functions are renamed through macros), and 
AC_CHECK_DECL only checks the presence of the declaration (as pointed out by 
Ralf).

So I have finally learnt a little bit more about autoconf and added a new file: 
config/math.m4 (build machinery maintainer cc:)
libgfortran/configure.ac now uses the new GCC_CHECK_MATH_FUNC macro.

Bootstrapped without gfortran regressions on x86_64-darwin.

Ok for trunk ?

(I will submit a follow-up change in libquadmath once this change is approved).

Tristan.

config/
2012-03-22  Tristan Gingold  ging...@adacore.com

* math.m4: New file.

libgfortran/
2012-03-22  Tristan Gingold  ging...@adacore.com

* configure.ac: Use GCC_CHECK_MATH_FUNC for math functions.
* acinclude.m4: Include ../config/math.m4
* configure: Regenerate.
* Makefile.in: Regenerate.


diff --git a/config/math.m4 b/config/math.m4
new file mode 100644
index 000..ceb29b4
--- /dev/null
+++ b/config/math.m4
@@ -0,0 +1,49 @@
+dnl GCC_CHECK_LIBM
+dnl
+dnl Check wether -lm is available.  This is a pre-requisite for
+dnl GCC_CHECK_MATH_FUNC so that it will link with -lm.
+AC_DEFUN([GCC_CHECK_LIBM],
+[AC_CHECK_LIB([m],[sin])])
+
+dnl GCC_CHECK_MATH_HEADERS
+dnl
+dnl Check for math.h and complex.h.  This is a pre-requisite for
+dnl GCC_CHECK_MATH_FUNC so that it includes the right headers.
+dnl (Some systems, such as AIX or OpenVMS may define macro for math
+dnl  functions).
+AC_DEFUN([GCC_CHECK_MATH_HEADERS],
+[AC_CHECK_HEADERS_ONCE(math.h complex.h)])
+
+dnl GCC_CHECK_MATH_FUNC([name],[if-present])
+dnl
+dnl Check wether math function NAME is available on the system (by compiling
+dnl and linking a C program) and run if-present on success.
+dnl
+dnl Note that OpenVMS system insists on including complex.h before math.h
+AC_DEFUN([GCC_CHECK_MATH_FUNC],
+[
+  AC_REQUIRE([GCC_CHECK_LIBM])
+  AC_REQUIRE([GCC_CHECK_MATH_HEADERS])
+  AC_CACHE_CHECK([for $1], [gcc_cv_math_func_$1],
+[AC_LINK_IFELSE([
+#ifdef HAVE_COMPLEX_H
+#include complex.h
+#endif
+#ifdef HAVE_MATH_H
+#include math.h
+#endif
+
+int (*ptr)() = (int (*)())$1;
+
+int
+main ()
+{
+  return 0;
+}
+],
+[gcc_cv_math_func_$1=yes],
+[gcc_cv_math_func_$1=no])])
+  if test $gcc_cv_math_func_$1 = yes; then
+$2
+  fi
+])
diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4
index d4acf76..1b11e6a 100644
--- a/libgfortran/acinclude.m4
+++ b/libgfortran/acinclude.m4
@@ -1,5 +1,6 @@
 m4_include(../config/acx.m4)
 m4_include(../config/no-executables.m4)
+m4_include(../config/math.m4)
 
 dnl Check that we have a working GNU Fortran compiler
 AC_DEFUN([LIBGFOR_WORKING_GFORTRAN], [
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 7011a93..0f29804 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -269,191 +269,191 @@ getcwd localtime_r gmtime_r strerror_r getpwuid_r 
ttyname_r clock_gettime \
 readlink getgid getpid getppid getuid geteuid umask)
 
 # Check for C99 (and other IEEE) math functions
-AC_CHECK_LIB([m],[acosf],[AC_DEFINE([HAVE_ACOSF],[1],[libm includes acosf])])
-AC_CHECK_LIB([m],[acos],[AC_DEFINE([HAVE_ACOS],[1],[libm includes acos])])
-AC_CHECK_LIB([m],[acosl],[AC_DEFINE([HAVE_ACOSL],[1],[libm includes acosl])])
-AC_CHECK_LIB([m],[acoshf],[AC_DEFINE([HAVE_ACOSHF],[1],[libm includes 
acoshf])])
-AC_CHECK_LIB([m],[acosh],[AC_DEFINE([HAVE_ACOSH],[1],[libm includes acosh])])
-AC_CHECK_LIB([m],[acoshl],[AC_DEFINE([HAVE_ACOSHL],[1],[libm includes 
acoshl])])
-AC_CHECK_LIB([m],[asinf],[AC_DEFINE([HAVE_ASINF],[1],[libm includes asinf])])
-AC_CHECK_LIB([m],[asin],[AC_DEFINE([HAVE_ASIN],[1],[libm includes asin])])
-AC_CHECK_LIB([m],[asinl],[AC_DEFINE([HAVE_ASINL],[1],[libm includes asinl])])
-AC_CHECK_LIB([m],[asinhf],[AC_DEFINE([HAVE_ASINHF],[1],[libm includes 
asinhf])])
-AC_CHECK_LIB([m],[asinh],[AC_DEFINE([HAVE_ASINH],[1],[libm includes asinh])])
-AC_CHECK_LIB([m],[asinhl],[AC_DEFINE([HAVE_ASINHL],[1],[libm includes 
asinhl])])
-AC_CHECK_LIB([m],[atan2f],[AC_DEFINE([HAVE_ATAN2F],[1],[libm includes 
atan2f])])
-AC_CHECK_LIB([m],[atan2],[AC_DEFINE([HAVE_ATAN2],[1],[libm includes atan2])])
-AC_CHECK_LIB([m],[atan2l],[AC_DEFINE([HAVE_ATAN2L],[1],[libm includes 
atan2l])])
-AC_CHECK_LIB([m],[atanf],[AC_DEFINE([HAVE_ATANF],[1],[libm includes atanf])])
-AC_CHECK_LIB([m],[atan],[AC_DEFINE([HAVE_ATAN],[1],[libm includes atan])])
-AC_CHECK_LIB([m],[atanl],[AC_DEFINE([HAVE_ATANL],[1],[libm includes atanl])])
-AC_CHECK_LIB([m],[atanhf],[AC_DEFINE([HAVE_ATANHF],[1],[libm includes 
atanhf])])

Re: [Patch V2] libgfortran: do not assume libm

2012-03-22 Thread Paolo Bonzini
Il 22/03/2012 09:30, Tristan Gingold ha scritto:
 Hi,
 
 this is version 2 of the patch.
 
 The initial problem is that libgfortran configure.ac used AC_CHECK_LIB([m]…) 
 to check wether several math functions are available.  That doesn't work on 
 VMS, because there is no such things as a libm.
 
 It seems to me that there are no autoconf macro to check wether a function is 
 available: AC_CHECK_FUNC[S] don't allow to specify additional include files 
 (necessary on VMS as some math functions are renamed through macros), and 
 AC_CHECK_DECL only checks the presence of the declaration (as pointed out by 
 Ralf).
 
 So I have finally learnt a little bit more about autoconf and added a new 
 file: config/math.m4 (build machinery maintainer cc:)
 libgfortran/configure.ac now uses the new GCC_CHECK_MATH_FUNC macro.
 
 Bootstrapped without gfortran regressions on x86_64-darwin.
 
 Ok for trunk ?
 
 (I will submit a follow-up change in libquadmath once this change is 
 approved).
 
 Tristan.
 
 config/
 2012-03-22  Tristan Gingold  ging...@adacore.com
 
   * math.m4: New file.
 
 libgfortran/
 2012-03-22  Tristan Gingold  ging...@adacore.com
 
   * configure.ac: Use GCC_CHECK_MATH_FUNC for math functions.
   * acinclude.m4: Include ../config/math.m4
   * configure: Regenerate.
   * Makefile.in: Regenerate.

Ok.


Re: remove wrong code in immed_double_const

2012-03-22 Thread Richard Sandiford
Mike Stump mikest...@comcast.net writes:
 This is changing the real case, where sign extension doesn't make
 much sense.

 I'm not sure I followed.  Do you want me to remove the change for the
 second case, leave it as it, or something else?  I've left it as I had
 modified it.

Sorry, meant we should leave the svn version as it is.  The new docs
(rightly) only mention sign-extension for integer modes, so the comment
about it not mattering for FP modes is still correct.  (In principle
I'd prefer to replace it with an assert, but that's a separate change.
Nothing we're doing here should change whether the FP path gets executed.)

 simplify_const_unary_operation needs to check for overflow
 when handling 2-HWI arithmetic, since we can no longer assume
 that the result is = 2 HWIs in size.  E.g.:
 
  case NEG:
neg_double (l1, h1, lv, hv);
break;
 
 should probably be:
 
  case NEG:
if (neg_double (l1, h1, lv, hv))
gcc_assert (GET_MODE_BITSIZE (mode) = 2 * HOST_WIDE_INT);
break;

 Are you talking about the block of code inside:

   /* We can do some operations on integer CONST_DOUBLEs.  Also allow  
 
  for a DImode operation on a CONST_INT.  */
   else if (GET_MODE (op) == VOIDmode
 width = HOST_BITS_PER_WIDE_INT * 2

 ?

Heh. it seems so :-)  Never mind that bit then.

 diff --git a/gcc/explow.c b/gcc/explow.c
 index 2fae1a1..c94ad25 100644
 --- a/gcc/explow.c
 +++ b/gcc/explow.c
 @@ -73,14 +73,20 @@ trunc_int_for_mode (HOST_WIDE_INT c, enum machine_mode 
 mode)
return c;
  }
  
 -/* Return an rtx for the sum of X and the integer C.  */
 +/* Return an rtx for the sum of X and the integer C, given that X has
 +   mode MODE.  This routine should be used instead of plus_constant
 +   when they want to ensure that addition happens in a particular
 +   mode, which is necessary when x can be a VOIDmode CONST_INT or
 +   CONST_DOUBLE and the width of the constant is smaller than the
 +   width of the expression.  */

I think this should be s/is smaller than/is different from/.
We're in trouble whenever the width of the HWIs is different
from the width of the constant they represent.

 @@ -103,11 +123,16 @@ plus_constant (rtx x, HOST_WIDE_INT c)
   unsigned HOST_WIDE_INT l1 = CONST_DOUBLE_LOW (x);
   HOST_WIDE_INT h1 = CONST_DOUBLE_HIGH (x);
   unsigned HOST_WIDE_INT l2 = c;
 - HOST_WIDE_INT h2 = c  0 ? ~0 : 0;
 + HOST_WIDE_INT h2 = c  0 ? -1 : 0;
   unsigned HOST_WIDE_INT lv;
   HOST_WIDE_INT hv;
  
 - add_double (l1, h1, l2, h2, lv, hv);
 + if (add_double_with_sign (l1, h1, l2, h2, lv, hv, false))
 +   if (GET_MODE_BITSIZE (mode)  2*HOST_BITS_PER_WIDE_INT)
 + /* Sorry, we have no way to represent overflows this
 +wide.  To fix, add constant support wider than
 +CONST_DOUBLE.  */
 + gcc_assert (0);

Should be:

if (add_double_with_sign (l1, h1, l2, h2, lv, hv, false))
  /* Sorry, we have no way to represent overflows this
 wide.  To fix, add constant support wider than
 CONST_DOUBLE.  */
  gcc_assert (GET_MODE_BITSIZE (mode)  2 * HOST_BITS_PER_WIDE_INT)

(note spacing).

 @@ -121,8 +146,8 @@ plus_constant (rtx x, HOST_WIDE_INT c)
   {
 tem
   = force_const_mem (GET_MODE (x),
 -plus_constant (get_pool_constant (XEXP (x, 0)),
 -   c));
 +plus_constant_mode (mode, get_pool_constant 
 (XEXP (x, 0)),
 +c));
 if (memory_address_p (GET_MODE (tem), XEXP (tem, 0)))
   return tem;
   }

Nitlet, but line is wider than 80 chars.  Probably easiest fix is:

  tem = plus_constant_mode (mode, get_pool_constant (XEXP (x, 0)), c);
  tem = force_const_mem (GET_MODE (x), tem);

 diff --git a/gcc/expmed.c b/gcc/expmed.c
 index 3507dad..2361b7e 100644
 --- a/gcc/expmed.c
 +++ b/gcc/expmed.c
 @@ -3122,9 +3122,11 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, 
 rtx target,
   {
 int shift = floor_log2 (CONST_DOUBLE_HIGH (op1))
 + HOST_BITS_PER_WIDE_INT;
 -   return expand_shift (LSHIFT_EXPR, mode, op0,
 -build_int_cst (NULL_TREE, shift),
 -target, unsignedp);
 +   if (shift  2*HOST_BITS_PER_WIDE_INT-1
 +   || GET_MODE_BITSIZE (mode) = 2*HOST_BITS_PER_WIDE_INT)

Missing spaces around binary operators.

 @@ -1219,15 +1220,10 @@ simplify_const_unary_operation (enum rtx_code code, 
 enum machine_mode mode,
else
   lv = CONST_DOUBLE_LOW (op),  hv = CONST_DOUBLE_HIGH (op);
  
 -  if (op_mode == VOIDmode)
 - {
 -   /* We don't know how to interpret negative-looking numbers in
 -  this case, so don't 

Re: [PATCH, MIPS] Add -march=xlp

2012-03-22 Thread Richard Sandiford
Maxim Kuvyrkov ma...@codesourcery.com writes:
 This patch adds basic support for Broadcom XLP (formerly NetLogic XLP) to GCC.

 Tested by building a mips64-linux-gnu toolchain with -march=xlp.

 OK to check in?

The new option needs to be documented in invoke.texi, so:

@samp{vr5000}, @samp{vr5400}, @samp{vr5500}
and @samp{xlr}.

becomes:

@samp{vr5000}, @samp{vr5400}, @samp{vr5500}, @samp{xlr}
and @samp{xlp}.

OK with that change.

Richard


Re: [C++ Patch] PR 49152

2012-03-22 Thread Paolo Carlini

Hi,

On 03/22/2012 05:25 AM, Gabriel Dos Reis wrote:

On Wed, Mar 21, 2012 at 7:22 PM, Paolo Carlinipaolo.carl...@oracle.com  wrote:

Hi,

this diagnostic issue is about not even trying to print expressions in error
messages involving operators, and print operand types instead. Just as an
example, for:

struct X { int x; };
void trigger (X x []) { x [01] = 0; }

we currently print:

error: no match for ‘operator=’ in ‘*(x + 4u) = 0’

which the patch changes to:

error: no match for ‘operator=’ (operand types are ‘X’ and ‘int’)

Or, for the existing other/error10.C, from:

error: no match for ‘operator-’ in ‘-(*  a)’

to

error: no match for ‘operator-’ (operand type is ‘A0’)


Usually these things appear in much less simpler expressions, possibly involving
the same symbol but withe different meanings.  There out be the a
way to give an indication of which symbol the diagnostic is about.
Withe the (imperfect) approach of printing expressions, at least some indication
is given on the expression involved.  Just printing the types with no indication
of what expression is causing trouble is more head-scratching.
Yes, you are right. Yesterday I had another look to the audit trail and 
thought, mistakenly, that people had a consensus about printing the 
types (by the way we are dealing also with much worse cases, like the 
one in Comment #0 there). Thus I don't think for the time being I can do 
much here, maybe the PR could be even closes as duplicate of the one 
about missing caret.


Thanks,
Paolo.


Re: remove wrong code in immed_double_const

2012-03-22 Thread Richard Sandiford
Richard Sandiford rdsandif...@googlemail.com writes:
 Should be:

   if (add_double_with_sign (l1, h1, l2, h2, lv, hv, false))
 /* Sorry, we have no way to represent overflows this
wide.  To fix, add constant support wider than
CONST_DOUBLE.  */
 gcc_assert (GET_MODE_BITSIZE (mode)  2 * HOST_BITS_PER_WIDE_INT)

Er, I did of course mean:

  gcc_assert (GET_MODE_BITSIZE (mode) = 2 * HOST_BITS_PER_WIDE_INT)

:-)

Richard


Re: [PATCH] Fix PRs 52080, 52097 and 48124, rewrite bitfield expansion, enable the C++ memory model wrt bitfields everywhere

2012-03-22 Thread Eric Botcazou
 This is what I have applied after bootstrapping and testing on
 x86_64-unknown-linux-gnu.

Thanks.  Last identified problem: the miscompilation with variant record.

  gnat.dg/pack17.adb

raised PROGRAM_ERROR : pack17.adb:36 explicit raise
FAIL: gnat.dg/pack17.adb execution test


Things start to go wrong at line 28:

24   procedure Fill (R : out Record_With_QImode_Variants) is
25   begin
26  R.C_Filler := (True, False, True, False, True, False, True);
27  R.C_Map := (True, False, True);
28  R.T_Int := 17;
29   end;

R is a packed record with variant part and -gnatR1 gives its layout:

for Record_With_Qimode_Variants'Object_Size use 24;
for Record_With_Qimode_Variants'Value_Size use 19;
for Record_With_Qimode_Variants'Alignment use 1;
for Record_With_Qimode_Variants use record
   Dat 0 range  0 ..  0;
   C_Filler at 0 range  1 ..  7;
   C_Mapat 1 range  0 ..  2;
   F_Bitat 1 range  3 ..  3;
   F_Filler at 1 range  4 .. 10;
   T_Intat 1 range  3 .. 10;

Now, since T_Int is within a variant, the assignment is translated into:

  r_1(D)-d___XVN.O.t_int = 17;

d___XVN is QUAL_UNION_TYPE and O a RECORD_TYPE (fields of QUAL_UNION_TYPE are 
always of RECORD_TYPE, that's why the overloading of qualifier is indeed OK).

The compiler now generates:

movl8(%ebp), %eax
movb$17, 1(%eax)

which is of course wrong given the layout above.

It seems to me that the new code implicitly assumes that the first field in a 
bitfield group starts on a byte boundary, which doesn't hold in Ada.

-- 
Eric Botcazou
-- { dg-do run }

procedure Pack17 is

   type Bitmap_T is array (Natural range ) of Boolean;
   pragma Pack (Bitmap_T);

   type Uint8 is range 0 .. 2 ** 8 - 1;
   for Uint8'Size use 8;

   type Record_With_QImode_Variants (D : Boolean) is record
  C_Filler : Bitmap_T (1..7);
  C_Map : Bitmap_T (1..3);
  case D is
 when False =
F_Bit : Boolean;
F_Filler : Bitmap_T (1..7);
 when True =
T_Int : Uint8;
  end case;
   end record;
   pragma Pack (Record_With_QImode_Variants);

   procedure Fill (R : out Record_With_QImode_Variants) is
   begin
  R.C_Filler := (True, False, True, False, True, False, True);
  R.C_Map := (True, False, True);
  R.T_Int := 17;
   end;

   RT : Record_With_QImode_Variants (D = True);

begin
   Fill (RT);
   if RT.T_Int /= 17 then
 raise Program_Error;
   end if;
end;


Re: [PATCH] Fix PRs 52080, 52097 and 48124, rewrite bitfield expansion, enable the C++ memory model wrt bitfields everywhere

2012-03-22 Thread Richard Guenther
On Thu, 22 Mar 2012, Eric Botcazou wrote:

  This is what I have applied after bootstrapping and testing on
  x86_64-unknown-linux-gnu.
 
 Thanks.  Last identified problem: the miscompilation with variant record.
 
   gnat.dg/pack17.adb
 
 raised PROGRAM_ERROR : pack17.adb:36 explicit raise
 FAIL: gnat.dg/pack17.adb execution test
 
 
 Things start to go wrong at line 28:
 
 24   procedure Fill (R : out Record_With_QImode_Variants) is
 25   begin
 26  R.C_Filler := (True, False, True, False, True, False, True);
 27  R.C_Map := (True, False, True);
 28  R.T_Int := 17;
 29   end;
 
 R is a packed record with variant part and -gnatR1 gives its layout:
 
 for Record_With_Qimode_Variants'Object_Size use 24;
 for Record_With_Qimode_Variants'Value_Size use 19;
 for Record_With_Qimode_Variants'Alignment use 1;
 for Record_With_Qimode_Variants use record
Dat 0 range  0 ..  0;
C_Filler at 0 range  1 ..  7;
C_Mapat 1 range  0 ..  2;
F_Bitat 1 range  3 ..  3;
F_Filler at 1 range  4 .. 10;
T_Intat 1 range  3 .. 10;
 
 Now, since T_Int is within a variant, the assignment is translated into:
 
   r_1(D)-d___XVN.O.t_int = 17;
 
 d___XVN is QUAL_UNION_TYPE and O a RECORD_TYPE (fields of QUAL_UNION_TYPE are 
 always of RECORD_TYPE, that's why the overloading of qualifier is indeed OK).
 
 The compiler now generates:
 
   movl8(%ebp), %eax
   movb$17, 1(%eax)
 
 which is of course wrong given the layout above.
 
 It seems to me that the new code implicitly assumes that the first field in a 
 bitfield group starts on a byte boundary, which doesn't hold in Ada.

Yes, I have noticed that from what you can see in the code.  So the
issue is that get_bit_range tells us that it's ok to touch bits
outside of the field - but that's obviously required.  We may not
change bits that are not covered by the FIELD_DECL which now
somehow happens?  That sounds like a latent bug in the bitfield
expander to me - it should never _change_ bits outside of bitpos/bitsize
as returned by get_inner_reference.

I guess I'll have to debug this if you don't beat me on it.

Richard.


[Backport,4.7,committed]: Fix PR other/52545: SECTION_EXCLUE clobbers SECTION_MACH_DEP

2012-03-22 Thread Georg-Johann Lay
http://gcc.gnu.org/viewcvs?view=revisionrevision=185685

Applied as obvious.

Johann

Backport from mainline r185259.

PR other/52545
* output.h (SECTION_EXCLUDE, SECTION_MACH_DEP): Don't use
SECTION_MACH_DEP reserved bits for SECTION_EXCLUDE.



Re: [PATCH] Fix PRs 52080, 52097 and 48124, rewrite bitfield expansion, enable the C++ memory model wrt bitfields everywhere

2012-03-22 Thread Eric Botcazou
 Yes, I have noticed that from what you can see in the code.  So the
 issue is that get_bit_range tells us that it's ok to touch bits
 outside of the field - but that's obviously required.  We may not
 change bits that are not covered by the FIELD_DECL which now
 somehow happens?  That sounds like a latent bug in the bitfield
 expander to me - it should never _change_ bits outside of bitpos/bitsize
 as returned by get_inner_reference.

It's the new C++0x memory model stuff:

void
store_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
 unsigned HOST_WIDE_INT bitnum,
 unsigned HOST_WIDE_INT bitregion_start,
 unsigned HOST_WIDE_INT bitregion_end,
 enum machine_mode fieldmode,
 rtx value)
{
  /* Under the C++0x memory model, we must not touch bits outside the
 bit region.  Adjust the address to start at the beginning of the
 bit region.  */
  if (MEM_P (str_rtx)
   bitregion_start  0)
{
  enum machine_mode bestmode;
  enum machine_mode op_mode;
  unsigned HOST_WIDE_INT offset;

  op_mode = mode_for_extraction (EP_insv, 3);
  if (op_mode == MAX_MACHINE_MODE)
op_mode = VOIDmode;

  offset = bitregion_start / BITS_PER_UNIT;
  bitnum -= bitregion_start;
  bitregion_end -= bitregion_start;
  bitregion_start = 0;

which assumes that a bitfield group starts on a byte boundary.  So this is 
probably indeed latent in GCC 4.7 as well.

-- 
Eric Botcazou


Re: [PATCH] Fix PRs 52080, 52097 and 48124, rewrite bitfield expansion, enable the C++ memory model wrt bitfields everywhere

2012-03-22 Thread Richard Guenther
On Thu, 22 Mar 2012, Eric Botcazou wrote:

  Yes, I have noticed that from what you can see in the code.  So the
  issue is that get_bit_range tells us that it's ok to touch bits
  outside of the field - but that's obviously required.  We may not
  change bits that are not covered by the FIELD_DECL which now
  somehow happens?  That sounds like a latent bug in the bitfield
  expander to me - it should never _change_ bits outside of bitpos/bitsize
  as returned by get_inner_reference.
 
 It's the new C++0x memory model stuff:
 
 void
 store_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
unsigned HOST_WIDE_INT bitnum,
unsigned HOST_WIDE_INT bitregion_start,
unsigned HOST_WIDE_INT bitregion_end,
enum machine_mode fieldmode,
rtx value)
 {
   /* Under the C++0x memory model, we must not touch bits outside the
  bit region.  Adjust the address to start at the beginning of the
  bit region.  */
   if (MEM_P (str_rtx)
bitregion_start  0)
 {
   enum machine_mode bestmode;
   enum machine_mode op_mode;
   unsigned HOST_WIDE_INT offset;
 
   op_mode = mode_for_extraction (EP_insv, 3);
   if (op_mode == MAX_MACHINE_MODE)
   op_mode = VOIDmode;
 
   offset = bitregion_start / BITS_PER_UNIT;
   bitnum -= bitregion_start;
   bitregion_end -= bitregion_start;
   bitregion_start = 0;
 
 which assumes that a bitfield group starts on a byte boundary.  So this is 
 probably indeed latent in GCC 4.7 as well.

But the bitfield group _does_ start on a byte boundary.  At least
that's what the new code in stor-layout ensures.

It's ok to assume the group starts on a byte boundary.  But it's not
ok to modify bits outside of the access, so the RMW cycle has to mask
them properly.

Richard.


[PATCH] Fix PR52638

2012-03-22 Thread Richard Guenther

This fixes PR52638, I made vect_init_vector handle scalar inits
to not duplicate this code all over the place.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2012-03-22  Richard Guenther  rguent...@suse.de

PR tree-optimization/52638
* tree-vect-stmts.c (vect_init_vector_1): New function, split
out from ...
(vect_init_vector): ... here.  Handle scalar vector inits.
(vect_get_vec_def_for_operand): Adjust.
(vectorizable_load): Likewise.

Index: gcc/tree-vect-stmts.c
===
*** gcc/tree-vect-stmts.c   (revision 185675)
--- gcc/tree-vect-stmts.c   (working copy)
*** vect_get_load_cost (struct data_referenc
*** 1136,1183 
  }
  }
  
  
! /* Function vect_init_vector.
! 
!Insert a new stmt (INIT_STMT) that initializes a new vector variable with
!the vector elements of VECTOR_VAR.  Place the initialization at BSI if it
!is not NULL.  Otherwise, place the initialization at the loop preheader.
!Return the DEF of INIT_STMT.
!It will be used in the vectorization of STMT.  */
! 
! tree
! vect_init_vector (gimple stmt, tree vector_var, tree vector_type,
! gimple_stmt_iterator *gsi)
  {
-   stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
-   tree new_var;
-   gimple init_stmt;
-   tree vec_oprnd;
-   edge pe;
-   tree new_temp;
-   basic_block new_bb;
- 
-   new_var = vect_get_new_vect_var (vector_type, vect_simple_var, cst_);
-   add_referenced_var (new_var);
-   init_stmt = gimple_build_assign  (new_var, vector_var);
-   new_temp = make_ssa_name (new_var, init_stmt);
-   gimple_assign_set_lhs (init_stmt, new_temp);
  
if (gsi)
! vect_finish_stmt_generation (stmt, init_stmt, gsi);
else
  {
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
  
if (loop_vinfo)
  {
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
  
if (nested_in_vect_loop_p (loop, stmt))
  loop = loop-inner;
  
  pe = loop_preheader_edge (loop);
!   new_bb = gsi_insert_on_edge_immediate (pe, init_stmt);
gcc_assert (!new_bb);
}
else
--- 1136,1166 
  }
  }
  
+ /* Insert the new stmt NEW_STMT at *GSI or at the appropriate place in
+the loop preheader for the vectorized stmt STMT.  */
  
! static void
! vect_init_vector_1 (gimple stmt, gimple new_stmt, gimple_stmt_iterator *gsi)
  {
  
if (gsi)
! vect_finish_stmt_generation (stmt, new_stmt, gsi);
else
  {
+   stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
  
if (loop_vinfo)
  {
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ basic_block new_bb;
+ edge pe;
  
if (nested_in_vect_loop_p (loop, stmt))
  loop = loop-inner;
  
  pe = loop_preheader_edge (loop);
!   new_bb = gsi_insert_on_edge_immediate (pe, new_stmt);
gcc_assert (!new_bb);
}
else
*** vect_init_vector (gimple stmt, tree vect
*** 1189,1204 
gcc_assert (bb_vinfo);
bb = BB_VINFO_BB (bb_vinfo);
gsi_bb_start = gsi_after_labels (bb);
!   gsi_insert_before (gsi_bb_start, init_stmt, GSI_SAME_STMT);
 }
  }
  
if (vect_print_dump_info (REPORT_DETAILS))
  {
fprintf (vect_dump, created new init_stmt: );
!   print_gimple_stmt (vect_dump, init_stmt, 0, TDF_SLIM);
  }
  
vec_oprnd = gimple_assign_lhs (init_stmt);
return vec_oprnd;
  }
--- 1172,1235 
gcc_assert (bb_vinfo);
bb = BB_VINFO_BB (bb_vinfo);
gsi_bb_start = gsi_after_labels (bb);
!   gsi_insert_before (gsi_bb_start, new_stmt, GSI_SAME_STMT);
 }
  }
  
if (vect_print_dump_info (REPORT_DETAILS))
  {
fprintf (vect_dump, created new init_stmt: );
!   print_gimple_stmt (vect_dump, new_stmt, 0, TDF_SLIM);
  }
+ }
+ 
+ /* Function vect_init_vector.
  
+Insert a new stmt (INIT_STMT) that initializes a new vector variable with
+the vector elements of VECTOR_VAR.  Place the initialization at BSI if it
+is not NULL.  Otherwise, place the initialization at the loop preheader.
+Return the DEF of INIT_STMT.
+It will be used in the vectorization of STMT.  */
+ 
+ tree
+ vect_init_vector (gimple stmt, tree vector_var, tree vector_type,
+ gimple_stmt_iterator *gsi)
+ {
+   tree new_var;
+   gimple init_stmt;
+   tree vec_oprnd;
+   tree new_temp;
+ 
+   if (TREE_CODE (TREE_TYPE (vector_var)) != VECTOR_TYPE)
+ {
+   if (!types_compatible_p (TREE_TYPE (vector_type),
+  TREE_TYPE (vector_var)))
+   {
+ if (CONSTANT_CLASS_P (vector_var))
+   vector_var = fold_unary (VIEW_CONVERT_EXPR, 

Re: [PATCH] Fix PRs 52080, 52097 and 48124, rewrite bitfield expansion, enable the C++ memory model wrt bitfields everywhere

2012-03-22 Thread Eric Botcazou
 But the bitfield group _does_ start on a byte boundary.  At least
 that's what the new code in stor-layout ensures.

No, it doesn't, since it does the computation on a record by record basis.
Here we have a bitfield group that starts in a record and ends up in a nested 
record.

 It's ok to assume the group starts on a byte boundary.  But it's not
 ok to modify bits outside of the access, so the RMW cycle has to mask
 them properly.

We have 2 options:
  1. the GCC 4.7 approach where get_bit_range returns 0 for bitstart, which 
doesn't make much sense but is in keeping with store_bit_field.
  2. the GCC 4.8 approach where get_bit_range attempts to return a more correct 
value, but is currently wrong (bitregion_start=11, bitregion_end=18) because 
the representative of the bitfield is wrong.  The real representative of the 
bitfield is outside the record type.

-- 
Eric Botcazou


Re: [PATCH] Fix PRs 52080, 52097 and 48124, rewrite bitfield expansion, enable the C++ memory model wrt bitfields everywhere

2012-03-22 Thread Richard Guenther
On Thu, Mar 22, 2012 at 12:47 PM, Eric Botcazou ebotca...@adacore.com wrote:
 But the bitfield group _does_ start on a byte boundary.  At least
 that's what the new code in stor-layout ensures.

 No, it doesn't, since it does the computation on a record by record basis.
 Here we have a bitfield group that starts in a record and ends up in a nested
 record.

 It's ok to assume the group starts on a byte boundary.  But it's not
 ok to modify bits outside of the access, so the RMW cycle has to mask
 them properly.

 We have 2 options:
  1. the GCC 4.7 approach where get_bit_range returns 0 for bitstart, which
 doesn't make much sense but is in keeping with store_bit_field.
  2. the GCC 4.8 approach where get_bit_range attempts to return a more correct
 value, but is currently wrong (bitregion_start=11, bitregion_end=18) because
 the representative of the bitfield is wrong.  The real representative of the
 bitfield is outside the record type.

bitregion_start == 11 looks bogus.  The representative is starting at

  DECL_FIELD_BIT_OFFSET (repr)
= size_binop (BIT_AND_EXPR,
  DECL_FIELD_BIT_OFFSET (field),
  bitsize_int (~(BITS_PER_UNIT - 1)));

which looks ok, the size of the representative is (at minimum)

  size = size_diffop (DECL_FIELD_OFFSET (field),
  DECL_FIELD_OFFSET (repr));
  gcc_assert (host_integerp (size, 1));
  bitsize = (tree_low_cst (size, 1) * BITS_PER_UNIT
 + tree_low_cst (DECL_FIELD_BIT_OFFSET (field), 1)
 - tree_low_cst (DECL_FIELD_BIT_OFFSET (repr), 1)
 + tree_low_cst (DECL_SIZE (field), 1));

  /* Round up bitsize to multiples of BITS_PER_UNIT.  */
  bitsize = (bitsize + BITS_PER_UNIT - 1)  ~(BITS_PER_UNIT - 1);

that looks ok to me as well.  Is the issue that we, in get_bit_range,
compute bitregion_start relative to the byte-aligned offset of the
representative?

At least I still can't see where things go wrong from inspecting the
code ...

Richard.


 --
 Eric Botcazou


Re: [PATCH] Fix PRs 52080, 52097 and 48124, rewrite bitfield expansion, enable the C++ memory model wrt bitfields everywhere

2012-03-22 Thread Eric Botcazou
 bitregion_start == 11 looks bogus.  The representative is starting at

   DECL_FIELD_BIT_OFFSET (repr)
 = size_binop (BIT_AND_EXPR,
   DECL_FIELD_BIT_OFFSET (field),
   bitsize_int (~(BITS_PER_UNIT - 1)));

 which looks ok

It cannot be OK if you want it to be on a byte boundary, since the field isn't 
on a byte boundary itself and they have the same DECL_FIELD_BIT_OFFSET (0).

 the size of the representative is (at minimum) 

   size = size_diffop (DECL_FIELD_OFFSET (field),
   DECL_FIELD_OFFSET (repr));
   gcc_assert (host_integerp (size, 1));
   bitsize = (tree_low_cst (size, 1) * BITS_PER_UNIT
  + tree_low_cst (DECL_FIELD_BIT_OFFSET (field), 1)
  - tree_low_cst (DECL_FIELD_BIT_OFFSET (repr), 1)
  + tree_low_cst (DECL_SIZE (field), 1));

   /* Round up bitsize to multiples of BITS_PER_UNIT.  */
   bitsize = (bitsize + BITS_PER_UNIT - 1)  ~(BITS_PER_UNIT - 1);

 that looks ok to me as well.  Is the issue that we, in get_bit_range,
 compute bitregion_start relative to the byte-aligned offset of the
 representative?

The issue is that the representative is assumed to be on a byte boundary in 
get_bit_range, but it isn't in the case at hand.  So either we cope with that 
(this is the GCC 4.7 approach) or we change the representative somehow.

IOW, either we pretend that a bitfield group is entirely contained within a 
single record type or we acknowledge that a bitfield group can cross a record 
boundary.

-- 
Eric Botcazou


Re: [PATCH] gfortran testsuite: implicitly cleanup-modules

2012-03-22 Thread Bernhard Reutner-Fischer
On Mon, Mar 19, 2012 at 06:36:12PM +0100, Rainer Orth wrote:

Unfortunately, this patch creates a bogus warning in the libgomp
testsuite, which also shows up in mail-report.log:

WARNING: Line 30 includes unreadable file 
\`/vol/gcc/src/hg/trunk/local/libgomp/testsuite/libgomp.fortran/omp_lib.h'

fortran-modules.exp (list-module-names-1) assumes that included files
are relative to the source, but omp_lib.h is a generated file and lives
in $objdir, and is found at compile time via -I switches.

fortran-modules does not (currently) use include-dir search path logic
to find include files.

Besides, the message is less than helpful since it gives no indication
as to which files includes the missing one.

RUNTESTFLAGS='-v -v' (for example) shows the testcase that it currently
works on, as you know.

Please fix.

I have removed the unwarranted warning after successful (1) toplevel
regtesting and committed it as r185688.

The second part of the implicit cleanup-modules would be to remove
the now superfluous manual cleanup-modules calls.

Something like this, ran in the sourcedir removes those:
(cd gcc/testsuite  grep -rl cleanup-modules * | \
 egrep -v 
(\.exp|ChangeLog|\.svn|gfortran.dg/(class_4(a|b|c|5a).f03|binding_label_tests_1(0|1|1_main|3|3_main).f03|test_common_binding_labels_(2|2_main|3|3_main).f03|whole_file_(28|29|30|31).f90))
 | \
 while read f;do \
   sed -i -e ':crap' -e '/cleanup-modules/d' -e '/^\n*$/{$d;N;bcrap' -e '}' $f; 
\
 done)

1) Completely unrelated bug in the testsuite showed up as 2 regressions
in the above testing. I have filed that as gcc.gnu.org/PR52665


Re: [PATCH] Fix PRs 52080, 52097 and 48124, rewrite bitfield expansion, enable the C++ memory model wrt bitfields everywhere

2012-03-22 Thread Richard Guenther
On Thu, 22 Mar 2012, Eric Botcazou wrote:

  bitregion_start == 11 looks bogus.  The representative is starting at
 
DECL_FIELD_BIT_OFFSET (repr)
  = size_binop (BIT_AND_EXPR,
DECL_FIELD_BIT_OFFSET (field),
bitsize_int (~(BITS_PER_UNIT - 1)));
 
  which looks ok
 
 It cannot be OK if you want it to be on a byte boundary, since the field 
 isn't 
 on a byte boundary itself and they have the same DECL_FIELD_BIT_OFFSET (0).

Huh?  If they have DECL_FIELD_BIT_OFFSET of zero they are at a byte
boundary, no?  Wait - the RECORD_TYPE itself is at non-zero
DECL_FIELD_BIT_OFFSET and thus a zero DECL_FIELD_BIT_OFFSET for its
fields does not mean anything?!  But how can DECL_OFFSET_ALIGN
be still valid for such field?  Obviously if DECL_FIELD_OFFSET == 0,
DECL_FIELD_BIT_OFFSET == 0 then the offset needs to be aligned
to DECL_OFFSET_ALIGN.  Which then means DECL_OFFSET_ALIGN is a
bit-alignment?

Anyway, since we are trying to compute a nice mode to use for
the bitfield representative we can give up in the second that
we do not know how to reach BITS_PER_UNIT alignment.  Or we can
simply only try to ensure MIN (BITS_PER_UNIT, DECL_OFFSET_ALIGN)
alignment/size of the representative.  Of course the bitfield
expansion code has to deal with non-byte-aligned representatives
then, and we'd always have to use BLKmode for them.

  the size of the representative is (at minimum) 
 
size = size_diffop (DECL_FIELD_OFFSET (field),
DECL_FIELD_OFFSET (repr));
gcc_assert (host_integerp (size, 1));
bitsize = (tree_low_cst (size, 1) * BITS_PER_UNIT
   + tree_low_cst (DECL_FIELD_BIT_OFFSET (field), 1)
   - tree_low_cst (DECL_FIELD_BIT_OFFSET (repr), 1)
   + tree_low_cst (DECL_SIZE (field), 1));
 
/* Round up bitsize to multiples of BITS_PER_UNIT.  */
bitsize = (bitsize + BITS_PER_UNIT - 1)  ~(BITS_PER_UNIT - 1);
 
  that looks ok to me as well.  Is the issue that we, in get_bit_range,
  compute bitregion_start relative to the byte-aligned offset of the
  representative?
 
 The issue is that the representative is assumed to be on a byte boundary in 
 get_bit_range, but it isn't in the case at hand.  So either we cope with that 
 (this is the GCC 4.7 approach) or we change the representative somehow.

I think we can't change it to be on a byte-boundary, the same record
may be used at different bit-positions, no?

 IOW, either we pretend that a bitfield group is entirely contained within a 
 single record type or we acknowledge that a bitfield group can cross a record 
 boundary.

Sure, we acknowledge it can cross a record boundary.  I just was not
aware we cannot statically compute the bit-offset to the previous byte
for a record type.

Richard.


[PATCH, alpha]: Some further configure cleanups

2012-03-22 Thread Uros Bizjak
Hello!

This patch moves a couple of #defines from alpha/alpha.h to
alpha/vms.h to use generic defines from elfos.h.

2012-03-22  Uros Bizjak  ubiz...@gmail.com

* config/alpha/alpha.h (ASM_OUTPUT_ALIGN): Move to elf.h
(ASM_OUTPUT_SKIP): Move to vms.h
(ASM_OUTPUT_LOCAL): Ditto.
(ASM_OUTPUT_COMMON): Remove.
* config/alpha/elf.h (ASM_OUTPUT_DEF_FROM_DECLS): Use ASM_OUTPUT_DEF.
* config/alpha/vms.h (ASM_OUTPUT_ALIGN): Do not undefine before define.

Tested on alphaev68-pc-linux-gnu.

Tristan, since the patch touches alpha/vms.h, is this OK from VMS POV?

Uros.
Index: config/alpha/vms.h
===
--- config/alpha/vms.h  (revision 185677)
+++ config/alpha/vms.h  (working copy)
@@ -217,10 +217,22 @@
that says to advance the location counter
to a multiple of 2**LOG bytes.  */
 
-#undef ASM_OUTPUT_ALIGN
 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
 fprintf (FILE, \t.align %d\n, LOG);
 
+/* This is how to advance the location counter by SIZE bytes.  */
+
+#define ASM_OUTPUT_SKIP(FILE,SIZE)  \
+  fprintf (FILE, \t.space HOST_WIDE_INT_PRINT_UNSIGNED\n, (SIZE))
+
+/* This says how to output an assembler line
+   to define a global common symbol.  */
+
+#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
+( fputs (\t.lcomm , (FILE)), \
+  assemble_name ((FILE), (NAME)),  \
+  fprintf ((FILE), ,HOST_WIDE_INT_PRINT_UNSIGNED\n, (SIZE)))
+
 /* Switch into a generic section.  */
 #define TARGET_ASM_NAMED_SECTION vms_asm_named_section
 
Index: config/alpha/elf.h
===
--- config/alpha/elf.h  (revision 185677)
+++ config/alpha/elf.h  (working copy)
@@ -27,9 +27,17 @@
 
 /* Do not output a .file directive at the beginning of the input file.  */
  
-#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
+#undef  TARGET_ASM_FILE_START_FILE_DIRECTIVE
 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE false
 
+/* This is how to output an assembler line
+   that says to advance the location counter
+   to a multiple of 2**LOG bytes.  */
+
+#define ASM_OUTPUT_ALIGN(FILE,LOG) \
+  if ((LOG) != 0)  \
+fprintf (FILE, \t.align %d\n, LOG);
+
 /* This says how to output assembler code to declare an
uninitialized internal linkage data object.  Under SVR4,
the linker seems to want the alignment of data objects
@@ -105,10 +113,7 @@
assemble_name (FILE, name); \
fputs (..ng\n, FILE); \
   }\
-assemble_name(FILE, alias);\
-fputs( = , FILE);\
-assemble_name(FILE, name); \
-fputc('\n', FILE); \
+ASM_OUTPUT_DEF (FILE, alias, name);\
   } while (0)
 
 /* Provide a STARTFILE_SPEC appropriate for ELF.  Here we add the
Index: config/alpha/alpha.h
===
--- config/alpha/alpha.h(revision 185677)
+++ config/alpha/alpha.h(working copy)
@@ -1036,36 +1036,6 @@
 
 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
   fprintf (FILE, \t.gprel32 $L%d\n, (VALUE))
-
-/* This is how to output an assembler line
-   that says to advance the location counter
-   to a multiple of 2**LOG bytes.  */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
-  if ((LOG) != 0)  \
-fprintf (FILE, \t.align %d\n, LOG);
-
-/* This is how to advance the location counter by SIZE bytes.  */
-
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE)  \
-  fprintf (FILE, \t.space HOST_WIDE_INT_PRINT_UNSIGNED\n, (SIZE))
-
-/* This says how to output an assembler line
-   to define a global common symbol.  */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
-( fputs (\t.comm , (FILE)),  \
-  assemble_name ((FILE), (NAME)),  \
-  fprintf ((FILE), ,HOST_WIDE_INT_PRINT_UNSIGNED\n, (SIZE)))
-
-/* This says how to output an assembler line
-   to define a local common symbol.  */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
-( fputs (\t.lcomm , (FILE)), \
-  assemble_name ((FILE), (NAME)),  \
-  fprintf ((FILE), ,HOST_WIDE_INT_PRINT_UNSIGNED\n, (SIZE)))
 
 
 /* Print operand X (an rtx) in assembler syntax to file FILE.


Re: [PATCH, alpha]: Some further configure cleanups

2012-03-22 Thread Tristan Gingold

On Mar 22, 2012, at 1:49 PM, Uros Bizjak wrote:

 Hello!
 
 This patch moves a couple of #defines from alpha/alpha.h to
 alpha/vms.h to use generic defines from elfos.h.
 
 2012-03-22  Uros Bizjak  ubiz...@gmail.com
 
   * config/alpha/alpha.h (ASM_OUTPUT_ALIGN): Move to elf.h
   (ASM_OUTPUT_SKIP): Move to vms.h
   (ASM_OUTPUT_LOCAL): Ditto.
   (ASM_OUTPUT_COMMON): Remove.
   * config/alpha/elf.h (ASM_OUTPUT_DEF_FROM_DECLS): Use ASM_OUTPUT_DEF.
   * config/alpha/vms.h (ASM_OUTPUT_ALIGN): Do not undefine before define.
 
 Tested on alphaev68-pc-linux-gnu.
 
 Tristan, since the patch touches alpha/vms.h, is this OK from VMS POV?

Yes, it is.

Tristan.

 
 Uros.
 a.diff.txt



[PATCH] Fix PR52548

2012-03-22 Thread Richard Guenther

This fixes PR52548, we were not flow-sensitively pruning EXP_GEN
sets during antic-in computation.  Fixed by simply pruning EXP_GEN
at generation time.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2012-03-22  Richard Guenther  rguent...@suse.de

PR tree-optimization/52548
* tree-ssa-pre.c (valid_in_sets): Remove handling of invalidation
because of clobbers.
(prune_clobbered_mems): New function.
(compute_antic_aux): Use it to prune ANTIC_OUT.
(compute_partial_antic_aux): Use it to prune PA_IN.
(compute_avail): Only insert expressions into EXP_GEN that
are not invalidated when translated up to the beginning of
the block.

* gcc.dg/tree-ssa/ssa-pre-29.c: New testcase.

Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-29.c
===
*** gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-29.c  (revision 0)
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-29.c  (revision 0)
***
*** 0 
--- 1,21 
+ /* { dg-do compile } */
+ /* { dg-options -O2 -fdump-tree-pre-details } */
+ 
+ int flag, hoist, y, z;
+ 
+ void
+ foo (void)
+ {
+   if (flag)
+ y = hoist + 4;
+   else
+ flag = 888;
+   z = hoist + 4;
+   bark ();
+ }
+ 
+ /* We should see the partial redundancy of hoist + 4, not being confused
+about bark () possibly clobbering hoist.  */
+ 
+ /* { dg-final { scan-tree-dump Replaced hoist pre } } */
+ /* { dg-final { cleanup-tree-dump pre } } */
Index: gcc/tree-ssa-pre.c
===
*** gcc/tree-ssa-pre.c  (revision 185680)
--- gcc/tree-ssa-pre.c  (working copy)
*** valid_in_sets (bitmap_set_t set1, bitmap
*** 2123,2138 
if (!vro_valid_in_sets (set1, set2, vro))
  return false;
  }
!   if (ref-vuse)
! {
!   gimple def_stmt = SSA_NAME_DEF_STMT (ref-vuse);
!   if (!gimple_nop_p (def_stmt)
!gimple_bb (def_stmt) != block
!!dominated_by_p (CDI_DOMINATORS,
!   block, gimple_bb (def_stmt)))
! return false;
! }
!   return !value_dies_in_block_x (expr, block);
}
  default:
gcc_unreachable ();
--- 2123,2129 
if (!vro_valid_in_sets (set1, set2, vro))
  return false;
  }
!   return true;
}
  default:
gcc_unreachable ();
*** clean (bitmap_set_t set, basic_block blo
*** 2179,2184 
--- 2170,2207 
VEC_free (pre_expr, heap, exprs);
  }
  
+ /* Clean the set of expressions that are no longer valid in SET because
+they are clobbered in BLOCK.  */
+ 
+ static void
+ prune_clobbered_mems (bitmap_set_t set, basic_block block)
+ {
+   VEC (pre_expr, heap) *exprs = sorted_array_from_bitmap_set (set);
+   pre_expr expr;
+   int i;
+ 
+   FOR_EACH_VEC_ELT (pre_expr, exprs, i, expr)
+ {
+   vn_reference_t ref;
+   if (expr-kind != REFERENCE)
+   continue;
+ 
+   ref = PRE_EXPR_REFERENCE (expr);
+   if (ref-vuse)
+   {
+ gimple def_stmt = SSA_NAME_DEF_STMT (ref-vuse);
+ if (!gimple_nop_p (def_stmt)
+  ((gimple_bb (def_stmt) != block
+   !dominated_by_p (CDI_DOMINATORS,
+  block, gimple_bb (def_stmt)))
+ || (gimple_bb (def_stmt) == block
+  value_dies_in_block_x (expr, block
+   bitmap_remove_from_set (set, expr);
+   }
+ }
+   VEC_free (pre_expr, heap, exprs);
+ }
+ 
  static sbitmap has_abnormal_preds;
  
  /* List of blocks that may have changed during ANTIC computation and
*** compute_antic_aux (basic_block block, bo
*** 2320,2325 
--- 2343,2352 
VEC_free (basic_block, heap, worklist);
  }
  
+   /* Prune expressions that are clobbered in block and thus become
+  invalid if translated from ANTIC_OUT to ANTIC_IN.  */
+   prune_clobbered_mems (ANTIC_OUT, block);
+ 
/* Generate ANTIC_OUT - TMP_GEN.  */
S = bitmap_set_subtract (ANTIC_OUT, TMP_GEN (block));
  
*** compute_partial_antic_aux (basic_block b
*** 2474,2479 
--- 2501,2510 
VEC_free (basic_block, heap, worklist);
  }
  
+   /* Prune expressions that are clobbered in block and thus become
+  invalid if translated from PA_OUT to PA_IN.  */
+   prune_clobbered_mems (PA_OUT, block);
+ 
/* PA_IN starts with PA_OUT - TMP_GEN.
   Then we subtract things from ANTIC_IN.  */
PA_IN (block) = bitmap_set_subtract (PA_OUT, TMP_GEN (block));
*** compute_avail (void)
*** 4027,4041 
if (vro-op2  TREE_CODE (vro-op2) == SSA_NAME)
  add_to_exp_gen (block, vro-op2);
  }
!   result = (pre_expr) pool_alloc (pre_expr_pool);
!   result-kind = REFERENCE;
!

Re: remove wrong code in immed_double_const

2012-03-22 Thread Michael Matz
Hi,

On Wed, 21 Mar 2012, Mike Stump wrote:

  If the high bit of i1 is set then currently you will get a negative 
  number produced no matter the absolute value of it.
 
 Ok, in the new patch, I'm pushing to change the spec so that the value 
 is sign extended and fixing all the code that doesn't conform to that 
 spec.

That certainly is strictly better than any of the other possibilities, I 
just didn't get the impression from your second mail to this thread that 
you were even considering doing that.  Good I was wrong.  If I notice 
anything I'll answer directly to the patch.

  This positive/negative inconsistency doesn't make sense to allow, and 
  the assert ensures that it isn't allowed.
 
 Don't need the assert when there is no inconsistency, I believe that 
 resolving any inconsistencies should remove the need for the assert.

Correct.

 :-)  Only the point I wanted to make; that 0 is safe.  As such, it 
 proves that the spec, as you might call it, is wrong.

I would call it too strict, not wrong.  Because there are (or were after 
your fixes get it) values where there was a problem.  Of course that's 
again just splitting hair about terminology :)


Ciao,
Michael.


Re: [Patch,AVR,committed]: Ad PR52496: Use unspec_volatile instead of unspec

2012-03-22 Thread Georg-Johann Lay
Georg-Johann Lay wrote:
 This patch adds memory barriers to
 
 __builtin_avr_nop
 __builtin_avr_sei
 __builtin_avr_cli
 __builtin_avr_wdr
 __builtin_avr_sleep
 __builtin_avr_delay_cycles
 
 so that their code cannot be dragged over memory accesses.
 
 Ok for trunk?
 
   PR target/52496
   * config/avr/avr.c (avr_mem_clobber): New static function.
   (avr_expand_delay_cycles): Add memory clobber operand to
   delay_cycles_1, delay_cycles_2, delay_cycles_3, delay_cycles_4.
   * config/avr/avr.md (unspec): Add UNSPEC_MEMORY_BARRIER.
   (enable_interrupt, disable_interrupt): New expander.
   (nopv, sleep, wdr): New expanders.
   (delay_cycles_1): Add memory clobber.
   (delay_cycles_2): Add memory clobber.
   (delay_cycles_3): Add memory clobber.
   (delay_cycles_4): Add memory clobber.
   (cli_sei): New insn from former enable_interrupt,
   disable_interrupt with memory clobber.
   (*wdt): New insn from former wdt with memory clobber.
   (*sleep): New insn from former sleep with memory clobber.

http://gcc.gnu.org/viewcvs?root=gccview=revrev=185692

Applied this addendum that uses unspec_volatile instead of unspec in order to
be as conservative as possible.

Johann

PR target/52496
* config/avr/avr.md (unspec): Remove UNSPEC_MEMORY_BARRIER.
(unspecv): Add UNSPECV_MEMORY_BARRIER.
(cli_sei): Use unspec_volatile instead of unspec for memory barrier.
(delay_cycles_1, delay_cycles_2): Ditto.
(delay_cycles_3, delay_cycles_4): Ditto.
(nopv, *nopv): Ditto.
(sleep, *sleep): Ditto.
(wdr, *wdr): Ditto.




[Patch] mpfr headers check

2012-03-22 Thread JonY
Hi,

Attached is a rebased copy of a patch from
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51935.

This is mostly a ping reminder.
Index: configure.ac
===
--- configure.ac(revision 185692)
+++ configure.ac(working copy)
@@ -1271,10 +1271,12 @@
 if test x$with_mpfr_lib != x; then
   gmplibs=-L$with_mpfr_lib $gmplibs
 fi
-if test x$with_mpfr$with_mpfr_include$with_mpfr_lib = x  test -d 
${srcdir}/mpfr; then
-  gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr/'$lt_cv_objdir $gmplibs
-  gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr -I$$s/mpfr '$gmpinc
-  extra_mpc_mpfr_configure_flags='--with-mpfr-include=$$s/mpfr 
--with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr/'$lt_cv_objdir
+if test x$with_mpfr$with_mpfr_include$with_mpfr_lib = x  test -d 
${srcdir}/mpfr; then
+  sdir=
+  test -d ${srcdir}/mpfr/src  sdir=/src
+  gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr'$sdir/$lt_cv_objdir $gmplibs
+  gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr'$sdir '-I$$s/mpfr'$sdir $gmpinc
+  extra_mpc_mpfr_configure_flags='--with-mpfr-include=$$s/mpfr'$sdir 
'--with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr'$sdir/$lt_cv_objdir
   # Do not test the mpfr version.  Assume that it is sufficient, since
   # it is in the source tree, and the library has not been built yet
   # but it would be included on the link line in the version check below


signature.asc
Description: OpenPGP digital signature


[PATCH] Fix PR52666

2012-03-22 Thread Richard Guenther

Committed as obvious.

Richard.

2012-03-22  Richard Guenther  rguent...@suse.de

PR middle-end/52666
* fold-const.c (fold_ternary_loc): Fix typo.

Index: gcc/fold-const.c
===
--- gcc/fold-const.c(revision 185691)
+++ gcc/fold-const.c(working copy)
@@ -14012,7 +14012,7 @@ fold_ternary_loc (location_t loc, enum t
  /* Need bit-shifting of the buffer to relax the following.  */
   tree_low_cst (op2, 1) % BITS_PER_UNIT == 0)
{
- unsigned HOST_WIDE_INT bitpos = tree_low_cst (op1, 2);
+ unsigned HOST_WIDE_INT bitpos = tree_low_cst (op2, 1);
  unsigned HOST_WIDE_INT bitsize = tree_low_cst (op1, 1);
  unsigned HOST_WIDE_INT clen;
  clen = tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (arg0)), 1);


Re: remove wrong code in immed_double_const

2012-03-22 Thread Michael Matz
Hi,

On Wed, 21 Mar 2012, Mike Stump wrote:

 --- a/gcc/emit-rtl.c
 +++ b/gcc/emit-rtl.c
 @@ -531,10 +531,9 @@ immed_double_const (HOST_WIDE_INT i0, HOST_WIDE_INT i1, 
 enum machine_mode mode)
  
   1) If GET_MODE_BITSIZE (mode) = HOST_BITS_PER_WIDE_INT, then we use
   gen_int_mode.
 - 2) GET_MODE_BITSIZE (mode) == 2 * HOST_BITS_PER_WIDE_INT, but the value 
 of
 - the integer fits into HOST_WIDE_INT anyway (i.e., i1 consists only
 - from copies of the sign bit, and sign of i0 and i1 are the same),  then
 - we return a CONST_INT for i0.
 + 2) If the value of the integer fits into HOST_WIDE_INT anyway
 +(i.e., i1 consists only from copies of the sign bit, and sign
 + of i0 and i1 are the same), then we return a CONST_INT for i0.

I see that you didn't remove the assert as part of this patch.  I'd like 
to see what you like to do to this routine once the rest goes in.  In 
particular I don't think just removing the assert will be enough, at the 
very least the block comment should be saying something about what the 
routine exactly does (or doesn't do) for modes where the two HWI arguments 
can't specify all bits.

My point is, for large modes i0 and i1 will only specify the low 2*HWIbits 
bits.  Something needs to document what the upper bits will be (be they 
implicit or explicit), otherwise people reading the comment will always 
wonder what exactly is supposed to happen.  I'm not 100% sure what it 
should say, though.  Probably the interpretation of the upper bits depends 
on the users of the so generated CONST_DOUBLEs.


Ciao,
Michael.


Patch for -mno-exr option in case of function with monitor attribute

2012-03-22 Thread Sandeep Kumar Singh
Hi,

Please find the attached patch to avoid saving of EXR register for
monitor functions.

By default, in prologue code of a monitor function, EXR register is
pushed onto the stack. This implementation is not required for H8S/224x
and 21xx variants of H8S controllers. The behavior can be controlled
with the option -mno-exr.

Built compiler is only for compiling C language source code. No 
regression found with this patch.

Compiler behavior with different command line options used for 
compilation of code after applying this patch is given below:

* h8300-elf-gcc -mn -S test.c
test.c:1:0: error: -mn is used without -mh or -ms or -msx

* h8300-elf-gcc -mh -mexr -S test.c
test.c:1:0: error: -mexr is used without -ms

* h8300-elf-gcc -mh -mno-exr -S test.c
test.c:1:0: warning: -mno-exr valid only with -ms or -msx   
- Option ignored! [-mno-exr]

* Generated assembly with option '-m-exr': 
_testmonitor:
stc exr,@-er7
mov.l   er0,@-er7
stc ccr,r0l

* Generated assembly with option '-mno-exr':
_testmonitor:
mov.l   er0,@-er7
stc ccr,r0l

Please review the patch and let me know if there should be any
modifications in it?


Regards,
Sandeep Kumar Singh,
KPIT Cummins InfoSystems Ltd.
Pune, India



ChangeLog.patch
Description: ChangeLog.patch


patch-EXR.patch
Description: patch-EXR.patch


PR middle-end/51737

2012-03-22 Thread Jan Hubicka
Hi,
this patch fixes (now latent) problem where save_inline_function_body blows up 
when
self recursive call is removed during the body duplication.

The problem reproduce on 4.6, where I will commit the patch after short stay
in mainline. The reason why the bug is latent on 4.7 seems to be the fact
that the code is much less optimized after early optimizations.  I am looking
into it.

Honza

Bootstrapped/regtested x86_64-linux, comitted.
PR middle-end/51737
* cgraph.c (cgraph_remove_node_and_inline_clones): Add FORBIDDEN_NODE
parameter.
* cgraph.h (cgraph_remove_node_and_inline_clones): Update prototype.
* ipa-inline-transform.c (save_inline_function_body): Remove copied 
clone
if needed.
* tree-inline.c (delete_unreachable_blocks_update_callgraph): Update.

PR middle-end/51737
* g++.dg/torture/pr51737.C: New testcase
Index: cgraph.c
===
*** cgraph.c(revision 185605)
--- cgraph.c(working copy)
*** cgraph_add_to_same_comdat_group (struct 
*** 1639,1657 
  }
  }
  
! /* Remove the node from cgraph.  */
  
! void
! cgraph_remove_node_and_inline_clones (struct cgraph_node *node)
  {
struct cgraph_edge *e, *next;
for (e = node-callees; e; e = next)
  {
next = e-next_callee;
if (!e-inline_failed)
! cgraph_remove_node_and_inline_clones (e-callee);
  }
cgraph_remove_node (node);
  }
  
  /* Notify finalize_compilation_unit that given node is reachable.  */
--- 1639,1665 
  }
  }
  
! /* Remove the node from cgraph and all inline clones inlined into it.
!Skip however removal of FORBIDDEN_NODE and return true if it needs to be
!removed.  This allows to call the function from outer loop walking clone
!tree.  */
  
! bool
! cgraph_remove_node_and_inline_clones (struct cgraph_node *node, struct 
cgraph_node *forbidden_node){
struct cgraph_edge *e, *next;
+   bool found = false;
+ 
+   if (node == forbidden_node)
+ return true;
for (e = node-callees; e; e = next)
  {
next = e-next_callee;
if (!e-inline_failed)
! found |= cgraph_remove_node_and_inline_clones (e-callee, 
forbidden_node);
  }
cgraph_remove_node (node);
+   return found;
  }
  
  /* Notify finalize_compilation_unit that given node is reachable.  */
Index: cgraph.h
===
*** cgraph.h(revision 185605)
--- cgraph.h(working copy)
*** void cgraph_insert_node_to_hashtable (st
*** 478,484 
  void cgraph_remove_edge (struct cgraph_edge *);
  void cgraph_remove_node (struct cgraph_node *);
  void cgraph_add_to_same_comdat_group (struct cgraph_node *, struct 
cgraph_node *);
! void cgraph_remove_node_and_inline_clones (struct cgraph_node *);
  void cgraph_release_function_body (struct cgraph_node *);
  void cgraph_node_remove_callees (struct cgraph_node *node);
  struct cgraph_edge *cgraph_create_edge (struct cgraph_node *,
--- 478,484 
  void cgraph_remove_edge (struct cgraph_edge *);
  void cgraph_remove_node (struct cgraph_node *);
  void cgraph_add_to_same_comdat_group (struct cgraph_node *, struct 
cgraph_node *);
! bool cgraph_remove_node_and_inline_clones (struct cgraph_node *, struct 
cgraph_node *);
  void cgraph_release_function_body (struct cgraph_node *);
  void cgraph_node_remove_callees (struct cgraph_node *node);
  struct cgraph_edge *cgraph_create_edge (struct cgraph_node *,
Index: ipa-inline-transform.c
===
*** ipa-inline-transform.c  (revision 185605)
--- ipa-inline-transform.c  (working copy)
*** save_inline_function_body (struct cgraph
*** 336,343 
  first_clone-ipa_transforms_to_apply);
first_clone-ipa_transforms_to_apply = NULL;
  
  #ifdef ENABLE_CHECKING
!   verify_cgraph_node (first_clone);
  #endif
return first_clone;
  }
--- 336,354 
  first_clone-ipa_transforms_to_apply);
first_clone-ipa_transforms_to_apply = NULL;
  
+   /* When doing recursive inlining, the clone may become unnecessary.
+  This is possible i.e. in the case when the recursive function is proved 
to be
+  non-throwing and the recursion happens only in the EH landing pad.
+  We can not remove the clone until we are done with saving the body.
+  Remove it now.  */
+   if (!first_clone-callers)
+ {
+   cgraph_remove_node_and_inline_clones (first_clone, NULL);
+   first_clone = NULL;
+ }
  #ifdef ENABLE_CHECKING
!   else
! verify_cgraph_node (first_clone);
  #endif
return first_clone;
  }
Index: tree-inline.c
===
*** tree-inline.c   (revision 185605)
--- tree-inline.c   (working copy)
*** delete_unreachable_blocks_update_callgra
*** 4955,4961 
if 

Re: [C++ Patch] PR 52487

2012-03-22 Thread Jason Merrill
It's ill-formed to have a field with incomplete type.  The best thing 
would be to complain about that before we get to literal_type_p so that 
errorcount is set, if that's not too complicated.


Jason


[testsuite,avr,backport,4.7]: Backport some address-space tests from trunk

2012-03-22 Thread Georg-Johann Lay
http://gcc.gnu.org/viewcvs?view=revisionrevision=185696

Backported these address-space tests from trunk.



[Patch]: unwind-ia64: avoid long type

2012-03-22 Thread Tristan Gingold
Hi,

currently unwind-ia64.[ch] (and fde-glibc.c/fde-vms.c) use 'unsigned long' for 
a 64 bit integer type.

That doesn't work well with VMS because 'long' is a 32 bit type on this 
platform…

So this patch replaces 'unsigned long' with 'unw_word' (and the very few 'long' 
with 'unw_sword') in these files, when they represent a register.
The type 'unw_word' which was defined in unwind-ia64.c is now defined in 
unwind-ia64.h with an '#ifdef __VMS__' to handle the VMS case.  Might not be 
the best practice (we could use 'long long' instead on all platforms), but I 
don't think there will be many new ports to ia64.

A few exceptions:
* in ia64_copy_rbs, 'count' becomes unsigned (was always = 0),
* in uw_update_context and uw_install_context 'long i' becomes 'int i' (make 
grep 'long' easier).

This patch was manually tested on ia64-hp-openvms with Ada.
(I plan to run the g++ or ada test suite on ia64-linux if approved).

Ok for trunk ?

Tristan.

libgcc/
2012-03-22  Tristan Gingold  ging...@adacore.com

* config/ia64/unwind-ia64.h: Declare unw_word and unw_sword.
(unw_table_entry): Use unw_word instead of unsigned long.
(_Unwind_FindTableEntry): Likewise.
* config/ia64/fde-glibc.c (_Unwind_FindTableEntry): Likewise.
* config/ia64/fde-vms.c (vms_unwtable_entry): Likewise.
(_Unwind_FindTableEntry): Likewise.
* config/ia64/unwind-ia64.c (unw_reg_info, unw_reg_state)
(unw_labeled_state, unw_state_record, unw_stack, _Uwind_Context)
(set_reg, alloc_spill_area, finish_prologue, ia64_rse_slot_num)
(ia64_rse_is_rnat_slot, ia64_rse_rnat_addr, ia64_rse_num_regs)
(ia64_rse_skip_regs, ia64_copy_rbs, unw_access_gr)
(uw_frame_state_for, uw_update_reg_address, uw_update_context)
(uw_init_context_1, uw_install_context): Likewise.
(unw_word): Move to unwind-ia64.h
diff --git a/libgcc/config/ia64/fde-glibc.c b/libgcc/config/ia64/fde-glibc.c
index 12760b9..6462307 100644
--- a/libgcc/config/ia64/fde-glibc.c
+++ b/libgcc/config/ia64/fde-glibc.c
@@ -144,8 +144,7 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, 
size_t size, void *ptr)
containing PC.  */
 
 struct unw_table_entry *
-_Unwind_FindTableEntry (void *pc, unsigned long *segment_base,
-unsigned long *gp,
+_Unwind_FindTableEntry (void *pc, unw_word *segment_base, unw_word *gp,
 struct unw_table_entry *ent ATTRIBUTE_UNUSED)
 {
   struct unw_ia64_callback_data data;
diff --git a/libgcc/config/ia64/fde-vms.c b/libgcc/config/ia64/fde-vms.c
index 9aadf34..7c5d24e 100644
--- a/libgcc/config/ia64/fde-vms.c
+++ b/libgcc/config/ia64/fde-vms.c
@@ -45,10 +44,10 @@
 
 typedef struct
 {
-  unsigned long start_offset;
-  unsigned long end_offset;
-  unsigned long info_offset;
-  unsigned long gp_value;
+  unw_word start_offset;
+  unw_word end_offset;
+  unw_word info_offset;
+  unw_word gp_value;
 }  vms_unw_table_entry;
 
 typedef unsigned long long uqword;
@@ -133,8 +132,8 @@ force_fallback_processing_for (void * pc, 
vms_unw_table_entry * entry)
calls for fallback processing.  */
 
 struct unw_table_entry *
-_Unwind_FindTableEntry (void *pc, unsigned long *segment_base,
-unsigned long *gp, struct unw_table_entry *ent)
+_Unwind_FindTableEntry (void *pc, unw_word *segment_base,
+unw_word *gp, struct unw_table_entry *ent)
 {
   vms_unw_table_entry vueblock;
 
diff --git a/libgcc/config/ia64/unwind-ia64.c b/libgcc/config/ia64/unwind-ia64.c
index ca5c267..10cf136 100644
--- a/libgcc/config/ia64/unwind-ia64.c
+++ b/libgcc/config/ia64/unwind-ia64.c
@@ -114,20 +114,20 @@ enum unw_where
 
 struct unw_reg_info
 {
-  unsigned long val;   /* save location: register number or offset */
+  unw_word val;/* save location: register number or 
offset */
   enum unw_where where;/* where the register gets saved */
   int when;/* when the register gets saved */
 };
 
 struct unw_reg_state {
-   struct unw_reg_state *next; /* next (outer) element on state stack 
*/
-   struct unw_reg_info reg[UNW_NUM_REGS];  /* register save locations */
+  struct unw_reg_state *next;  /* next (outer) element on state stack */
+  struct unw_reg_info reg[UNW_NUM_REGS];   /* register save locations */
 };
 
 struct unw_labeled_state {
-   struct unw_labeled_state *next; /* next labeled state (or NULL) 
*/
-   unsigned long label;/* label for this state */
-   struct unw_reg_state saved_state;
+  struct unw_labeled_state *next;  /* next labeled state (or NULL) */
+  unw_word label;  /* label for this state */
+  struct unw_reg_state saved_state;
 };
 
 typedef struct unw_state_record
@@ -135,12 +135,12 @@ typedef struct unw_state_record
   unsigned int first_region : 1;   /* is this the first region? */
   unsigned int done : 1;   /* are we 

[PATCH ARM] Add ctzsi2 to libiberty

2012-03-22 Thread Richard Earnshaw
This patch is mainly to fix a regression on trunk with support for
__ctzsi2 on cores that do not have the CLZ instruction (notably pre-v5
and cortex-m0).  It's needed after a recent change to longlong.h which
now defines count_trailing_zeros to use the GCC builtin: unfortunately
that builtin is used in the default libgcc definition of __ctzsi2 and
gcc furthermore falls back when it has no sequence to implement that
builting by calling the __ctzsi2 helper function...

The patch addresses the problem by providing suitable assembly-language
definitions that break the recursive loop.  They're also marginally
optimized over the alternative of calling __clzsi2 to provide the
implementation.

Tested on bare metal for both thumb1 and pre-v5 ARM and committed to trunk.

No need for additional tests, this fixes FAILs on the FFS2 tests.

* arm/lib1funcs.asm (ctzsi2): New function.
* arm/t-elf (LIB1ASMFUNCS): Add _ctzsi2.
* arm/t-linux (LIB1ASMFUNCS): Likewise.
* arm/t-strongarm-elf (LIB1ASMFUNCS): Likewise.
* arm/t-symbian (LIB1ASMFUNCS): Likewise.
* arm/t-vxworks (LIB1ASMFUNCS): Likewise.
* arm/t-wince-pe (LIB1ASMFUNCS): Likewise.

R.--- config/arm/lib1funcs.S  (revision 185620)
+++ config/arm/lib1funcs.S  (local)
@@ -1594,6 +1594,70 @@ ARM_FUNC_START clzdi2
 #endif
 #endif /* L_clzdi2 */
 
+#ifdef L_ctzsi2
+#if defined(__ARM_ARCH_6M__)
+FUNC_START ctzsi2
+   neg r1, r0
+   and r0, r0, r1
+   mov r1, #28
+   mov r3, #1
+   lsl r3, r3, #16
+   cmp r0, r3 /* 0x1 */
+   bcc 2f
+   lsr r0, r0, #16
+   sub r1, r1, #16
+2: lsr r3, r3, #8
+   cmp r0, r3 /* #0x100 */
+   bcc 2f
+   lsr r0, r0, #8
+   sub r1, r1, #8
+2: lsr r3, r3, #4
+   cmp r0, r3 /* #0x10 */
+   bcc 2f
+   lsr r0, r0, #4
+   sub r1, r1, #4
+2: adr r2, 1f
+   ldrbr0, [r2, r0]
+   sub r0, r0, r1
+   bx lr
+.align 2
+1:
+.byte  27, 28, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31
+   FUNC_END ctzsi2
+#else
+ARM_FUNC_START ctzsi2
+   rsb r1, r0, #0
+   and r0, r0, r1
+# if defined(HAVE_ARM_CLZ)
+   clz r0, r0
+   rsb r0, r0, #31
+   RET
+# else
+   mov r1, #28
+   cmp r0, #0x1
+   do_it   cs, t
+   movcs   r0, r0, lsr #16
+   subcs   r1, r1, #16
+   cmp r0, #0x100
+   do_it   cs, t
+   movcs   r0, r0, lsr #8
+   subcs   r1, r1, #8
+   cmp r0, #0x10
+   do_it   cs, t
+   movcs   r0, r0, lsr #4
+   subcs   r1, r1, #4
+   adr r2, 1f
+   ldrbr0, [r2, r0]
+   sub r0, r0, r1
+   RET
+.align 2
+1:
+.byte  27, 28, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31
+# endif /* !HAVE_ARM_CLZ */
+   FUNC_END ctzsi2
+#endif
+#endif /* L_clzsi2 */
+
 /*  */
 /* These next two sections are here despite the fact that they contain Thumb 
assembler because their presence allows interworked code to be linked even
--- config/arm/t-elf(revision 185620)
+++ config/arm/t-elf(local)
@@ -10,7 +10,7 @@ LIB1ASMFUNCS += _udivsi3 _divsi3 _umodsi
_arm_truncdfsf2 _arm_negsf2 _arm_addsubsf3 _arm_muldivsf3 \
_arm_cmpsf2 _arm_unordsf2 _arm_fixsfsi _arm_fixunssfsi \
_arm_floatdidf _arm_floatdisf _arm_floatundidf _arm_floatundisf \
-   _clzsi2 _clzdi2 
+   _clzsi2 _clzdi2 _ctzsi2
 
 # Currently there is a bug somewhere in GCC's alias analysis
 # or scheduling code that is breaking _fpmul_parts in fp-bit.c.
--- config/arm/t-linux  (revision 185620)
+++ config/arm/t-linux  (local)
@@ -1,6 +1,6 @@
 LIB1ASMSRC = arm/lib1funcs.S
 LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
-   _arm_addsubdf3 _arm_addsubsf3
+   _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
 
 # Just for these, we omit the frame pointer since it makes such a big
 # difference.
--- config/arm/t-strongarm-elf  (revision 185620)
+++ config/arm/t-strongarm-elf  (local)
@@ -1,4 +1,4 @@
-LIB1ASMFUNCS += _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func 
_clzsi2 _clzdi2
+LIB1ASMFUNCS += _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func 
_clzsi2 _clzdi2 _ctzsi2
 
 # Currently there is a bug somewhere in GCC's alias analysis
 # or scheduling code that is breaking _fpmul_parts in fp-bit.c.
--- config/arm/t-symbian(revision 185620)
+++ config/arm/t-symbian(local)
@@ -1,4 +1,4 @@
-LIB1ASMFUNCS += _bb_init_func _call_via_rX _interwork_call_via_rX _clzsi2 
_clzdi2
+LIB1ASMFUNCS += _bb_init_func _call_via_rX _interwork_call_via_rX _clzsi2 
_clzdi2 _ctzsi2
 
 # These functions have __aeabi equivalents and will never be called by GCC.  
 # By putting them in LIB1ASMFUNCS, we avoid the standard libgcc2.c code being
--- config/arm/t-vxworks(revision 185620)
+++ 

[AVR,backported,4.7]: PR52148, PR52461, PR52484, PR52488, PR52496, PR52499, PR52505, PR52506, PR52507, PR52508, PR52543

2012-03-22 Thread Georg-Johann Lay
http://gcc.gnu.org/viewcvs?view=revisionrevision=185697

Backported these from trunk to 4.7.

Johann

libgcc/
Backport from 2012-03-07 mainline r185033.

PR target/52507
* config/avr/lib1funcs.S (__movmemx_hi): Fix loop label in RAM-part.

Backport from 2012-03-07 mainline r185031.

PR target/52505
* config/avr/lib1funcs.S (__xload_1): Don't read unintentionally
from RAM.

Backport from 2012-03-07 mainline r185030.

PR target/52461
PR target/52508
* config/avr/lib1funcs.S (__do_copy_data): Clear RAMPZ after usage
if RAMPZ affects reading from RAM.
(__tablejump_elpm__): Ditto.
(.xload): Ditto.
(__movmemx_hi): Ditto.
(__do_global_ctors): Right condition for RAMPZ usage is have ELPM.
(__do_global_dtors): Ditto.
(__xload_1, __xload_2, __xload_3, __xload_4): Ditto.
(__movmemx_hi): Ditto.

gcc/
Backport from 2012-03-22 mainline r185692.

PR target/52496
* config/avr/avr.md (unspec): Remove UNSPEC_MEMORY_BARRIER.
(unspecv): Add UNSPECV_MEMORY_BARRIER.
(cli_sei): Use unspec_volatile instead of unspec for memory barrier.
(delay_cycles_1, delay_cycles_2): Ditto.
(delay_cycles_3, delay_cycles_4): Ditto.
(nopv, *nopv): Ditto.
(sleep, *sleep): Ditto.
(wdr, *wdr): Ditto.

Backport from 2012-03-21 mainline r185605.

PR rtl-optimization/52543
PR target/52461
* config/avr/avr-protos.h (avr_load_lpm): New prototype.
* config/avr/avr.c (avr_mode_dependent_address_p): New function.
(TARGET_MODE_DEPENDENT_ADDRESS_P): New define.
(avr_load_libgcc_p): Restrict to __flash loads.
(avr_out_lpm): Only handle 1-byte loads from __flash.
(avr_load_lpm): New function.
(avr_find_unused_d_reg): Remove.
(avr_out_lpm_no_lpmx): Remove.
(adjust_insn_length): Handle ADJUST_LEN_LOAD_LPM.
* config/avr/avr.md (unspec): Add UNSPEC_LPM.
(load_mode_libgcc): Use UNSPEC_LPM instead of MEM.
(load_mode, load_mode_clobber): New insns.
(movmode): For multi-byte move from non-generic
16-bit address spaces: Expand to load_mode resp.
load_mode_clobber.
(loadmode_libgcc): Remove expander.
(split-lpmx): Remove split.

Backport from 2012-03-13 mainline r185329.

PR target/52488
* config/avr/avr.c (avr_prologue_setup_frame): Cut down stack
offset (size) to a value the insns can deal with.
(expand_epilogue): Ditto.

Backport from 2012-03-12 mainline r185256.

PR target/52499
* config/avr/avr.c (avr_mode_code_base_reg_class): Change return
type from reg_class_t to enum reg_class.
* config/avr/avr-protos.h (avr_mode_code_base_reg_class): Ditto.

Backport from 2012-03-12 mainline r185253.

PR target/52148
* config/avr/avr.c (avr_out_movmem): Fix typo in output template
for the case ADDR_SPACE_FLASH and AVR_HAVE_LPMX introduced in
r184615 from 2012-02-28.

Backport from 2012-03-08 mainline r185105.

* config/avr/avr.md (*addhi3, addhi3_clobber): Add w alternative
for constants in [-63,63].

Backport from 2012-03-08 mainline r185100.

PR target/52496
* config/avr/avr.c (avr_mem_clobber): New static function.
(avr_expand_delay_cycles): Add memory clobber operand to
delay_cycles_1, delay_cycles_2, delay_cycles_3, delay_cycles_4.
* config/avr/avr.md (unspec): Add UNSPEC_MEMORY_BARRIER.
(enable_interrupt, disable_interrupt): New expander.
(nopv, sleep, wdr): New expanders.
(delay_cycles_1): Add memory clobber.
(delay_cycles_2): Add memory clobber.
(delay_cycles_3): Add memory clobber.
(delay_cycles_4): Add memory clobber.
(cli_sei): New insn from former enable_interrupt,
disable_interrupt with memory clobber.
(*wdt): New insn from former wdt with memory clobber.
(*nopv): Similar, but for nopv.
(*sleep): Similar, but for sleep.

Backport from 2012-03-07 mainline r185043.

PR target/52484
* config/avr/avr.md (xloadmode_A): Add R22... to register footprint.

Backport from 2012-03-07 mainline r185032.

PR target/52506
* gcc/config/avr/avr.c (expand_epilogue): Fix order of restoration
to: RAMPZ, RAMPY, RAMPX, RAMPD.
(expand_prologue): Only clear RAMPZ if it has effect on RAM-read.

Backport from 2012-03-07 mainline r185031.

PR target/52505
* config/avr/avr.c (avr_out_xload): Don't read unintentionally
from RAM.
* config/avr/avr.md (xload_8): Adjust insn length.

Backport from 2012-03-07 mainline r185030.

PR target/52461
* gcc/config/avr/avr.c (avr_out_lpm): Clear RAMPZ after usage

Re: [PATCH, alpha]: Some further configure cleanups

2012-03-22 Thread Richard Henderson
On 03/22/12 05:49, Uros Bizjak wrote:
 2012-03-22  Uros Bizjak  ubiz...@gmail.com
 
   * config/alpha/alpha.h (ASM_OUTPUT_ALIGN): Move to elf.h
   (ASM_OUTPUT_SKIP): Move to vms.h
   (ASM_OUTPUT_LOCAL): Ditto.
   (ASM_OUTPUT_COMMON): Remove.
   * config/alpha/elf.h (ASM_OUTPUT_DEF_FROM_DECLS): Use ASM_OUTPUT_DEF.
   * config/alpha/vms.h (ASM_OUTPUT_ALIGN): Do not undefine before define.

Ok.


r~


Re: [C++ Patch] PR 49152

2012-03-22 Thread Marc Glisse

On Thu, 22 Mar 2012, Paolo Carlini wrote:


Hi,

On 03/22/2012 05:25 AM, Gabriel Dos Reis wrote:
On Wed, Mar 21, 2012 at 7:22 PM, Paolo Carlinipaolo.carl...@oracle.com 
wrote:

Hi,

this diagnostic issue is about not even trying to print expressions in 
error

messages involving operators, and print operand types instead. Just as an
example, for:

struct X { int x; };
void trigger (X x []) { x [01] = 0; }

we currently print:

error: no match for ‘operator=’ in ‘*(x + 4u) = 0’

which the patch changes to:

error: no match for ‘operator=’ (operand types are ‘X’ and ‘int’)

Or, for the existing other/error10.C, from:

error: no match for ‘operator-’ in ‘-(*  a)’

to

error: no match for ‘operator-’ (operand type is ‘A0’)

Usually these things appear in much less simpler expressions, possibly 
involving

the same symbol but withe different meanings.  There out be the a
way to give an indication of which symbol the diagnostic is about.
Withe the (imperfect) approach of printing expressions, at least some 
indication
is given on the expression involved.  Just printing the types with no 
indication

of what expression is causing trouble is more head-scratching.
Yes, you are right. Yesterday I had another look to the audit trail and 
thought, mistakenly, that people had a consensus about printing the types (by 
the way we are dealing also with much worse cases, like the one in Comment #0 
there). Thus I don't think for the time being I can do much here, maybe the 
PR could be even closes as duplicate of the one about missing caret.


I haven't followed the whole diagnostic discussion, but what about 
printing both the reconstructed expression and the types?


--
Marc Glisse


Re: [PATCH, alpha]: Use generic config/elfos.h headers

2012-03-22 Thread Richard Henderson
On 03/22/12 00:47, Uros Bizjak wrote:
 No, we are still calling default_file_start in alpha_file_start, so we
 have to signal that we don't want start file directive. In committed
 patch, I have redefined T_A_F_S_F_D as false for this purpose:

But false is the default:

DEFHOOKPOD
(asm_file_start_file_directive,
 ,
 bool, false)

This only needed overriding when alpha.c was forcing T_A_F_S_F_D true.


r~


Re: [wwwdocs] Fix some nits in GCC 4.7 changes.html

2012-03-22 Thread Rainer Orth
Gerald Pfeifer ger...@pfeifer.com writes:

 On Fri, 16 Mar 2012, Rainer Orth wrote:
 While reading through the GCC 4.7 changes.html, I noticed a couple of 
 nits that this patch fixes.  It's mostly wording and grammar changes (so 
 I may well be wrong and would appreciate a native speaker having a look 

 This looks good in general, thanks.

 Instead of the change around pollution I would prefer 
   Avoid polluting the global namespace and do not include...
 instead of either the old or the proposed version, though I'll admit
 I do not have a strong rationale.

I think you're right: it correctly emphasizes the avoidance.

 I am not sure about The powerpc vs The PowerPC vs powerpc,
 please pass that part by David Edelsohn.

Already dealt with, thanks David.

 Similarly, are you sure code#pragma GCC target attribute/code
 change is incorrect.  Isn't that a function attribute?

Indeed: neither the original nor my patch were right here.  I've updated
my patch to include the correct syntax.

Ok now?

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University



Index: changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v
retrieving revision 1.102
diff -u -p -r1.102 changes.html
--- changes.html	22 Mar 2012 09:40:43 -	1.102
+++ changes.html	22 Mar 2012 16:40:14 -
@@ -126,7 +126,7 @@
   pre
 void foo(int a)
 {
-  if (agt;10)
+  if (a gt; 10)
 ... huge code ...
 }
 void bar (void)
@@ -166,7 +166,7 @@ void bar (void)
   GCC will now produce two copies of codefoo/code. One with codeflag/code being
   codetrue/code, while other with codeflag/code being
   codefalse/code.  This leads to performance improvements previously
-  possibly only by inlining all calls.  Cloning causes a lot less code size
+  possible only by inlining all calls.  Cloning causes a lot less code size
   growth./li
 /ul/li
 
@@ -242,20 +242,21 @@ void foo (char *a, const char *b, const 
   li
 p
   Experimental support for transactional memory has been added.
-  It includes support for the compiler, as well as a supporting
+  It includes support in the compiler, as well as a supporting
   runtime library called codelibitm/code.  To compile code
   with transactional memory constructs, use
   the code-fgnu-tm/code option.
 /p
 
 p
-  Support is currently available for the x86-32, x86-64, and Alpha
-  platforms.
+  Support is currently available for Alpha, ARM, PowerPC, SH, SPARC,
+  and 32-bit/64-bit x86 platforms.
 /p
 
 p
   For more details on transactional memory
-  see a href=http://gcc.gnu.org/wiki/TransactionalMemory;here/a.
+  see a href=http://gcc.gnu.org/wiki/TransactionalMemory;the GCC
+  WiKi/a.
 /p
   /li
 
@@ -266,11 +267,11 @@ void foo (char *a, const char *b, const 
   existing code__sync/code built-in routines.
 /p
 p
-  Atomic support is also available for memory blocks.  Lock free
+  Atomic support is also available for memory blocks.  Lock-free
   instructions will be used if a memory block is the same size and 
   alignment as a supported integer type.  Atomic operations which do not
-  have lock free support are left as function calls.  A set of library 
-  functions are available on the GCC atomic wiki in the External 
+  have lock-free support are left as function calls.  A set of library 
+  functions is available on the GCC atomic wiki in the External 
   Atomics Library section.
 /p
 p
@@ -279,8 +280,8 @@ void foo (char *a, const char *b, const 
 /p
   /li
 
-  liWhen a binary operation performed on vector types and one of the operands
-  is a uniform vector it is possible to replace the vector with the
+  liWhen a binary operation is performed on vector types and one of the operands
+  is a uniform vector, it is possible to replace the vector with the
   generating element. For example:
   pre
 typedef int v4si __attribute__ ((vector_size (16)));
@@ -352,7 +353,7 @@ struct B {
 };
 
 struct D : B {
-  void f() const;// error: D::f attempts to override final B::f
+  void f() const;// error: D::f attempts to override final B::f
   void f(long) override; // error: doesn't override anything
   void f(int) override;  // ok
 };
@@ -499,7 +500,8 @@ well./p/li
  /li
  liAdded code--enable-clocale=newlib/code configure option. /li
  liDebug Mode iterators for unordered associative containers. /li
- liAvoid polluting the global namespace by inclusion of codelt;unistd.hgt;/code.  /li
+ liAvoid polluting the global namespace and do not include
+	codelt;unistd.hgt;/code./li
 
 
   /ul
@@ -509,7 +511,7 @@ well./p/li
 liThe compile flag a
   

Re: [PATCH, alpha]: Use generic config/elfos.h headers

2012-03-22 Thread Uros Bizjak
On Thu, Mar 22, 2012 at 5:24 PM, Richard Henderson r...@redhat.com wrote:
 On 03/22/12 00:47, Uros Bizjak wrote:
 No, we are still calling default_file_start in alpha_file_start, so we
 have to signal that we don't want start file directive. In committed
 patch, I have redefined T_A_F_S_F_D as false for this purpose:

 But false is the default:

 DEFHOOKPOD
 (asm_file_start_file_directive,
  ,
  bool, false)

 This only needed overriding when alpha.c was forcing T_A_F_S_F_D true.

The #define is now brought in form the generic elfos.h. We need to
either undefine it, or redefine it to false. I have chosen the later,
to explicitly state that we don't want .file directives.

Uros.


Re: [wwwdocs] Fix some nits in GCC 4.7 changes.html

2012-03-22 Thread Rainer Orth
Gerald Pfeifer ger...@pfeifer.com writes:

 On Fri, 16 Mar 2012, Rainer Orth wrote:
 While reading through the GCC 4.7 changes.html, I noticed a couple of 
 nits that this patch fixes.  It's mostly wording and grammar changes (so 
 I may well be wrong and would appreciate a native speaker having a look 

 This looks good in general, thanks.

One issue I forgot: there are currently two instances of the long form
of the bugzilla URLs.  Shouldn't we better use http://gcc.gnu.org/PRn
here?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH, alpha]: Use generic config/elfos.h headers

2012-03-22 Thread Richard Henderson
On 03/22/12 09:49, Uros Bizjak wrote:
 The #define is now brought in form the generic elfos.h. We need to

Ah, right.  Ok.


r~


Re: [C++ Patch] PR 49152

2012-03-22 Thread Gabriel Dos Reis
On Thu, Mar 22, 2012 at 11:13 AM, Marc Glisse marc.gli...@inria.fr wrote:

 I haven't followed the whole diagnostic discussion, but what about printing
 both the reconstructed expression and the types?

Printing both isn't really the issue -- and we probably should.  (And I thought
we did in some cases.)

What is at issue is that the tree we print is one that is of a too
low-level form, sometimes
a bit removed from what user wrote (e.g. containing too much information to be
usefully processed by the user) therefore adding some confusion.  There are
several ways around this: (a) print the expression as written by the user
(this usually means dumping verbatim the expression from the input source file);
(b) reconstruct the expression from the tree but with a much higher level view
(this may be possible if the C++ front-end preserves certain properties from the
source code, but currently it does not.)

People usually refers to (a) as diagnostics with caret, because some popular
compilers dump the user input source file and use carets to delimit
the boundaries
of the expression under scrutiny.

-- Gaby



 --
 Marc Glisse


Re: [C++ Patch] PR 52487

2012-03-22 Thread Paolo Carlini

On 03/22/2012 03:49 PM, Jason Merrill wrote:
It's ill-formed to have a field with incomplete type.  The best thing 
would be to complain about that before we get to literal_type_p so 
that errorcount is set, if that's not too complicated.
Agreed. The problem is that if we just change check_field_decls to 
produce an error about the incomplete field, we produce also another 
later: that is, considering cp_parser_lambda_expression, we get to 
check_field_decls from finish_struct, but we eventually also produce an 
error with cxx_incomplete_type_diagnostic from build_lambda_object (- 
force_rvalue - build_special_member_call - 
complete_type_or_maybe_complain)


Anyway, I also think not calling literal_type_p from check_field_decls 
if the type is incomplete is pretty ugly, but I'm not sure which is the 
best way to make progress: I could try returning a boolean from 
check_field_decls if something goes wrong in order to bail out early 
from cp_parser_lambda_expression (at the moment, finish_struct_1, 
check_bases_and_members, all return void). Or I could try to catch the 
incomplete field even *before* check_field_decls.


What do you suggest?

Thanks,
Paolo.



Re: [C++ Patch] PR 52487

2012-03-22 Thread Gabriel Dos Reis
On Thu, Mar 22, 2012 at 11:58 AM, Paolo Carlini
paolo.carl...@oracle.com wrote:
 On 03/22/2012 03:49 PM, Jason Merrill wrote:

 It's ill-formed to have a field with incomplete type.  The best thing
 would be to complain about that before we get to literal_type_p so that
 errorcount is set, if that's not too complicated.

 Agreed. The problem is that if we just change check_field_decls to produce
 an error about the incomplete field, we produce also another later: that is,

Can't we set a bit saying that the field has already gone through
diagnostics, just
like we do when trying to avoid duplicate warnings?

 considering cp_parser_lambda_expression, we get to check_field_decls from
 finish_struct, but we eventually also produce an error with
 cxx_incomplete_type_diagnostic from build_lambda_object (- force_rvalue -
 build_special_member_call - complete_type_or_maybe_complain)

 Anyway, I also think not calling literal_type_p from check_field_decls if
 the type is incomplete is pretty ugly, but I'm not sure which is the best
 way to make progress: I could try returning a boolean from check_field_decls
 if something goes wrong in order to bail out early from
 cp_parser_lambda_expression (at the moment, finish_struct_1,
 check_bases_and_members, all return void). Or I could try to catch the
 incomplete field even *before* check_field_decls.

 What do you suggest?

 Thanks,
 Paolo.



[patch, ARM] Implement Neon-optimized version of search_line_fast

2012-03-22 Thread Richard Earnshaw
search_line_fast in the lexer is documented as being a critical path.
Several architectures already provide an optimized implementation of
this routine using vector operations.  This patch provides a version for
ARM using the Neon vector extensions.

Although it has not been tested on big-endian (I don't have anything
big-endian to do native testing on), I believe the code doesn't need
further porting: the use of vld1q_u8() to read the data from memory will
always put the lowest addressed byte into lane 0 of the vector.

Bootstrapped on arm-linux-gnueabi with the necessary options to enable
the use of Neon.

OK for trunk?

* lex.c (search_line_fast): Provide Neon-optimized version for ARM.--- lex.c   (revision 185620)
+++ lex.c   (local)
@@ -629,6 +629,69 @@ search_line_fast (const uchar *s, const 
   }
 }
 
+#elif defined (__ARM_NEON__)
+#include arm_neon.h
+
+static const uchar *
+search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED)
+{
+  const uint8x16_t repl_nl = vdupq_n_u8 ('\n');
+  const uint8x16_t repl_cr = vdupq_n_u8 ('\r');
+  const uint8x16_t repl_bs = vdupq_n_u8 ('\\');
+  const uint8x16_t repl_qm = vdupq_n_u8 ('?');
+  const uint8x16_t xmask = (uint8x16_t) vdupq_n_u64 (0x8040201008040201ULL);
+
+  unsigned int misalign, found, mask;
+  const uint8_t *p;
+  uint8x16_t data;
+
+  /* Align the source pointer.  */
+  misalign = (uintptr_t)s  15;
+  p = (const uint8_t *)((uintptr_t)s  -16);
+  data = vld1q_u8 (p);
+
+  /* Create a mask for the bytes that are valid within the first
+ 16-byte block.  The Idea here is that the AND with the mask
+ within the loop is free, since we need some AND or TEST
+ insn in order to set the flags for the branch anyway.  */
+  mask = (-1u  misalign)  0x;
+
+  /* Main loop, processing 16 bytes at a time.  */
+  goto start;
+
+  do
+{
+  uint8x8_t l;
+  uint16x4_t m;
+  uint32x2_t n;
+  uint8x16_t t, u, v, w;
+
+  p += 16;
+  data = vld1q_u8 (p);
+  mask = 0x;
+
+start:
+  t = vceqq_u8 (data, repl_nl);
+  u = vceqq_u8 (data, repl_cr);
+  v = vorrq_u8 (t, vceqq_u8 (data, repl_bs));
+  w = vorrq_u8 (u, vceqq_u8 (data, repl_qm));
+  t = vandq_u8 (vorrq_u8 (v, w), xmask);
+  l = vpadd_u8 (vget_low_u8 (t), vget_high_u8 (t));
+  m = vpaddl_u8 (l);
+  n = vpaddl_u16 (m);
+  
+  found = vget_lane_u32 ((uint32x2_t) vorr_u64 ((uint64x1_t) n, 
+ vshr_n_u64 ((uint64x1_t) n, 24)), 0);
+  found = mask;
+}
+  while (!found);
+
+  /* FOUND contains 1 in bits for which we matched a relevant
+ character.  Conversion to the byte index is trivial.  */
+  found = __builtin_ctz (found);
+  return (const uchar *)p + found;
+}
+
 #else
 
 /* We only have one accellerated alternative.  Use a direct call so that

Re: [Patch]: unwind-ia64: avoid long type

2012-03-22 Thread Richard Henderson
On 03/22/12 07:55, Tristan Gingold wrote:
 2012-03-22  Tristan Gingold  ging...@adacore.com
 
   * config/ia64/unwind-ia64.h: Declare unw_word and unw_sword.
   (unw_table_entry): Use unw_word instead of unsigned long.
   (_Unwind_FindTableEntry): Likewise.
   * config/ia64/fde-glibc.c (_Unwind_FindTableEntry): Likewise.
   * config/ia64/fde-vms.c (vms_unwtable_entry): Likewise.
   (_Unwind_FindTableEntry): Likewise.
   * config/ia64/unwind-ia64.c (unw_reg_info, unw_reg_state)
   (unw_labeled_state, unw_state_record, unw_stack, _Uwind_Context)
   (set_reg, alloc_spill_area, finish_prologue, ia64_rse_slot_num)
   (ia64_rse_is_rnat_slot, ia64_rse_rnat_addr, ia64_rse_num_regs)
   (ia64_rse_skip_regs, ia64_copy_rbs, unw_access_gr)
   (uw_frame_state_for, uw_update_reg_address, uw_update_context)
   (uw_init_context_1, uw_install_context): Likewise.
   (unw_word): Move to unwind-ia64.h

Ok.

r~


Re: [patch, ARM] Implement Neon-optimized version of search_line_fast

2012-03-22 Thread Richard Henderson
On 03/22/12 10:33, Richard Earnshaw wrote:
   * lex.c (search_line_fast): Provide Neon-optimized version for ARM.

Looks good to me.


r~


[wwwdocs] Add link to Git mirror on main page

2012-03-22 Thread Diego Novillo


From a thread on IRC.  We don't have a prominent link to the Git mirror 
and it's becoming one of the favourite ways for people to access the repo.


Gerald, OK for the main page?  I can't seem to be able to preview this 
change locally (dunno how the style.mhtml file gets loaded).



Thanks.  Diego.

Index: style.mhtml
===
RCS file: /cvs/gcc/wwwdocs/htdocs/style.mhtml,v
retrieving revision 1.117
diff -u -d -u -p -r1.117 style.mhtml
--- style.mhtml 25 Apr 2011 20:48:25 -  1.117
+++ style.mhtml 22 Mar 2012 17:58:50 -
@@ -186,6 +186,7 @@
   trtd nav-title-style Live Sources/td/tr
   trtd nav-body-style 
   a href=get-var BACKPATHsvn.htmlSVN read access/abr /
+  a href=http://gcc.gnu.org/wiki/GitMirror;Git read access/abr /
   a href=get-var BACKPATHrsync.htmlRsync read access/abr /
   a href=get-var BACKPATHsvnwrite.htmlSVN write access/abr /
   /td/tr


Re: [C++ Patch] PR 52487

2012-03-22 Thread Jason Merrill

On 03/22/2012 12:58 PM, Paolo Carlini wrote:

Anyway, I also think not calling literal_type_p from check_field_decls
if the type is incomplete is pretty ugly, but I'm not sure which is the
best way to make progress


I guess that's OK.  Just add a comment explaining that we'll get an 
error later.


Jason


Re: remove wrong code in immed_double_const

2012-03-22 Thread Mike Stump
On Mar 22, 2012, at 6:15 AM, Michael Matz wrote:
 That certainly is strictly better than any of the other possibilities, I 
 just didn't get the impression from your second mail to this thread that 
 you were even considering doing that.  Good I was wrong.

All I wanted, was to remove the assert...  The review point was, no, not unless 
you fix the issues so we don't get wrong code-gen and could you make it sign 
extending as well?  So, sure, sounds reasonable to me.  I was going to do the 
work in the end, just didn't plan on doing it today.  Today, tomorrow, not 
worth quibbling over the exact date the work is done.  But, my final point is, 
the assert is wrong, and it has to go, and (almost) gone it is.  :-)  I'm happy.

 I would call it too strict, not wrong.

Do you have users?  Have you ever told them the compiler isn't wrong when it 
ICEs for perfectly valid code?  I've never done that before, and never plan to, 
no one has convinced me it is the right approach.  If you want me to not use 
the term wrong, you'd need to furnish a web site that somehow proves your 
point.  Wrong is what I use when that the compiler does is wrong.  It is that 
simple.  Failing to compile valid code, is wrong.

 Because there are (or were after 
 your fixes get it) values where there was a problem.  Of course that's 
 again just splitting hair about terminology :)

Yeah, I'm not into hair splitting on terminology.  I'm more into actual 
functionality of the compiler to the end user.


Re: remove wrong code in immed_double_const

2012-03-22 Thread Mike Stump
On Mar 22, 2012, at 7:12 AM, Michael Matz wrote:
 I see that you didn't remove the assert as part of this patch.

I'll include that in my next patch.

 I'd like  to see what you like to do to this routine once the rest goes in.  
 In 
 particular I don't think just removing the assert will be enough, at the 
 very least the block comment should be saying something about what the 
 routine exactly does (or doesn't do) for modes where the two HWI arguments 
 can't specify all bits.

I think the best approach is to refine the spec:

/* Return a CONST_DOUBLE or CONST_INT for a value specified as a pair   

  
   of ints: I0 is the low-order word and I1 is the high-order word. 

  
   The value is a signed value, with the high bit of i1 being the sign  

  
   bit.  Do not use this routine for non-integer modes; convert to  

  
   REAL_VALUE_TYPE and use CONST_DOUBLE_FROM_REAL_VALUE.  */

I think this then exactly matches CONST_DOUBLE semantics.


[committed] Fix up __builtin_adjust_template handling in omp parallel/task code (PR middle-end/52547)

2012-03-22 Thread Jakub Jelinek
Hi!

This patch fixes ICE when a nested function is called from within
#pragma omp {parallel,task} region.  We need to put the temporaries
inside of the parallel/task region body, instead of the function body,
as nothing is adding private clauses for them.

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

The usual gotchas of mixing nested functions and OpenMP remain, the
nested functions don't access the privatized copies of variables if any,
so it works as expected only when the nested function accesses shared
variables only.  And non-local goto from the nested functions doesn't
work for various reasons, even fixing just the cfg verification failures
(with cfun-has_nonlocal_label GOMP_parallel_start etc. are all bb enders)
it accesses undefined labels, etc.

2012-03-22  Jakub Jelinek  ja...@redhat.com

PR middle-end/52547
* tree-nested.c (convert_tramp_reference_stmt): Call declare_vars
on any new_local_var_chain vars declared during recursing on
GIMPLE_OMP_PARALLEL or GIMPLE_OMP_TASK body.

* testsuite/libgomp.c/pr52547.c: New test.

--- gcc/tree-nested.c.jj2011-10-12 20:28:20.0 +0200
+++ gcc/tree-nested.c   2012-03-22 13:56:53.704506716 +0100
@@ -1954,6 +1954,7 @@ static tree
 convert_tramp_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
  struct walk_stmt_info *wi)
 {
+  struct nesting_info *info = (struct nesting_info *) wi-info;
   gimple stmt = gsi_stmt (*gsi);
 
   switch (gimple_code (stmt))
@@ -1966,16 +1967,33 @@ convert_tramp_reference_stmt (gimple_stm
for (i = 0; i  nargs; i++)
  walk_tree (gimple_call_arg_ptr (stmt, i), convert_tramp_reference_op,
 wi, NULL);
+   break;
+  }
 
-   *handled_ops_p = true;
-   return NULL_TREE;
+case GIMPLE_OMP_PARALLEL:
+case GIMPLE_OMP_TASK:
+  {
+   tree save_local_var_chain;
+walk_gimple_op (stmt, convert_tramp_reference_op, wi);
+   save_local_var_chain = info-new_local_var_chain;
+   info-new_local_var_chain = NULL;
+walk_body (convert_tramp_reference_stmt, convert_tramp_reference_op,
+  info, gimple_omp_body (stmt));
+   if (info-new_local_var_chain)
+ declare_vars (info-new_local_var_chain,
+   gimple_seq_first_stmt (gimple_omp_body (stmt)),
+   false);
+   info-new_local_var_chain = save_local_var_chain;
   }
+  break;
 
 default:
+  *handled_ops_p = false;
+  return NULL_TREE;
   break;
 }
 
-  *handled_ops_p = false;
+  *handled_ops_p = true;
   return NULL_TREE;
 }
 
--- libgomp/testsuite/libgomp.c/pr52547.c.jj2012-03-22 15:45:15.836421355 
+0100
+++ libgomp/testsuite/libgomp.c/pr52547.c   2012-03-22 15:43:17.0 
+0100
@@ -0,0 +1,36 @@
+/* PR middle-end/52547 */
+/* { dg-do run } */
+
+extern void abort (void);
+
+__attribute__((noinline, noclone)) int
+baz (int *x, int (*fn) (int *))
+{
+  return fn (x);
+}
+
+__attribute__((noinline, noclone)) int
+foo (int x, int *y)
+{
+  int i, e = 0;
+#pragma omp parallel for reduction(|:e)
+  for (i = 0; i  x; ++i)
+{
+  __label__ lab;
+  int bar (int *z) { return z - y; }
+  if (baz (y[i], bar) != i)
+   e |= 1;
+}
+  return e;
+}
+
+int
+main ()
+{
+  int a[100], i;
+  for (i = 0; i  100; i++)
+a[i] = i;
+  if (foo (100, a))
+abort ();
+  return 0;
+}

Jakub


[C++ PATCH] Fix ICE on misplaced attribute (PR c++/52671)

2012-03-22 Thread Jakub Jelinek
Hi!

The recent change to move the warning about misplaced attributes resulted
in ICE on the following testcase.  The problem is that the ENUMERAL_TYPE
doesn't have type lang specific initialized and so
CLASSTYPE_TEMPLATE_INSTANTIATION macro segfaults.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk/4.7.1?

2012-03-22  Jakub Jelinek  ja...@redhat.com

PR c++/52671
* decl.c (check_tag_decl): Only use CLASSTYPE_TEMPLATE_INSTANTIATION
on CLASS_TYPE_P types.

* g++.dg/ext/attrib44.C: New test.

--- gcc/cp/decl.c.jj2012-03-06 17:02:09.0 +0100
+++ gcc/cp/decl.c   2012-03-22 17:20:05.744573734 +0100
@@ -4219,7 +4219,8 @@ check_tag_decl (cp_decl_specifier_seq *d
   if (declspecs-attributes  warn_attributes)
 {
   location_t loc;
-  if (!CLASSTYPE_TEMPLATE_INSTANTIATION (declared_type))
+  if (!CLASS_TYPE_P (declared_type)
+ || !CLASSTYPE_TEMPLATE_INSTANTIATION (declared_type))
/* For a non-template class, use the name location.  */
loc = location_of (declared_type);
   else
--- gcc/testsuite/g++.dg/ext/attrib44.C.jj  2012-03-22 17:41:43.469220822 
+0100
+++ gcc/testsuite/g++.dg/ext/attrib44.C 2012-03-22 17:41:51.784172016 +0100
@@ -0,0 +1,4 @@
+// PR c++/52671
+// { dg-do compile }
+__attribute__ ((deprecated)) enum E { E0 };// { dg-warning attribute 
ignored in declaration of }
+// { dg-message must follow the  { target *-*-* } 3 }

Jakub


Re: [C++ PATCH] Fix ICE on misplaced attribute (PR c++/52671)

2012-03-22 Thread Jason Merrill

OK.

Jason


Re: remove wrong code in immed_double_const

2012-03-22 Thread Mike Stump
On Mar 22, 2012, at 3:16 AM, Richard Sandiford wrote:
 Sorry, meant we should leave the svn version as it is.

Ah, I see now, I agree, I removed that bit (extend in the floating point case) 
of my change from the patch.

 I think this should be s/is smaller than/is different from/.

Sounds good, fixed.

 Should be:
 
   if (add_double_with_sign (l1, h1, l2, h2, lv, hv, false))
 /* Sorry, we have no way to represent overflows this
wide.  To fix, add constant support wider than
CONST_DOUBLE.  */
 gcc_assert (GET_MODE_BITSIZE (mode)  2 * HOST_BITS_PER_WIDE_INT)

As you noted, you do mean:

if (add_double_with_sign (l1, h1, l2, h2, lv, hv, false))
  /* Sorry, we have no way to represent overflows this wide.

  
 To fix, add constant support wider than CONST_DOUBLE.  */
  gcc_assert (GET_MODE_BITSIZE (mode) = 2 * HOST_BITS_PER_WIDE_INT)

Fixed.

 Nitlet, but line is wider than 80 chars.  Probably easiest fix is:
 
 tem = plus_constant_mode (mode, get_pool_constant (XEXP (x, 0)), c);
 tem = force_const_mem (GET_MODE (x), tem);

Fixed.

 +  if (shift  2*HOST_BITS_PER_WIDE_INT-1
 +  || GET_MODE_BITSIZE (mode) = 2*HOST_BITS_PER_WIDE_INT)
 
 Missing spaces around binary operators.

Fixed all instances of 2*HOST and INT-1, there were many, not just this one.  
Some pre-date my patch.

 @@ -1219,15 +1220,10 @@ simplify_const_unary_operation (enum rtx_code code, 
 enum machine_mode mode,
   else
  lv = CONST_DOUBLE_LOW (op),  hv = CONST_DOUBLE_HIGH (op);
 
 -  if (op_mode == VOIDmode)
 -{
 -  /* We don't know how to interpret negative-looking numbers in
 - this case, so don't try to fold those.  */
 -  if (hv  0)
 -return 0;
 -}
 -  else if (GET_MODE_BITSIZE (op_mode) = HOST_BITS_PER_WIDE_INT * 2)
 -;
 +  if (op_mode == VOIDmode
 +  || GET_MODE_BITSIZE (op_mode) = HOST_BITS_PER_WIDE_INT * 2)
 +/* We should never get a negative number.  */
 +gcc_assert (hv = 0);
   else
  hv = 0, lv = GET_MODE_MASK (op_mode);
 
 
 Sorry, with this bit, I meant that the current svn code is correct
 for GET_MODE_BITSIZE (op_mode) == HOST_BITS_PER_WIDE_INT * 2.
 In that case, hv  0 can just mean that we have a uint128_t
 (or whatever) whose high bit happens to be set.

Well, according to the spec, one cannot use CONST_DOUBLE to represent a uint128 
value with the high bit set.  The C frontend type plays this game, but they 
can, because they track the type with the constant the the values of the 
constant are interpreted exclusively in  the context of the type.  Since we 
don't have the unsigned bit, we can't, so, either, they are speced to be values 
on their own, or values dependent upon some external notion.  By changing the 
spec to say sign extending, we mean if the high bit is set, the value is 
negative.  If this is the wrong value for a uint value, then that 
representation cannot be used.  The only solution is to use a different 
representation (CONST_QUAD, CONST_UDOUBLE or something else). 

I'm thought about that routine some more, and it is just totally broken.  I've 
changed the code to:

  /* We should never get a negative number.  */
  gcc_assert (hv = 0);

  if (GET_MODE_PRECISION (op_mode) = HOST_BITS_PER_WIDE_INT)
hv = 0, lv = GET_MODE_MASK (op_mode);

negative numbers are bad, period, this badness, doesn't depend upon anything 
other than the value being negative.  The use of hv = 0, can only be done with 
PRECISIONs less than or equal to HOST_BITS_PER_WIDE_INT.  Wider than this, and 
some of hv would be wiped out, which would be wrong.

Thoughts?

 OK with those changes as far as the RTL optimisations go.

Not quite.  Need to resolve the point just above.  But, yea, we are getting 
very close now.  I'm switched over to a patch for trunk (from 4.6.0) and added 
the ChangeLog.  The switch to GET_MODE_PRECISION above was one change, for 
example.  The rest fit in nicely, the arg to expand_shift was updated slightly 
to match trunk.

 I can't approve the immed_double_const change itself.  Sounds like Richard G 
 would be
 willing though.

I've bundled in the patch that started this all into this version.  I'll look 
forward to his review.

* doc/rtl.texi (const_double): Document as sign-extending.
* expmed.c (expand_mult): Ensure we don't use shift
incorrectly.
* emit-rtl.c (immed_double_int_const): Refine to state the
value is signed.
* simplify-rtx.c (mode_signbit_p): Add a fixme for wider than
CONST_DOUBLE integers.
(simplify_const_unary_operation, UNSIGNED_FLOAT): Ensure no
negative values are converted.  Fix conversions bigger than
HOST_BITS_PER_WIDE_INT.
(simplify_binary_operation_1): Ensure we don't use shift
incorrectly.
  

Re: [committed] Fix up __builtin_adjust_template handling in omp parallel/task code (PR middle-end/52547)

2012-03-22 Thread Richard Henderson
On 03/22/12 12:34, Jakub Jelinek wrote:
 2012-03-22  Jakub Jelinek  ja...@redhat.com
 
   PR middle-end/52547
   * tree-nested.c (convert_tramp_reference_stmt): Call declare_vars
   on any new_local_var_chain vars declared during recursing on
   GIMPLE_OMP_PARALLEL or GIMPLE_OMP_TASK body.
 
   * testsuite/libgomp.c/pr52547.c: New test.

Ok.

r~


Re: [Patch V2] libgfortran: do not assume libm

2012-03-22 Thread Tobias Burnus

Paolo Bonzini wrote:

Il 22/03/2012 09:30, Tristan Gingold ha scritto:

Bootstrapped without gfortran regressions on x86_64-darwin.
Ok for trunk ?

(I will submit a follow-up change in libquadmath once this change is approved).

config/
2012-03-22  Tristan Gingoldging...@adacore.com

* math.m4: New file.

libgfortran/
2012-03-22  Tristan Gingoldging...@adacore.com

* configure.ac: Use GCC_CHECK_MATH_FUNC for math functions.
* acinclude.m4: Include ../config/math.m4
* configure: Regenerate.
* Makefile.in: Regenerate.

Ok.


I have the feeling that you are still waiting for an expliciat gfortran 
approval - however, I think that a build maintainer's okay should be 
sufficient.


Thus, for what it is worth: I believe that patch is okay.

Tobias


[pph] preliminary build support for stdc++.h.pph

2012-03-22 Thread Benjamin De Kosnik

Seems like -fpph doesn't work on the pph branch anymore, and instead
-fpph-gen/-fpph-map/-fpph-hdr are used.

The thing is, how are these flags used?

unhelpful wiki page:
http://gcc.gnu.org/wiki/pph

Based on invoke.texi, I'm expecting something like this:


1. generate
g++ -fpph-gen all.h; 
// generates all.pph

2. use
g++ -fpph-hdr=all.h   foo.cc 
// like -include=all.h, but works with pph files

Is this right? 

-benjamin

2012-03-22  Benjamin Kosnik  b...@redhat.com

* include/Makefile.am (allcreated): Add pph build rule.
(pch1_source): ... to pre_1_source.
(pch2_source): ... to pre_2_source.
(pch3_source): ... to pre_3_source.
(pph_output): New.
(PPH_GEN_FLAGS): New.
* include/Makefile.in: Regenerate.

Index: include/Makefile.am
===
--- include/Makefile.am (revision 185703)
+++ include/Makefile.am (working copy)
@@ -858,7 +858,7 @@
${host_builddir}/gthr-default.h
 
 
-pch1_source = ${glibcxx_srcdir}/include/precompiled/stdc++.h
+pre_1_source = ${glibcxx_srcdir}/include/precompiled/stdc++.h
 pch1_output_builddir = ${host_builddir}/stdc++.h.gch
 pch1_output_anchor = ${host_builddir}/stdc++.h
 pch1_output_installdir = ${host_installdir}/stdc++.h.gch
@@ -866,19 +866,18 @@
 pch1b_output = ${pch1_output_builddir}/O2g.gch
 pch1_output = ${pch1a_output} ${pch1b_output}
 
-pch2_source = ${glibcxx_srcdir}/include/precompiled/stdtr1c++.h
+pre_2_source = ${glibcxx_srcdir}/include/precompiled/stdtr1c++.h
 pch2_output_builddir = ${host_builddir}/stdtr1c++.h.gch
 pch2_output_anchor = ${host_builddir}/stdtr1c++.h
 pch2_output_installdir = ${host_installdir}/stdtr1c++.h.gch
 pch2_output = ${pch2_output_builddir}/O2g.gch
 
-pch3_source = ${glibcxx_srcdir}/include/precompiled/extc++.h
+pre_3_source = ${glibcxx_srcdir}/include/precompiled/extc++.h
 pch3_output_builddir = ${host_builddir}/extc++.h.gch
 pch3_output_anchor = ${host_builddir}/extc++.h
 pch3_output_installdir = ${host_installdir}/extc++.h.gch
 pch3_output = ${pch3_output_builddir}/O2g.gch
 
-
 pch_output = ${pch1_output} ${pch2_output} ${pch3_output}
 pch_output_dirs = \
${pch1_output_builddir} ${pch2_output_builddir}
${pch3_output_builddir} @@ -891,6 +890,9 @@
 pch_build =
 endif
 
+pph_output = ${host_builddir}/stdc++.h.pph
+PPH_GEN_FLAGS = -x c++-header -nostdinc++ -fpph-gen
+
 # List of all timestamp files.  By keeping only one copy of this list,
both # CLEANFILES and all-local are kept up-to-date.
 allstamped = \
@@ -904,7 +906,8 @@
 allcreated = \
${host_builddir}/c++config.h \
${thread_host_headers} \
-   ${pch_build}
+   ${pch_build} \
+   ${pph_output}
 
 # Here are the rules for building the headers
 all-local: ${allstamped} ${allcreated}
@@ -1153,25 +1156,30 @@
 $  $@
 
 # Build two precompiled C++ includes, stdc++.h.gch/*.gch
-${pch1a_output}: ${allstamped} ${host_builddir}/c++config.h
${pch1_source} +${pch1a_output}: ${allstamped}
${host_builddir}/c++config.h ${pre_1_source} -mkdir -p
${pch1_output_builddir}
-   $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g -std=gnu++0x
${pch1_source} \
+   $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g -std=gnu++0x
${pre_1_source} \ -o $@
 
-${pch1b_output}: ${allstamped} ${host_builddir}/c++config.h
${pch1_source} +${pch1b_output}: ${allstamped}
${host_builddir}/c++config.h ${pre_1_source} -mkdir -p
${pch1_output_builddir}
-   $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch1_source} -o $@
+   $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pre_1_source} -o $@
 
 # Build a precompiled TR1 include, stdtr1c++.h.gch/O2.gch
-${pch2_output}: ${pch2_source} ${pch1_output}
+${pch2_output}: ${pre_2_source} ${pch1_output}
-mkdir -p ${pch2_output_builddir}
-   $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch2_source} -o $@
+   $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pre_2_source} -o $@
 
 # Build a precompiled extension include, extc++.h.gch/O2.gch
-${pch3_output}: ${pch3_source} ${pch2_output}
+${pch3_output}: ${pre_3_source} ${pch2_output}
-mkdir -p ${pch3_output_builddir}
-   $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
+   $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pre_3_source} -o $@
 
+# Build a preprocessed C++ include stdc++.h.pph
+pph: ${pph_output}
+${pph_output}: ${allstamped} ${host_builddir}/c++config.h
${pre_1_source}
+   $(CXX) $(PPH_GEN_FLAGS) $(AM_CPPFLAGS) -O2 -g ${pre_1_source}
-o $@ +
 # For robustness sake (in light of junk files or in-source
 # configuration), copy from the build or source tree to the install
 # tree using only the human-maintained file lists and directory
@@ -1291,7 +1299,7 @@
  $(INSTALL_DATA) $${file} $(DESTDIR)${host_installdir}; done
 
 # By adding these files here, automake will remove them for 'make
clean' -CLEANFILES = ${pch_output} ${pch_output_anchors} stamp-host
+CLEANFILES = ${pch_output} 

Re: [fixincludes] Fix pthread.h failure (PR other/52626)

2012-03-22 Thread Bruce Korb



Rather simple...  In a file called fixinclude.sum, put

   PASS: unique string

or

   FAIL: unique string

one per line,

Bonus points if you can total passes and failures:


I think you just put it into the check template so it creates the result.
Since multiple fixes tweak the same file, there really isn't a way to
figure out what has passed.  You can only figure out what has failed.
So, let's just call it one test.

+fix_sum_fmt='%s: fixincludes
+
+# of expected passes1
+# of expected failures  0
+# of unexpected failures%s\n'

Do I get the bonus points? :D
Index: check.tpl
===
--- check.tpl	(revision 184997)
+++ check.tpl	(working copy)
@@ -25,7 +25,7 @@
 
 rm -rf ${DESTDIR} ${SRCDIR}
 mkdir ${DESTDIR} ${SRCDIR}
-(
+{
 [=
   (shellf
 for f in %s
@@ -36,7 +36,7 @@
  while read g
  do echo \  mkdir \\${SRCDIR}/$g || mkdir -p \\${SRCDIR}/$g || exit 1\
  done (join   (stack fix.files))  ) =]
-) 2 /dev/null[= # suppress 'No such file or directory' messages =]
+} 2 /dev/null[= # suppress 'No such file or directory' messages =]
 cd inc
 [=
 (define sfile )
@@ -114,29 +114,21 @@
 sed 's/\(#define __[A-Z_]*_TYPE__\).*/\1/' sys/types.h  XX
 mv -f XX sys/types.h
 
-#  The following subshell weirdness is for saving an exit
-#  status from within a while loop that reads input.  If you can
-#  think of a cleaner way, suggest away, please...
-#
-exitok=`
 exec  ${TESTDIR}/LIST
 while read f
 do
   if [ ! -f ${TESTBASE}/$f ]
   then
-echo Newly fixed header:  $f 2
-exitok=false
+echo FAIL: Newly fixed header:  $f 2
 
-  elif cmp $f ${TESTBASE}/$f 2
+  elif cmp $f ${TESTBASE}/$f
   then
 :
 
   else
-${DIFF:-diff} -c $f ${TESTBASE}/$f 2 || :
-exitok=false
+${DIFF:-diff} -c $f ${TESTBASE}/$f
   fi
-done
-echo $exitok`
+done  FAILURES.txt
 
 cd $TESTBASE
 
@@ -144,30 +136,36 @@
 fgrep -v 'CVS/' | \
 fgrep -v '.svn/'  ${TESTDIR}/LIST
 
-exitok=`
 exec  ${TESTDIR}/LIST
 while read f
 do
   if [ -s $f ]  [ ! -f ${DESTDIR}/$f ]
   then
-echo Missing header fix:  $f 2
-exitok=false
+echo FAIL: Missing header fix:  $f
   fi
-done
-echo $exitok`
+done  ${DESTDIR}/FAILURES.txt
+
+fix_sum_fmt='%s: fixincludes
+
+# of expected passes1
+# of expected failures  0
+# of unexpected failures%s\n'
 
 echo
-if $exitok
+if test -s ${DESTDIR}/FAILURES.txt
 then
-  cd ${TESTDIR}
-  rm -rf inc res LIST
-  cd ..
-  rmdir ${TESTDIR}  /dev/null 21 || :
-  echo All fixinclude tests pass 2
-else
-  echo There were fixinclude test FAILURES  2
-fi
-$exitok[=
+  echo There were fixinclude test FAILURES
+  cat ${DESTDIR}/FAILURES.txt
+  printf $fix_sum_fmt FAIL 1  ${DESTDIR}/fixincludes.sum
+  exit 1
+fi  2
+
+printf $fix_sum_fmt PASS 0  ${DESTDIR}/fixincludes.sum
+cd ${TESTDIR}
+rm -rf inc res LIST
+cd ..
+rmdir ${TESTDIR}  /dev/null 21 || :
+echo All fixinclude tests pass 2[=
 
 (if (defined? 'set-writable) (set-writable))
 


Re: [pph] preliminary build support for stdc++.h.pph

2012-03-22 Thread Lawrence Crowl
On 3/22/12, Benjamin De Kosnik b...@redhat.com wrote:
 Seems like -fpph doesn't work on the pph branch anymore, and
 instead -fpph-gen/-fpph-map/-fpph-hdr are used.

 The thing is, how are these flags used?

-fpph-map=basename

   Enable reading PPH files, and instead of reading #include
   basename.h, read basename.pph.

-fpph-map=mapfile

   Enable reading pph files, and supply a file of mappings from
   #include directives to PPH file.  The file format is a sequence
   of lines, each with header and PPH file separated by a tab.

-fpph-gen whatever.h -o whatever.pph

  The -fpph-gen flag says a header is being compiled and a pph file
  should be generated.

 unhelpful wiki page:
 http://gcc.gnu.org/wiki/pph

Zero user documentation.  Hasn't been updated in a while.

 Based on invoke.texi, I'm expecting something like this:

 1. generate
 g++ -fpph-gen all.h;
 // generates all.pph

Add -o.

 2. use
 g++ -fpph-hdr=all.h   foo.cc
 // like -include=all.h, but works with pph files

No, that flag doesn't cause any input in and of itself.  It just
causes the #include to read a different file.

 Is this right?

Some notes below.  The main problem is that users would need to

  #include precompiled/stdc++.h

and the compiler would need to provide an implicit mapping.

We could probably modify -include to pick up PPH files, but that
wasn't in our use model.

So, it turns out that the hardest files for PPH to deal with are
system headers and C++ standard headers.  There are some headers
that we do not yet handle right, among others, the atomics header
is causing us grief.  That header gets include in others and thus
infects the others.

I think your use is ahead of the implementation, and maybe now is
not the time to work on integrating it into the build.


 -benjamin

 2012-03-22  Benjamin Kosnik  b...@redhat.com

   * include/Makefile.am (allcreated): Add pph build rule.
   (pch1_source): ... to pre_1_source.
   (pch2_source): ... to pre_2_source.
   (pch3_source): ... to pre_3_source.
   (pph_output): New.
   (PPH_GEN_FLAGS): New.
   * include/Makefile.in: Regenerate.

 Index: include/Makefile.am
 ===
 --- include/Makefile.am   (revision 185703)
 +++ include/Makefile.am   (working copy)
 @@ -858,7 +858,7 @@
   ${host_builddir}/gthr-default.h


 -pch1_source = ${glibcxx_srcdir}/include/precompiled/stdc++.h
 +pre_1_source = ${glibcxx_srcdir}/include/precompiled/stdc++.h
  pch1_output_builddir = ${host_builddir}/stdc++.h.gch
  pch1_output_anchor = ${host_builddir}/stdc++.h
  pch1_output_installdir = ${host_installdir}/stdc++.h.gch
 @@ -866,19 +866,18 @@
  pch1b_output = ${pch1_output_builddir}/O2g.gch
  pch1_output = ${pch1a_output} ${pch1b_output}

 -pch2_source = ${glibcxx_srcdir}/include/precompiled/stdtr1c++.h
 +pre_2_source = ${glibcxx_srcdir}/include/precompiled/stdtr1c++.h
  pch2_output_builddir = ${host_builddir}/stdtr1c++.h.gch
  pch2_output_anchor = ${host_builddir}/stdtr1c++.h
  pch2_output_installdir = ${host_installdir}/stdtr1c++.h.gch
  pch2_output = ${pch2_output_builddir}/O2g.gch

 -pch3_source = ${glibcxx_srcdir}/include/precompiled/extc++.h
 +pre_3_source = ${glibcxx_srcdir}/include/precompiled/extc++.h
  pch3_output_builddir = ${host_builddir}/extc++.h.gch
  pch3_output_anchor = ${host_builddir}/extc++.h
  pch3_output_installdir = ${host_installdir}/extc++.h.gch
  pch3_output = ${pch3_output_builddir}/O2g.gch

 -
  pch_output = ${pch1_output} ${pch2_output} ${pch3_output}
  pch_output_dirs = \
   ${pch1_output_builddir} ${pch2_output_builddir}
 ${pch3_output_builddir} @@ -891,6 +890,9 @@
  pch_build =
  endif

 +pph_output = ${host_builddir}/stdc++.h.pph
 +PPH_GEN_FLAGS = -x c++-header -nostdinc++ -fpph-gen
 +

The -x flag is not needed.

  # List of all timestamp files.  By keeping only one copy of this list,
 both # CLEANFILES and all-local are kept up-to-date.
  allstamped = \
 @@ -904,7 +906,8 @@
  allcreated = \
   ${host_builddir}/c++config.h \
   ${thread_host_headers} \
 - ${pch_build}
 + ${pch_build} \
 + ${pph_output}

  # Here are the rules for building the headers
  all-local: ${allstamped} ${allcreated}
 @@ -1153,25 +1156,30 @@
$  $@

  # Build two precompiled C++ includes, stdc++.h.gch/*.gch
 -${pch1a_output}: ${allstamped} ${host_builddir}/c++config.h
 ${pch1_source} +${pch1a_output}: ${allstamped}
 ${host_builddir}/c++config.h ${pre_1_source} -mkdir -p
 ${pch1_output_builddir}
 - $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g -std=gnu++0x
 ${pch1_source} \
 + $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g -std=gnu++0x
 ${pre_1_source} \ -o $@

 -${pch1b_output}: ${allstamped} ${host_builddir}/c++config.h
 ${pch1_source} +${pch1b_output}: ${allstamped}
 ${host_builddir}/c++config.h ${pre_1_source} -mkdir -p
 ${pch1_output_builddir}
 - $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch1_source} -o $@
 + $(CXX) 

[wwdocs] update libstdc++ docs, links

2012-03-22 Thread Benjamin De Kosnik

Small filename tweaks to gcc's docs page for the generated 4.7.0
libstdc++ docs.

-benjamin2012-03-22  Benjamin Kosnik  b...@redhat.com

* htdocs/onlinedocs/index.html: Adjust libstdc++ xml file names.

Index: htdocs/onlinedocs/index.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/onlinedocs/index.html,v
retrieving revision 1.124
diff -c -p -3 -r1.124 index.html
*** htdocs/onlinedocs/index.html	22 Mar 2012 09:34:50 -	1.124
--- htdocs/onlinedocs/index.html	22 Mar 2012 23:26:43 -
***
*** 64,77 
   4.7.0 Standard C++ Library Manual /a (a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/libstdc++-manual.pdf.bz2;also
   in PDF/a or a
!  href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/libstdc++-manual-single.xml.bz2;XML/a or a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/libstdc++-manual-html.tar.bz2;an
   HTML tarball/a)/li
  lia href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/api/;GCC
   4.7.0 Standard C++ Library Reference Manual /a (a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/libstdc++-api.pdf.bz2;also
   in PDF/a or a
!  href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/libstdc++-api-single.xml.bz2;XML/a or a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/libstdc++-api-html.tar.bz2;an
   HTML tarball/a)/li
  lia href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gccgo/;GCCGO 4.7.0 Manual/a (a
--- 64,77 
   4.7.0 Standard C++ Library Manual /a (a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/libstdc++-manual.pdf.bz2;also
   in PDF/a or a
!  href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/libstdc++-manual.xml.bz2;XML/a or a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/libstdc++-manual-html.tar.bz2;an
   HTML tarball/a)/li
  lia href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/api/;GCC
   4.7.0 Standard C++ Library Reference Manual /a (a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/libstdc++-api.pdf.bz2;also
   in PDF/a or a
!  href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/libstdc++-api.xml.bz2;XML/a or a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/libstdc++/libstdc++-api-html.tar.bz2;an
   HTML tarball/a)/li
  lia href=http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gccgo/;GCCGO 4.7.0 Manual/a (a
***
*** 147,160 
   4.6.3 Standard C++ Library Manual /a (a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/libstdc++-manual.pdf.bz2;also
   in PDF/a or a
!  href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/libstdc++-manual-single.xml.bz2;XML/a or a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/libstdc++-manual-html.tar.bz2;an
   HTML tarball/a)/li
  lia href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/api/;GCC
   4.6.3 Standard C++ Library Reference Manual /a (a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/libstdc++-api.pdf.bz2;also
   in PDF/a or a
!  href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/libstdc++-api-single.xml.bz2;XML/a or a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/libstdc++-api-html.tar.bz2;an
   HTML tarball/a)/li
  lia href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/gccgo/;GCCGO 4.6.3 Manual/a (a
--- 147,160 
   4.6.3 Standard C++ Library Manual /a (a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/libstdc++-manual.pdf.bz2;also
   in PDF/a or a
!  href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/libstdc++-manual.xml.bz2;XML/a or a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/libstdc++-manual-html.tar.bz2;an
   HTML tarball/a)/li
  lia href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/api/;GCC
   4.6.3 Standard C++ Library Reference Manual /a (a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/libstdc++-api.pdf.bz2;also
   in PDF/a or a
!  href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/libstdc++-api.xml.bz2;XML/a or a
   href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/libstdc++-api-html.tar.bz2;an
   HTML tarball/a)/li
  lia href=http://gcc.gnu.org/onlinedocs/gcc-4.6.3/gccgo/;GCCGO 4.6.3 Manual/a (a
2012-03-22  Benjamin Kosnik  b...@redhat.com

* htdocs/onlinedocs/index.html: Adjust libstdc++ html index.

Index: htdocs/onlinedocs/index.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/onlinedocs/index.html,v
retrieving revision 1.125
diff -c -p -3 -r1.125 index.html
*** htdocs/onlinedocs/index.html	22 Mar 2012 23:30:02 -	1.125
--- htdocs/onlinedocs/index.html	22 

[pph] Distinguish template type parameters. (issue5881052)

2012-03-22 Thread Lawrence Crowl
This patch addresses the problem of two template instantiations
appearing to be identical.  They differ in TEMPLATE_PARM_NUM_SIBLINGS,
and so that information needs to be pushed out to the template merge
name.

Test x1tmpldfltparm.cc is now passing the assert, though it has
unneeded functions emitted.

Tested on x64.


Index: gcc/testsuite/ChangeLog.pph

2012-03-22   Lawrence Crowl  cr...@google.com

* g++.dg/pph/x1tmpldfltparm.cc: Failure change from merging to excess
code generation.

Index: gcc/cp/ChangeLog.pph

2012-03-22   Diego Novillo  dnovi...@google.com

* error.c (dump_location_qualifier):  Add qualifier using
TEMPLATE_PARM_NUM_SIBLINGS.  Rename to dump_tmpl_type_parm_qualifier.
(dump_tmpl_type_parm_qualifier): Renamed from above.
(dump_type): Change call of dump_location_qualifier to
dump_tmpl_type_parm_qualifier.
* pt.c (pph_out_pending_templates_list):  Add more debugging output.
(pph_in_pending_templates_list):  Move debugging output.
(pph_out_spec_entry_htab):  Add more debugging output.
* parser.c (cp_debug_parser_where):  Fix comment.
(cp_debug_the_parser_where):  New.
* parser.h (cp_debug_the_parser_where): New.


Index: gcc/testsuite/g++.dg/pph/x1tmpldfltparm.cc
===
--- gcc/testsuite/g++.dg/pph/x1tmpldfltparm.cc  (revision 185539)
+++ gcc/testsuite/g++.dg/pph/x1tmpldfltparm.cc  (working copy)
@@ -1,5 +1,5 @@
-// { dg-xfail-if DEFAULT TEMPLATE ARG MERGING { *-*-* } { 
-fpph-map=pph.map } }
-// { dg-bogus Trying to merge distinct trees from the same PPH image 
x0tmpldfltparm.pph  { xfail *-*-* } 0 }
+// {xfail-if EXCESS FUNCTIONS { *-*-* } { -fpph-map=pph.map } }
+// pph asm xdiff 53613
 
 #include x0tmpldfltparm.h
 
Index: gcc/cp/error.c
===
--- gcc/cp/error.c  (revision 185539)
+++ gcc/cp/error.c  (working copy)
@@ -351,24 +351,30 @@ dump_alias_template_specialization (tree
 }
 
 
-/* Dump a location of a DECL as a qualifier, depending on FLAGS.  */
+/* Dump a discriminating qualifier for a template type parameter,
+   depending on FLAGS.  */
 
 static void
-dump_location_qualifier (tree decl, int flags)
+dump_tmpl_type_parm_qualifier (tree type, int flags)
 {
 if (flags  TFF_LOC_FOR_TEMPLATE_PARMS)
   {
+tree decl = TYPE_NAME (type);
 expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (decl));
-char *buffer = (char*)xmalloc (strlen (xloc.file) + 46);
+char *buffer = (char*)xmalloc (strlen (xloc.file) + 60);
+tree tmv = TYPE_MAIN_VARIANT (type);
+tree tpi = TEMPLATE_TYPE_PARM_INDEX (tmv);
+unsigned int sib = TEMPLATE_PARM_NUM_SIBLINGS (tpi);
 if (xloc.column != 0)
-  sprintf (buffer, `%s:%d:%d`, xloc.file, xloc.line, xloc.column);
+  sprintf (buffer, `%s:%d:%d#%d`, xloc.file, xloc.line, xloc.column, 
sib);
 else
-  sprintf (buffer, `%s:%d`, xloc.file, xloc.line);
+  sprintf (buffer, `%s:%d#%d`, xloc.file, xloc.line, sib);
 pp_cxx_ws_string (cxx_pp, buffer);
 free (buffer);
   }
 }
 
+
 /* Dump a human-readable equivalent of TYPE.  FLAGS controls the
format.  */
 
@@ -488,7 +494,7 @@ dump_type (tree t, int flags)
if (decl)
  {
tree ident = DECL_NAME (decl);
-   dump_location_qualifier (decl, flags);
+   dump_tmpl_type_parm_qualifier (t, flags);
if (ident)
  pp_cxx_tree_identifier (cxx_pp, ident);
else
Index: gcc/cp/pt.c
===
--- gcc/cp/pt.c (revision 185539)
+++ gcc/cp/pt.c (working copy)
@@ -3546,6 +3546,7 @@ reduce_template_parm_level (tree index, 
   return TEMPLATE_PARM_DESCENDANTS (index);
 }
 
+
 /* Process information from new template parameter PARM and append it
to the LIST being built.  This new parameter is a non-type
parameter iff IS_NON_TYPE is true. This new parameter is a
@@ -20728,6 +20729,9 @@ pph_out_pending_templates_list (pph_stre
   for (cur = pending_templates; cur != NULL;  cur = cur-next )
 ++count;
 
+  if (flag_pph_debug = 2)
+fprintf (pph_logfile, PPH: writing %d pending templates\n, count );
+
   /* Now emit them.  */
   pph_out_uint (stream, count);
   for (cur = pending_templates; cur != NULL;  cur = cur-next )
@@ -20740,11 +20744,13 @@ static void
 pph_in_pending_templates_list (pph_stream *stream)
 { 
   unsigned count = pph_in_uint (stream);
+
+  if (flag_pph_debug = 2)
+fprintf (pph_logfile, PPH: loading %d pending templates\n, count );
+
   for (; count  0; --count)
 {
   struct pending_template *pt;
-  if (flag_pph_debug = 2)
-fprintf (pph_logfile, PPH: loading %d pending templates\n, count );
   pt = ggc_alloc_pending_template ();
   pt-next = NULL;
   pt-tinst = pph_in_tinst_level (stream);
@@ -20794,8 +20800,11 @@ pph_out_spec_entry_htab 

[v3] doc xml output names

2012-03-22 Thread Benjamin De Kosnik

Simple rename for XML filenames. The -single can be omitted.

tested x86/linux

-benjamin2012-03-22  Benjamin Kosnik  b...@redhat.com

	* doc/Makefile.am: XML output names have only .xml suffix.
	* doc/Makefile.in: Regenerate.

diff --git a/libstdc++-v3/doc/Makefile.am b/libstdc++-v3/doc/Makefile.am
index 0f7b285..95d8513 100644
--- a/libstdc++-v3/doc/Makefile.am
+++ b/libstdc++-v3/doc/Makefile.am
@@ -1,6 +1,6 @@
 ## Makefile for the doc subdirectory of the GNU C++ Standard library.
 ##
-## Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+## Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 ##
 ## This file is part of the libstdc++ version 3 distribution.
 ## Process this file with automake to produce Makefile.in.
@@ -206,7 +206,7 @@ doc-install-epub: doc-epub
 # Assumes doxygen, graphviz (with dot), pdflatex installed
 doxygen_script=${top_srcdir}/scripts/run_doxygen
 doxygen_outdir = ${glibcxx_builddir}/doc/doxygen
-api_xml = ${doxygen_outdir}/xml/libstdc++-api-single.xml
+api_xml = ${doxygen_outdir}/xml/libstdc++-api.xml
 doxygen_pdf = ${doxygen_outdir}/latex/refman.pdf
 api_pdf = ${doxygen_outdir}/pdf/libstdc++-api.pdf
 
@@ -505,8 +505,8 @@ doc-xml-validate-docbook: $(xml_sources) $(xml_images)
 # XML, all one page
 # Some info on canonicalization
 # http://www.mail-archive.com/help-texinfo@gnu.org/msg00864.html
-manual_xml = ${docbook_outdir}/xml/libstdc++-manual-single.xml
-set_xml = ${docbook_outdir}/xml/libstdc++-set-single.xml
+manual_xml = ${docbook_outdir}/xml/libstdc++-manual.xml
+set_xml = ${docbook_outdir}/xml/libstdc++-set.xml
 stamp-xml-single-docbook: $(xml_sources) ${docbook_outdir}/xml
 	@echo Generating XML single...
 	$(XMLLINT) $(XMLLINT_FLAGS) \


Re: [fixincludes] Fix pthread.h failure (PR other/52626)

2012-03-22 Thread Mike Stump
On Mar 22, 2012, at 3:40 PM, Bruce Korb wrote:
 You can only figure out what has failed.

Life goes on

 Do I get the bonus points?

make check

and cat fixincludes.sum

is necessary to get the bonus points.  :-)  Looks fine from what I can see.


[tpf] update for latest build system

2012-03-22 Thread DJ Delorie

Per request from IBM...

* config/s390/s390.h (LINK_SPEC): Remove, no longer needed.
(LIBSTDCXX): Change to CPP2.

Index: config/s390/tpf.h
===
--- config/s390/tpf.h   (revision 185677)
+++ config/s390/tpf.h   (working copy)
@@ -1,9 +1,9 @@
 /* Definitions for target OS TPF for GNU compiler, for IBM S/390 hardware
Copyright (C) 2003, 2004, 2005, 2007, 2009,
-   2010, 2011 Free Software Foundation, Inc.
+   2010, 2011, 2012 Free Software Foundation, Inc.
Contributed by P.J. Darcy (darc...@us.ibm.com),
   Hartmut Penner (hpen...@de.ibm.com), and
   Ulrich Weigand (uweig...@de.ibm.com).
 
 This file is part of GCC.
 
@@ -92,18 +92,12 @@ along with GCC; see the file COPYING3.  
 #define CPLUSPLUS_CPP_SPEC -D_GNU_SOURCE %(cpp)
 
 #undef ASM_SPEC
 #define ASM_SPEC %{m31m64}%{mesamzarch}%{march=*} \
   -alshd=%b.lst
 
-/* It would be nice to get the system linker script define the ones that it
-   needed.  */
-#undef LIB_SPEC
-#define LIB_SPEC -lCTIS -lCISO -lCLBM -lCTAL -lCFVS -lCTBX -lCTXO \
-  -lCJ00 -lCTDF -lCOMX -lCOMS -lCTHD -lCTAD -lTPFSTUB
-
 #undef TARGET_C99_FUNCTIONS
 #define TARGET_C99_FUNCTIONS 1
 
 #define ENTRY_SPEC %{mmain:-entry=_start} \
 %{!mmain:-entry=0}
 
@@ -117,8 +111,8 @@ along with GCC; see the file COPYING3.  
%{shared: -shared} \
%{!shared:-shared} \
%(entry_spec)
 
 /* IBM copies these libraries over with these names.  */
 #define MATH_LIBRARY CLBM
-#define LIBSTDCXX CPP1
+#define LIBSTDCXX CPP2
 #endif /* ! _TPF_H */


Re: [C++ Patch] PR 52487

2012-03-22 Thread Paolo Carlini

On 03/22/2012 07:28 PM, Jason Merrill wrote:

On 03/22/2012 12:58 PM, Paolo Carlini wrote:

Anyway, I also think not calling literal_type_p from check_field_decls
if the type is incomplete is pretty ugly, but I'm not sure which is the
best way to make progress
I guess that's OK.  Just add a comment explaining that we'll get an 
error later.

Done: I applied the below to mainline and 4_7-branch.

Thanks!
Paolo.

///
/cp
2012-03-22  Paolo Carlini  paolo.carl...@oracle.com

PR c++/52487
* class.c (check_field_decls): Call literal_type_p only
on complete types.

/testsuite
2012-03-22  Paolo Carlini  paolo.carl...@oracle.com

PR c++/52487
* g++.dg/cpp0x/lambda/lambda-ice7.C: New.
Index: testsuite/g++.dg/cpp0x/lambda/lambda-ice7.C
===
--- testsuite/g++.dg/cpp0x/lambda/lambda-ice7.C (revision 0)
+++ testsuite/g++.dg/cpp0x/lambda/lambda-ice7.C (revision 0)
@@ -0,0 +1,9 @@
+// PR c++/52487
+// { dg-options -std=c++0x }
+
+struct A; // { dg-error forward declaration }
+
+void foo(A a)
+{
+  [=](){a;};  // { dg-error invalid use of incomplete type }
+}
Index: cp/class.c
===
--- cp/class.c  (revision 185715)
+++ cp/class.c  (working copy)
@@ -3149,8 +3149,9 @@ check_field_decls (tree t, tree *access_decls,
CLASSTYPE_NON_AGGREGATE (t) = 1;
 
   /* If at least one non-static data member is non-literal, the whole
- class becomes non-literal.  */
-  if (!literal_type_p (type))
+ class becomes non-literal.  Note: if the type is incomplete we
+will complain later on.  */
+  if (COMPLETE_TYPE_P (type)  !literal_type_p (type))
 CLASSTYPE_LITERAL_P (t) = false;
 
   /* A standard-layout class is a class that:


Re: [PATCH] Bug fix in store_bit_field_1 for big endian targets (issue 51893)

2012-03-22 Thread Alan Modra
On Wed, Mar 21, 2012 at 10:53:07PM +0100, Eric Botcazou wrote:
  This patch (for 4.6) fixes a wrong subword index computation in
  store_bit_field_1 for big endian targets when value is at least 4 times
  bigger than a word (DI REG value with HI words).
 
  It fixes a regression on gcc.c-torture/execute/bitfld-3.c for my current
  backend port.
 
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51893
 
  OK to commit?
 
 It is OK for mainline on principle but there is no ChangeLog entry and the 
 patch doesn't follow the GNU Coding Style: TABs instead of spaces, spaces 
 before parentheses, etc.  See the equivalent code in extract_bit_field_1.
 Moreover you need to properly test it on a mainstream big-endian platform.

Passes bootstrap and regression test powerpc64-linux.

-- 
Alan Modra
Australia Development Lab, IBM