RE: [wwwdocs] Document ARM/embedded-x_y-branch family

2012-07-16 Thread Terry Guo


> -Original Message-
> From: Gerald Pfeifer [mailto:ger...@pfeifer.com]
> Sent: Monday, July 16, 2012 8:10 AM
> To: Terry Guo
> Cc: Joey Ye; gcc-patches@gcc.gnu.org
> Subject: Re: [wwwdocs] Document ARM/embedded-x_y-branch family
> 
> Hi Terry,
> 
> On Mon, 9 Jul 2012, Terry Guo wrote:
> > As it becomes our long term goal to deliver arm-none-eabi tool chain
> > based on GCC 4.6/4.7/4.8 and future branches, I am going to use the
> > following pattern to document this branch family. Is it ok to commit?
> 
> yep, this looks good (and sorry for somehow missing this at first).
> 
> The only question I'd have, that may make sense addressing in the
> description, is "What kind of changes to you expect to take there,
> but not the corresponding release branches? And why?"
> 

Hi Gerald,

Thanks for your comments. I updated the description to address this concern.
Is it OK?

BR,
Terry

Index: htdocs/svn.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/svn.html,v
retrieving revision 1.174
diff -u -d -p -r1.174 svn.html
--- htdocs/svn.html 8 Jun 2012 10:39:57 -   1.174
+++ htdocs/svn.html 17 Jul 2012 01:38:51 -
@@ -523,14 +523,15 @@ be prefixed with the initials of the dis
   coordinate work with others.  This branch is maintained by the folks
   at Apple.  Previous branch was apple-ppc-branch.
 
-  ARM/embedded-4_6-branch
-  This branch provides bug-fixes, minor enhancements and stability
-  fixes for GCC 4.6.x when used with ARM's embedded cores, such as
-  the Cortex-R and Cortex-M processors.  It will sync with upstream
-  GCC 4.6 branch regularly.  Most patches will be back-ports of changes 
-  already made on trunk.  Patches should be marked with the
-  tag [arm-embedded] in the subject line.  The branch is
-  maintained by personnel from ARM.
+  ARM/embedded-x_y-branch
+  These branches provide bug-fixes, minor enhancements and stability
+  fixes for GCC x.y branches when used with ARM's embedded cores,
+  such as the Cortex-R and Cortex-M processors.  Most patches will be
+  limited ARM specific or common back-ports from trunk, unlike the current
+  release branches.  Very occasionally these branches will hold patches
+  that are waiting for trunk acceptance.  Patches for these branches should
+  be marked with the tag [arm-embedded] in the subject line.
+  This family of branches is maintained by personnel from ARM.
 
   csl-3_3_1-branch
   CodeSourcery release based on GCC 3.3.1.




Re: [v3] PR 53270 fix hppa-linux bootstrap regression

2012-07-16 Thread Jonathan Wakely
On 16 July 2012 22:48, Jonathan Wakely wrote:
> On 7 July 2012 18:16, Jonathan Wakely wrote:
>>
>> My preference is (1) for 4.7 and (4) for 4.6 but the changes are not
>> ones I feel comfortable making on release branches without other
>> opinions.  Please comment :-)
>
> No comments?
>
> Then I'm going for my preferences as stated above.

PR libstdc++/53270
* include/ext/concurrence.h (__mutex, __recursive_mutex, __cond): Use
NSDMI in C++98 mode too.
* include/ext/rope: Add system_header pragma.
(_Refcount_Base, _Rope_RopeRep): Use NSDMI.
(_Rope_RopeRep::~_Rope_RopeRep): Destroy mutex.

Tested x86_64-linux. Committed to trunk.
commit 68d45f18ff7020c3eaeddf8d6e3c198a02891ada
Author: Jonathan Wakely 
Date:   Sat Jul 7 14:40:43 2012 +0100

PR libstdc++/53270
* include/ext/concurrence.h (__mutex, __recursive_mutex, __cond): Use
NSDMI in C++98 mode too.
* include/ext/rope: Add system_header pragma.
(_Refcount_Base, _Rope_RopeRep): Use NSDMI.
(_Rope_RopeRep::~_Rope_RopeRep): Destroy mutex.

diff --git a/libstdc++-v3/include/ext/concurrence.h 
b/libstdc++-v3/include/ext/concurrence.h
index 25e218b..ad02839 100644
--- a/libstdc++-v3/include/ext/concurrence.h
+++ b/libstdc++-v3/include/ext/concurrence.h
@@ -1,7 +1,6 @@
 // Support for concurrent programing -*- C++ -*-
 
-// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2003-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -143,8 +142,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   class __mutex 
   {
   private:
-#if __GTHREADS && defined __GTHREAD_MUTEX_INIT \
-&& defined __GXX_EXPERIMENTAL_CXX0X__
+#if __GTHREADS && defined __GTHREAD_MUTEX_INIT
 __gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT;
 #else
 __gthread_mutex_t _M_mutex;
@@ -156,19 +154,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   public:
 __mutex() 
 { 
-#if __GTHREADS
+#if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT
   if (__gthread_active_p())
-   {
-#if defined __GTHREAD_MUTEX_INIT
-# ifndef __GXX_EXPERIMENTAL_CXX0X__
- __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
- _M_mutex = __tmp;
-# endif
-#else
- __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); 
+   __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
 #endif
-   }
-#endif 
 }
 
 #if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT
@@ -208,8 +197,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   class __recursive_mutex 
   {
   private:
-#if __GTHREADS && defined __GTHREAD_RECURSIVE_MUTEX_INIT \
-&& defined __GXX_EXPERIMENTAL_CXX0X__
+#if __GTHREADS && defined __GTHREAD_RECURSIVE_MUTEX_INIT
 __gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT;
 #else
 __gthread_recursive_mutex_t _M_mutex;
@@ -221,19 +209,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   public:
 __recursive_mutex() 
 { 
-#if __GTHREADS
+#if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT
   if (__gthread_active_p())
-   {
-#if defined __GTHREAD_RECURSIVE_MUTEX_INIT
-# ifndef __GXX_EXPERIMENTAL_CXX0X__
- __gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
- _M_mutex = __tmp;
-# endif
-#else
- __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex); 
+   __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
 #endif
-   }
-#endif 
 }
 
 #if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT
@@ -333,8 +312,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   class __cond
   {
   private:
-#if __GTHREADS && defined __GTHREAD_COND_INIT \
-&& defined __GXX_EXPERIMENTAL_CXX0X__
+#if __GTHREADS && defined __GTHREAD_COND_INIT
 __gthread_cond_t _M_cond = __GTHREAD_COND_INIT;
 #else
 __gthread_cond_t _M_cond;
@@ -346,19 +324,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   public:
 __cond() 
 { 
-#if __GTHREADS
+#if __GTHREADS && ! defined __GTHREAD_COND_INIT
   if (__gthread_active_p())
-   {
-#if defined __GTHREAD_COND_INIT
-# ifndef __GXX_EXPERIMENTAL_CXX0X__
- __gthread_cond_t __tmp = __GTHREAD_COND_INIT;
- _M_cond = __tmp;
-# endif
-#else
- __GTHREAD_COND_INIT_FUNCTION(&_M_cond);
+   __GTHREAD_COND_INIT_FUNCTION(&_M_cond);
 #endif
-   }
-#endif 
 }
 
 #if __GTHREADS && ! defined __GTHREAD_COND_INIT
diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope
index 15cb423..24b8510 100644
--- a/libstdc++-v3/include/ext/rope
+++ b/libstdc++-v3/include/ext/rope
@@ -1,7 +1,6 @@
 // SGI's rope class -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-// Free Software Foundation, Inc.
+// Copyright (C) 2001-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -44,6 

Re: [v3] PR 53270 fix hppa-linux bootstrap regression

2012-07-16 Thread Jonathan Wakely
On 7 July 2012 18:16, Jonathan Wakely wrote:
>
> My preference is (1) for 4.7 and (4) for 4.6 but the changes are not
> ones I feel comfortable making on release branches without other
> opinions.  Please comment :-)

No comments?

Then I'm going for my preferences as stated above.


C++ PATCH for better access violation diagnostic locations

2012-07-16 Thread Jason Merrill
While looking at Paolo's access sfinae patch, I noticed that we were 
giving poor locations for deferred access control errors.  This patch 
fixes that by storing the location of the check to use again later.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit f84991f247261f8e9d8c57115398f2fcd6ce9b62
Author: Jason Merrill 
Date:   Mon Jul 16 17:08:11 2012 -0400

	* cp-tree.h (struct deferred_access_check): Add location.
	* semantics.c (perform_access_checks): Use it.
	(perform_or_defer_access_check): Store it.

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 10efa2a..59104e7 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5484,6 +5484,8 @@ typedef struct GTY(()) deferred_access_check {
   tree decl;
   /* The declaration that should be used in the error message.  */
   tree diag_decl;
+  /* The location of this access.  */
+  location_t loc;
 } deferred_access_check;
 DEF_VEC_O(deferred_access_check);
 DEF_VEC_ALLOC_O(deferred_access_check,gc);
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index a32e48a..8110295 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -259,12 +259,18 @@ perform_access_checks (VEC (deferred_access_check,gc)* checks)
 {
   int i;
   deferred_access_check *chk;
+  location_t loc = input_location;
 
   if (!checks)
 return;
 
   FOR_EACH_VEC_ELT (deferred_access_check, checks, i, chk)
-enforce_access (chk->binfo, chk->decl, chk->diag_decl);
+{
+  input_location = chk->loc;
+  enforce_access (chk->binfo, chk->decl, chk->diag_decl);
+}
+
+  input_location = loc;
 }
 
 /* Perform the deferred access checks.
@@ -334,6 +340,7 @@ perform_or_defer_access_check (tree binfo, tree decl, tree diag_decl)
   new_access->binfo = binfo;
   new_access->decl = decl;
   new_access->diag_decl = diag_decl;
+  new_access->loc = input_location;
 }
 
 /* Used by build_over_call in LOOKUP_SPECULATIVE mode: return whether DECL
diff --git a/gcc/testsuite/g++.dg/parse/access8.C b/gcc/testsuite/g++.dg/parse/access8.C
index 45f4be7..205b7f2 100644
--- a/gcc/testsuite/g++.dg/parse/access8.C
+++ b/gcc/testsuite/g++.dg/parse/access8.C
@@ -5,8 +5,8 @@ class foo
   typedef int memfun;  // { dg-error "private" }
 };
 
-template
-struct fm_obj { }; // { dg-error "context" } 
+template // { dg-error "context" }
+struct fm_obj { };
 
 template  // { dg-error "context" }
 struct S {};
diff --git a/gcc/testsuite/g++.dg/template/sfinae6_neg.C b/gcc/testsuite/g++.dg/template/sfinae6_neg.C
index c238222..28adf73 100644
--- a/gcc/testsuite/g++.dg/template/sfinae6_neg.C
+++ b/gcc/testsuite/g++.dg/template/sfinae6_neg.C
@@ -14,14 +14,14 @@ template struct enable_if { };
 template
   typename enable_if()(create_a(), create_a()), 1),
 		 yes_type>::type
-  check_is_callable2(type, type, type);
+  check_is_callable2(type, type, type); // { dg-error "within this context" }
 
 no_type check_is_callable2(...);
 
 template
 struct is_callable2
 {
-  static const bool value = // { dg-error "within this context" }
+  static const bool value =
 (sizeof(check_is_callable2(type(), type(), type()))
  == sizeof(yes_type));
 };


PR libjava/53973: Check and and skip 67h address size prefix for x32

2012-07-16 Thread H.J. Lu
Hi,

Since x32 may generate 64-bit integer divide like

67 48 f7 bd a0 fe ff ff idivq  -0x160(%ebp)

we need to check and skip 67h address size for x32.  OK for trunk if
there are no regressions on Linux/x86-64?

Thanks.

H.J.

2012-07-16  H.J. Lu  

PR libjava/53973
* include/x86_64-signal.h (CHECK_67H_PREFIX): New.
(HANDLE_DIVIDE_OVERFLOW): Check and and skip 67h address size
prefix if CHECK_67H_PREFIX is 1.

diff --git a/libjava/include/x86_64-signal.h b/libjava/include/x86_64-signal.h
index 4bd8a36..84907c3 100644
--- a/libjava/include/x86_64-signal.h
+++ b/libjava/include/x86_64-signal.h
@@ -21,6 +21,12 @@ details.  */
 #define HANDLE_SEGV 1
 #define HANDLE_FPE 1
 
+#ifdef __ILP32__
+# define CHECK_67H_PREFIX 1
+#else
+# define CHECK_67H_PREFIX 0
+#endif
+
 #define SIGNAL_HANDLER(_name)  \
 static void _Jv_##_name (int, siginfo_t *, \
 void *_p __attribute__ ((__unused__)))
@@ -47,6 +53,10 @@ do   
\
\
   bool _is_64_bit = false; \
\
+  /* Check and skip 67h address size prefix if needed.  */ \
+  if (CHECK_67H_PREFIX && _rip[0] == 0x67) \
+_rip++;\
+   \
   if ((_rip[0] & 0xf0) == 0x40)  /* REX byte present.  */  \
 {  \
   unsigned char _rex = _rip[0] & 0x0f; \
@@ -64,10 +74,10 @@ do  
\
{   \
  if (_is_64_bit)   \
_min_value_dividend =   \
- _gregs[REG_RAX] == (greg_t)0x8000UL;  \
+ _gregs[REG_RAX] == (greg_t)0x8000ULL; \
  else  \
_min_value_dividend =   \
- (_gregs[REG_RAX] & 0x) == (greg_t)0x8000UL;   \
+ (_gregs[REG_RAX] & 0x) == (greg_t)0x8000ULL;  \
}   \
\
   if (_min_value_dividend) \


Re: [v3] fix PR 53978

2012-07-16 Thread Jonathan Wakely
On 16 July 2012 21:44, Jonathan Wakely wrote:
> PR libstdc++/53978
> * include/bits/alloc_traits.h (allocator_traits): Define static
> constants.
> * include/bits/ptr_traits.h (pointer_traits): Likewise.
> * include/ext/alloc_traits.h (__allocator_always_compares_equal):
> Likewise.
>
> Tested x86_64-linux, committed to trunk.

Also committed to 4.7 (without copyright year ranges)


[v3] fix PR 53978

2012-07-16 Thread Jonathan Wakely
PR libstdc++/53978
* include/bits/alloc_traits.h (allocator_traits): Define static
constants.
* include/bits/ptr_traits.h (pointer_traits): Likewise.
* include/ext/alloc_traits.h (__allocator_always_compares_equal):
Likewise.

Tested x86_64-linux, committed to trunk.
diff --git a/libstdc++-v3/include/bits/alloc_traits.h 
b/libstdc++-v3/include/bits/alloc_traits.h
index e1f4d41..80cc956 100644
--- a/libstdc++-v3/include/bits/alloc_traits.h
+++ b/libstdc++-v3/include/bits/alloc_traits.h
@@ -1,6 +1,6 @@
 // Allocator traits -*- C++ -*-
 
-// Copyright (C) 2011 Free Software Foundation, Inc.
+// Copyright (C) 2011-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -56,6 +56,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   static const bool __value = _S_chk<_Alloc, _Tp>(nullptr);
 };
 
+  template
+const bool __alloctr_rebind_helper<_Alloc, _Tp>::__value;
+
   template::__value>
 struct __alloctr_rebind;
@@ -423,6 +426,27 @@ _GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_swap,
 };
 
   template
+  template
+const bool allocator_traits<_Alloc>::__allocate_helper<_Alloc2>::value;
+
+  template
+  template
+const bool
+allocator_traits<_Alloc>::__construct_helper<_Tp, _Args...>::value;
+
+  template
+  template
+const bool allocator_traits<_Alloc>::__destroy_helper<_Tp>::value;
+
+  template
+  template
+const bool allocator_traits<_Alloc>::__maxsize_helper<_Alloc2>::value;
+
+  template
+  template
+const bool allocator_traits<_Alloc>::__select_helper<_Alloc2>::value;
+
+  template
 inline void
 __do_alloc_on_copy(_Alloc& __one, const _Alloc& __two, true_type)
 { __one = __two; }
diff --git a/libstdc++-v3/include/bits/ptr_traits.h 
b/libstdc++-v3/include/bits/ptr_traits.h
index bba9b49..552f487 100644
--- a/libstdc++-v3/include/bits/ptr_traits.h
+++ b/libstdc++-v3/include/bits/ptr_traits.h
@@ -1,6 +1,6 @@
 // Pointer Traits -*- C++ -*-
 
-// Copyright (C) 2011 Free Software Foundation, Inc.
+// Copyright (C) 2011-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -86,6 +86,9 @@ _GLIBCXX_HAS_NESTED_TYPE(difference_type)
   static const bool __value = _S_chk<_Ptr, _Up>(nullptr);
 };
 
+  template
+const bool __ptrtr_rebind_helper<_Ptr, _Up>::__value;
+
   template::__value>
 struct __ptrtr_rebind;
diff --git a/libstdc++-v3/include/ext/alloc_traits.h 
b/libstdc++-v3/include/ext/alloc_traits.h
index b3e3af6..b66f818 100644
--- a/libstdc++-v3/include/ext/alloc_traits.h
+++ b/libstdc++-v3/include/ext/alloc_traits.h
@@ -1,6 +1,6 @@
 // Allocator traits -*- C++ -*-
 
-// Copyright (C) 2011 Free Software Foundation, Inc.
+// Copyright (C) 2011-2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -49,37 +49,56 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
-template
-  struct __allocator_always_compares_equal
-  { static const bool value = false; };
+  template
+struct __allocator_always_compares_equal
+{ static const bool value = false; };
+
+  template
+const bool __allocator_always_compares_equal<_Alloc>::value;
 
   template
 struct __allocator_always_compares_equal>
 { static const bool value = true; };
 
+  template
+const bool __allocator_always_compares_equal>::value;
+
   template struct array_allocator;
 
   template
 struct __allocator_always_compares_equal>
 { static const bool value = true; };
 
+  template
+const bool
+__allocator_always_compares_equal>::value;
+
   template struct mt_allocator;
 
   template
 struct __allocator_always_compares_equal>
 { static const bool value = true; };
 
+  template
+const bool __allocator_always_compares_equal>::value;
+
   template struct new_allocator;
 
   template
 struct __allocator_always_compares_equal>
 { static const bool value = true; };
 
+  template
+const bool __allocator_always_compares_equal>::value;
+
   template struct pool_allocator;
 
   template
 struct __allocator_always_compares_equal>
 { static const bool value = true; };
+
+  template
+const bool __allocator_always_compares_equal>::value;
 #endif
 
 /**


[PATCH] Define FFI_SIZEOF_JAVA_RAW to 4 for x32

2012-07-16 Thread H.J. Lu
Hi,

This patch defines FFI_SIZEOF_JAVA_RAW to 4 for x32, similar to MIPS n32.
It fixed:

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


Thanks.

H.J.
---
 ChangeLog   |5 +
 src/x86/ffitarget.h |3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index ba44189..303aac0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-16  H.J. Lu  
+
+   * src/x86//ffitarget.h (FFI_SIZEOF_JAVA_RAW): Defined to 4 for
+   x32.
+
 2012-05-05  Nicolas Lelong
 
* libffi.xcodeproj/project.pbxproj: Fixes.
diff --git a/src/x86/ffitarget.h b/src/x86/ffitarget.h
index f442654..46f294c 100644
--- a/src/x86/ffitarget.h
+++ b/src/x86/ffitarget.h
@@ -61,8 +61,9 @@ typedef unsigned long long ffi_arg;
 typedef long long  ffi_sarg;
 #endif
 #else
-#if defined __x86_64__ && !defined __LP64__
+#if defined __x86_64__ && defined __ILP32__
 #define FFI_SIZEOF_ARG 8
+#define FFI_SIZEOF_JAVA_RAW  4
 typedef unsigned long long ffi_arg;
 typedef long long  ffi_sarg;
 #else
-- 
1.7.10.4



Re: [wwwdocs] Update coding conventions for C++

2012-07-16 Thread Gabriel Dos Reis
Lawrence Crowl  writes:

| On 7/10/12, Gabriel Dos Reis  wrote:
| > Jason Merrill  writes:
| >
| > | On 07/09/2012 06:00 PM, Lawrence Crowl wrote:
| > | > Done.  New patch attached, but note that the  tags have been
| > | > stripped from the patch to avoid mailer problems.
| > |
| > | Thanks.  If nobody else has any comments, I think this is good to go.
| >
| > Great!
| 
| Committed!

Thanks!

-- Gaby


Re: [wwwdocs] Update coding conventions for C++

2012-07-16 Thread Lawrence Crowl
On 7/10/12, Gabriel Dos Reis  wrote:
> Jason Merrill  writes:
>
> | On 07/09/2012 06:00 PM, Lawrence Crowl wrote:
> | > Done.  New patch attached, but note that the  tags have been
> | > stripped from the patch to avoid mailer problems.
> |
> | Thanks.  If nobody else has any comments, I think this is good to go.
>
> Great!

Committed!

-- 
Lawrence Crowl


Re: [patch][rfc] Clean up CFG dumping

2012-07-16 Thread Steven Bosscher
On Mon, Jul 16, 2012 at 5:57 PM, Steven Bosscher  wrote:
> Hello,
>
> There are comments in basic-block.h that advise to update certain
> parts of the compiler if a new edge flag or basic block flag is added:
>
> -/* Always update the table in cfg.c dump_edge_info.  */
>
> and
>
> -   Always update the table in cfg.c dump_bb_info.  */
>
> Apparently this is not enough, because there are more places where the
> BB flags are dumped. For instance, cfg.c:dump_cfg_bb_info does not
> handle BB_MODIFIED, BB_VISITED, and BB_IN_TRANSACTION, and
> dump_bb_info doesn't even exist in cfg.c (it's in cfgrtl.c). The flags
> also aren't documented very well in the code.
>
> Furthermore, there are multiple places where "common"  (i.e. IR
> agnostic) basic block information is dumped, with some functions
> taking TDF_* flags and others not, some functions taking a FILE as the
> first argument and others as the second argument, etc.  In short:
> Unnecessarily messy.
>
> The attached patch cleans up the worst of it:
>
> * A new file cfg-flags.def is used to define the BB_* and EDGE_*
> flags. The names are the full string of  the name of the flag in
> uppercase, that's a change from before. I can add a separate name
> field to DEF_EDGE_FLAG and DEF_BB_FLAG if necessary.
>
> * Now that there is dumpfile.h for the TDF_* masks, it's easier to use
> them everywhere. I have added one new flag to dump with the ";;"
> prefix (I think it should be used in more places, but that's something
> for later, perhaps).
>
> * All basic block header/footer and edge dumping is consolidated in
> dump_edge_info and dump_bb_info. This affects GIMPLE dump the most,
> because it uses a different form of dumping for basic block
> predecessors and successors. I expect some fall-out in the test suite
> (patterns that no longer match) that I'll have to address before the
> patch is ready for mainline.
>
> * Slim RTL printing is better integrated: print_rtl_with_bb takes
> flags and uses dump_rtl_slim if TDF_SLIM is passed.  The same happens
> in rtl_dump_bb, which always dumps non-slim RTL without this patch.
>
> Bootstrapped on powerpc64-unknown-linux-gnu. Testing will probably
> reveal some test suite pattern mismatches, and I also still want to
> bootstrap&test this on x86_64.
> I'd like to hear what people think of the cfg-flags.def change.

As it turns out, the test suite passes without new regressions on
powerpc64-unknown-linux-gnu and on x86_64-unknown-linux-gnu.
Apparently there aren't any patterns checking edge or bb info. Good
for me :-)

OK for trunk?

Ciao!
Steven








> * dumpfile.h (TDF_COMMENT): New define.
> * basic-block.h (EDGE_FALLTHRU, EDGE_ABNORMAL, EDGE_ABNORMAL_CALL,
> EDGE_EH, EDGE_FAKE, EDGE_DFS_BACK, EDGE_CAN_FALLTHRU,
> EDGE_IRREDUCIBLE_LOOP, EDGE_SIBCALL, EDGE_LOOP_EXIT, EDGE_TRUE_VALUE,
> EDGE_FALSE_VALUE, EDGE_EXECUTABLE, EDGE_CROSSING, EDGE_PRESERVE):
> Move to new file cfg-flags.h.
> (enum cfg_edge_flags): New enum, using cfg-flags.h.
> (EDGE_ALL_FLAGS): Compute value automatically.
> (BB_NEW, BB_REACHABLE, BB_IRREDUCIBLE_LOOP, BB_SUPERBLOCK,
> BB_DISABLE_SCHEDULE, BB_HOT_PARTITION, BB_COLD_PARTITION,
> BB_DUPLICATED, BB_NON_LOCAL_GOTO_TARGET, BB_RTL,
> BB_FORWARDER_BLOCK, BB_NONTHREADABLE_BLOCK, BB_MODIFIED, BB_VISITED,
> BB_IN_TRANSACTION): Move to new file cfg-flags.h.
> (enum bb_flags): Rename to cfg_bb_flags.  Use cfg-flags.h.
> (BB_ALL_FLAGS): New, compute value automatically.
> (dump_bb_info): Update prototype.
> (dump_edge_info): Update prototype.
> * cfg-flags.h: New file.
> * cfg.c (dump_edge_info): Take flags argument.  Be verbose only if
> TDF_DETAILS and not TDF_SLIM.  Include cfg-flags.h for bitnames.
> Check that the edge flags are within the range of EDGE_ALL_FLAGS.
> (debug_bb): Update dump_bb call.
> (dump_cfg_bb_info): Remove.
> (dump_bb_info): New function.  Use cfg-flags.h for bitnames.
> Adjust verbosity using TDF_* flags.  Check that the basic block flags
> are within the range of BB_ALL_FLAGS.
> (brief_dump_cfg): Use dump_bb_info instead of dump_cfg_bb_info.
> * cfghooks.h (struct cfghooks): Update dump_bb hook, take a FILE
> first for consistency with other dump functions.
> (dump_bb): Update prototype accordingly.
> * cfghooks.c: Include dumpfile.h.
> (verify_flow_info): Update dump_edge_info calls.
> (dump_bb): Take a flags argument and pass it around.
> Use dump_bb_info to dump common information about a basic block.
> (dump_flow_info): Moved here from cfgrtl.c.  Make IL agnostic.
> (debug_flow_info): Moved here from cfgrtl.c.
> * profile.c (is_edge_inconsistent): Update dump_bb calls.
> * loop-invariant.c (find_defs): Update print_rtl_with_bb call.
> * rtl.h (debug_bb_n_slim, debug_bb

Re: [patch] Make mcf.c and ira-conflicts.c not include tree.h

2012-07-16 Thread Steven Bosscher
On Mon, Jul 16, 2012 at 9:35 PM, Jakub Jelinek  wrote:
> On Sun, Jul 08, 2012 at 02:44:15PM +0200, Steven Bosscher wrote:
>> IMHO, no RTL pass implementation file should have to include tree.h.
>> So ira-conflicts.c shouldn't need tree.h. The reason it needed it, was
>> because there is code to avoid putting user variables in callee
>> clobbered registers, and ira-conflict.c looked at DECL_ARTIFICIAL
>> (REG_EXPR (reg)). But it can just look at REG_USERVAR_P(reg) instead,
>> which is simper and cleaner.
>
> But it regresses PR53948.

And your proposed solution in the PR is to revert the patch? I don't
see how that helps, and frankly I don't think it's a constructive
attitude.

The variable that is optimized out is a user variable. Instead of
reverting my patch, we should find out why REG_USERVAR_P isn't set for
it.

Ciao!
Steven


Re: [patch] Make mcf.c and ira-conflicts.c not include tree.h

2012-07-16 Thread Jakub Jelinek
On Sun, Jul 08, 2012 at 02:44:15PM +0200, Steven Bosscher wrote:
> IMHO, no RTL pass implementation file should have to include tree.h.
> So ira-conflicts.c shouldn't need tree.h. The reason it needed it, was
> because there is code to avoid putting user variables in callee
> clobbered registers, and ira-conflict.c looked at DECL_ARTIFICIAL
> (REG_EXPR (reg)). But it can just look at REG_USERVAR_P(reg) instead,
> which is simper and cleaner.

But it regresses PR53948.

> --- ira-conflicts.c   (revision 189359)
> +++ ira-conflicts.c   (working copy)
> @@ -25,7 +25,6 @@ along with GCC; see the file COPYING3.  If not see
>  #include "tm.h"
>  #include "regs.h"
>  #include "rtl.h"
> -#include "tree.h"/* For DECL_ARTIFICIAL and friends.  */
>  #include "tm_p.h"
>  #include "target.h"
>  #include "flags.h"
> @@ -893,17 +892,12 @@ ira_build_conflicts (void)
>for (i = 0; i < n; i++)
>   {
> ira_object_t obj = ALLOCNO_OBJECT (a, i);
> -   reg_attrs *attrs = REG_ATTRS (regno_reg_rtx [ALLOCNO_REGNO (a)]);
> -   tree decl;
> +   rtx allocno_reg = regno_reg_rtx [ALLOCNO_REGNO (a)];
> 
> if ((! flag_caller_saves && ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
> /* For debugging purposes don't put user defined variables in
>callee-clobbered registers.  */
> -   || (optimize == 0
> -   && attrs != NULL
> -   && (decl = attrs->decl) != NULL
> -   && VAR_OR_FUNCTION_DECL_P (decl)
> -   && ! DECL_ARTIFICIAL (decl)))
> +   || (optimize == 0 && REG_USERVAR_P (allocno_reg)))
>   {
> IOR_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj),
>   call_used_reg_set);

Jakub


Re: fix thinko in tree-emutls, breaking tls support on vxworks

2012-07-16 Thread Richard Henderson
On 07/03/2012 02:09 AM, Olivier Hainque wrote:
> 2012-07-03  Olivier Hainque  
> 
> * tree-emutls.c (new_emutls_decl): When a var_section is requested by
> the target, attach the new decl to that, not to the template section.


Ok.


r~


Re: [C++ RFC / Patch] PR 51213 ("access control under SFINAE")

2012-07-16 Thread Jason Merrill

On 07/14/2012 05:54 AM, Paolo Carlini wrote:

The above change of yours appear to imply that, at variance with what I
had in my first draft, perform_typedefs_access_check shouldn't really
gain a tsubst_flags_t argument, because now it's called by
instantiate_decl and instantiate_class_template_1 (from which I was
passing a true / tf_error). Makes sense?


That makes sense to me.

Jason



Re: [Patch/RFC] SEH exceptions for Win64

2012-07-16 Thread Richard Henderson
On 07/13/2012 07:13 AM, Tristan Gingold wrote:
> +_Unwind_RaiseException (struct _Unwind_Exception *exc)
> +{
> +  memset (exc->private_, 0, sizeof (exc->private_));
> +
> +  RaiseException (STATUS_GCC_THROW, 0, 1, (ULONG_PTR *)&exc);

We almost certainly didn't want pointer-to-pointer...


r~


Re: PATCH: PR target/53539: Different __WCHAR_TYPE__/wchar_t for gcc -m32 on Linux/i386 and Linux/x86-64

2012-07-16 Thread Richard Henderson
On 07/06/2012 11:27 AM, H.J. Lu wrote:
 >>> +#undef WCHAR_TYPE
 >>> +#define WCHAR_TYPE (TARGET_LP64 ? "int" : "long int")
>>> >>
>>> >> Hi Richard,
>>> >>
>>> >> Is this patch OK for trunk?
>>> >>
>>> >> Thanks.
>> >
>> > Yes, this is fine.
>> >
> I'd like to backport it to 4.6/4.7 branches.  Is that OK?

Meh... is there a real reason for it?  Certainly you don't have
"official" x32 support on those branches.

As far as I'm concerned this can stay private to whatever branch
also includes your x32 work.



r~


Re: [Ada] Optimization of the Lock-free implementation of protected object

2012-07-16 Thread Arnaud Charlet
> http://gcc.gnu.org/ml/gcc-cvs/2012-07/msg00341.html
> 
> This breaks ada bootstrap on powerpc-darwin9 with :
>  Undefined symbols:
>   "___sync_val_compare_and_swap_8", referenced from:
>   _system__atomic_primitives__lock_free_try_write_64 in
>   s-atopri.o
>   "___atomic_load_8", referenced from:
>   _system__atomic_primitives__lock_free_read_64 in s-atopri.o
> ld: symbol(s) not found
> 
> (and, I assume any other target without __sync_val_compare_and_swap_8
> builtin or library fall-back).

Right. We are working on a patch to fix this issue, so this should be
addressed soon, thanks for the note!

Arno


[spu, commit] Fix build failure - move targetm initializer to the bottom

2012-07-16 Thread Ulrich Weigand
Hello,

since Bill Schmidt's recent vector cost function patch, spu.c fails to build:
/home/kwerner/dailybuild/spu-tc-2012-07-16/gcc-head/src/gcc/config/spu/spu.c:499:
 error: 'spu_init_cost' undeclared here (not in a function)
/home/kwerner/dailybuild/spu-tc-2012-07-16/gcc-head/src/gcc/config/spu/spu.c:499:
 error: 'spu_add_stmt_cost' undeclared here (not in a function)
/home/kwerner/dailybuild/spu-tc-2012-07-16/gcc-head/src/gcc/config/spu/spu.c:499:
 error: 'spu_finish_cost' undeclared here (not in a function)
/home/kwerner/dailybuild/spu-tc-2012-07-16/gcc-head/src/gcc/config/spu/spu.c:499:
 error: 'spu_destroy_cost_data' undeclared here (not in a function)

This is because spu.c for historical reasons still has the initialization
of "targetm" at the top of the file instead of at the bottom like most
other targets, which requires explicit prototypes for every function
referenced in a targetm initializer.

Instead of adding those prototypes for the above routines, the following
patch simply moves targetm to the bottom of the file, and removes all
static function prototypes that are now unncessary.

This gets spu-elf to build again.

Checked in to mainline.

Bye,
Ulrich


ChangeLog:

* config/spu/spu.c (targetm): Move to bottom of file.
(spu_attribute_table): Likewise.
(spu_option_override, spu_init_builtins, spu_builtin_decl,
spu_scalar_mode_supported_p, spu_vector_mode_supported_p,
spu_legitimate_address_p, spu_addr_space_legitimate_address_p,
adjust_operand, get_pic_reg, need_to_save_reg, frame_emit_store,
frame_emit_load, frame_emit_add_imm, emit_nop_for_insn,
insn_clobbers_hbr, spu_emit_branch_hint, spu_emit_vector_compare,
get_branch_target, spu_machine_dependent_reorg, spu_sched_issue_rate,
spu_sched_variable_issue, spu_sched_adjust_cost, spu_sched_init_global,
spu_sched_init, spu_sched_reorder, spu_handle_fndecl_attribute,
spu_handle_vector_attribute, spu_pass_by_reference, spu_function_arg,
spu_function_arg_advance, spu_build_builtin_va_list, spu_va_start,
spu_gimplify_va_arg_expr, store_with_one_insn_p, reg_aligned_for_addr,
spu_assemble_integer, spu_asm_globalize_label, spu_rtx_costs,
spu_function_ok_for_sibcall, spu_init_libfuncs, spu_return_in_memory,
spu_encode_section_info, spu_legitimize_address,
spu_addr_space_legitimize_address, spu_builtin_mask_for_load,
spu_builtin_vectorization_cost, spu_vector_alignment_reachable,
spu_addr_space_pointer_mode, spu_addr_space_address_mode,
spu_addr_space_subset_p, spu_addr_space_convert, spu_sms_res_mii,
spu_section_type_flags, spu_select_section, spu_unique_section,
spu_trampoline_init, spu_conditional_register_usage,
spu_ref_may_alias_errno, spu_output_mi_thunk, spu_unwind_word_mode,
spu_libgcc_cmp_return_mode, spu_libgcc_shift_count_mode,
spu_setup_incoming_varargs): Remove prototypes.
(spu_legitimize_address): Add "static" to definition.


Index: gcc/config/spu/spu.c
===
*** gcc/config/spu/spu.c(revision 189542)
--- gcc/config/spu/spu.c(working copy)
*** static struct spu_builtin_range spu_buil
*** 147,234 
  char regs_ever_allocated[FIRST_PSEUDO_REGISTER];
  
  /*  Prototypes and external defs.  */
- static void spu_option_override (void);
- static void spu_init_builtins (void);
- static tree spu_builtin_decl (unsigned, bool);
- static bool spu_scalar_mode_supported_p (enum machine_mode mode);
- static bool spu_vector_mode_supported_p (enum machine_mode mode);
- static bool spu_legitimate_address_p (enum machine_mode, rtx, bool);
- static bool spu_addr_space_legitimate_address_p (enum machine_mode, rtx,
-bool, addr_space_t);
- static rtx adjust_operand (rtx op, HOST_WIDE_INT * start);
- static rtx get_pic_reg (void);
- static int need_to_save_reg (int regno, int saving);
- static rtx frame_emit_store (int regno, rtx addr, HOST_WIDE_INT offset);
- static rtx frame_emit_load (int regno, rtx addr, HOST_WIDE_INT offset);
- static rtx frame_emit_add_imm (rtx dst, rtx src, HOST_WIDE_INT imm,
-  rtx scratch);
- static void emit_nop_for_insn (rtx insn);
- static bool insn_clobbers_hbr (rtx insn);
- static void spu_emit_branch_hint (rtx before, rtx branch, rtx target,
- int distance, sbitmap blocks);
- static rtx spu_emit_vector_compare (enum rtx_code rcode, rtx op0, rtx op1,
-   enum machine_mode dmode);
- static rtx get_branch_target (rtx branch);
- static void spu_machine_dependent_reorg (void);
- static int spu_sched_issue_rate (void);
- static int spu_sched_variable_issue (FILE * dump, int verbose, rtx insn,
-int can_issue_more);
  static int get_pipe (rtx insn);
- static i

[Committed] Add some new testcases

2012-07-16 Thread Andrew Pinski
Hi,
  This is just a small collection of testcases which we (Cavium) had locally.
gcc.c-torture/execute/bswap-1.c tests __builtin_bswap64 as there was
no testcases before
gcc.c-torture/compile/unalign-1.c ICEd when movmisalign* patterns were
added to mips.
gcc.c-torture/compile/20120524-1.c ICEd when enhancing mips's copy
block patterns
gcc.c-torture/compile/20101216-1.c ICEd with some of the older
truncate patches (no testcase was added back then)

Committed all as obvious after running the testsuite on x86_64-linux-gnu.

Thanks,
Andrew Pinski

* gcc.c-torture/execute/bswap-1.c: New testcase
* gcc.c-torture/compile/unalign-1.c: New testcase
* gcc.c-torture/compile/20120524-1.c: New testcase
* gcc.c-torture/compile/20101216-1.c: New testcase
Index: testsuite/gcc.c-torture/execute/bswap-1.c
===
--- testsuite/gcc.c-torture/execute/bswap-1.c   (revision 0)
+++ testsuite/gcc.c-torture/execute/bswap-1.c   (revision 0)
@@ -0,0 +1,51 @@
+/* Test __builtin_bswap64 . */
+
+unsigned long long g(unsigned long long a) __attribute__((noinline));
+unsigned long long g(unsigned long long a)
+{
+  return __builtin_bswap64(a);
+}
+
+
+unsigned long long f(unsigned long long c)
+{
+  union {
+unsigned long long a;
+unsigned char b[8];
+  } a, b;
+  a.a = c;
+  b.b[0] = a.b[7];
+  b.b[1] = a.b[6];
+  b.b[2] = a.b[5];
+  b.b[3] = a.b[4];
+  b.b[4] = a.b[3];
+  b.b[5] = a.b[2];
+  b.b[6] = a.b[1];
+  b.b[7] = a.b[0];
+  return b.a;
+}
+
+int main(void)
+{
+  unsigned long long i;
+  /* The rest of the testcase assumes 8 byte long long. */
+  if (sizeof(i) != sizeof(char)*8)
+return 0;
+  if (f(0x12) != g(0x12))
+__builtin_abort();
+  if (f(0x1234) != g(0x1234))
+__builtin_abort();
+  if (f(0x123456) != g(0x123456))
+__builtin_abort();
+  if (f(0x12345678ull) != g(0x12345678ull))
+__builtin_abort();
+  if (f(0x1234567890ull) != g(0x1234567890ull))
+__builtin_abort();
+  if (f(0x123456789012ull) != g(0x123456789012ull))
+__builtin_abort();
+  if (f(0x12345678901234ull) != g(0x12345678901234ull))
+__builtin_abort();
+  if (f(0x1234567890123456ull) != g(0x1234567890123456ull))
+__builtin_abort();
+  return 0;
+}
Index: testsuite/gcc.c-torture/compile/unalign-1.c
===
--- testsuite/gcc.c-torture/compile/unalign-1.c (revision 0)
+++ testsuite/gcc.c-torture/compile/unalign-1.c (revision 0)
@@ -0,0 +1,15 @@
+typedef struct __attribute__ ((__packed__))
+{
+char valueField[2];
+} ptp_tlv_t;
+typedef struct __attribute__ ((__packed__))
+{
+char stepsRemoved;
+ptp_tlv_t tlv[1];
+} ptp_message_announce_t;
+int ptplib_send_announce(int sequenceId, int i)
+{
+ptp_message_announce_t tx_packet;
+((long long *)tx_packet.tlv[0].valueField)[sequenceId] = i;
+f(&tx_packet);
+}
Index: testsuite/gcc.c-torture/compile/20101216-1.c
===
--- testsuite/gcc.c-torture/compile/20101216-1.c(revision 0)
+++ testsuite/gcc.c-torture/compile/20101216-1.c(revision 0)
@@ -0,0 +1,32 @@
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+typedef union
+{
+  double value;
+  struct
+  {
+__uint32_t msw;
+__uint32_t lsw;
+  } parts;
+} ieee_double_shape_type;
+two52= 4.5035996273704960e+15,
+w6 = -1.63092934096575273989e-03;
+double sin_pi(double x)
+{
+ double y,z;
+ __int32_t n,ix;
+ieee_double_shape_type gh_u;
+ gh_u.value = (x); 
+(ix) = gh_u.parts.msw;
+if(ix<0x4330)
+ z = y+two52;
+ ieee_double_shape_type gl_u;
+ gl_u.value = (z);
+ (n) = gl_u.parts.lsw;
+  n &= 1;
+ switch (n)
+ {
+ case 0:
+__kernel_sin();
+ }
+}
Index: testsuite/gcc.c-torture/compile/20120524-1.c
===
--- testsuite/gcc.c-torture/compile/20120524-1.c(revision 0)
+++ testsuite/gcc.c-torture/compile/20120524-1.c(revision 0)
@@ -0,0 +1,4 @@
+  char CJPAT_Packet[1508] = {};
+void build_packet(int port, char *packet) {
+memcpy(packet, CJPAT_Packet, sizeof(CJPAT_Packet)); 
+}


Re: [Ada] Optimization of the Lock-free implementation of protected object

2012-07-16 Thread Iain Sandoe
Hello Arnaud,

On 12 Jul 2012, at 11:43, Arnaud Charlet wrote:

> The optimization of the expansion of protected procedure for the lock-free
> implementation brings the following changes:
> - Several renamings in order to match GCC built-in function wordings.
> - Expected_Comp declaration moved to the the declarations list of the 
> procedure
> - GCC built-in operation__sync_bool_compare_and_swap replaced by
>  __sync_val_compare_and_swap.
> - Don't use an atomic compare and swap if Expected_Comp = Desired_Comp
> 
> Tested on x86_64-pc-linux-gnu, committed on trunk
> 
> 2012-07-12  Vincent Pucci  
> 
>   * exp_ch9.adb (Build_Lock_Free_Unprotected_Subprogram_Body):
>   Atomic_Load_N replaced by Lock_Free_Read_N. Atomic_Compare_Exchange_N
>   replaced by Lock_Free_Try_Write_N.
>   Renaming of several local variables. For
>   procedure, Expected_Comp declaration moved to the declaration
>   list of the procedure.
>   * rtsfind.ads: RE_Atomic_Compare_Exchange_8,
>   RE_Atomic_Compare_Exchange_16, RE_Atomic_Compare_Exchange_32,
>   RE_Atomic_Compare_Exchange_64, RE_Atomic_Load_8,
>   RE_Atomic_Load_16, RE_Atomic_Load_32, RE_Atomic_Load_64,
>   RE_Atomic_Synchronize, RE_Relaxed removed.  RE_Lock_Free_Read_8,
>   RE_Lock_Free_Read_16, RE_Lock_Free_Read_32, RE_Lock_Free_Read_64,
>   RE_Lock_Free_Try_Write_8, RE_Lock_Free_Try_Write_16,
>   RE_Lock_Free_Try_Write_32, RE_Lock_Free_Try_Write_64 added.
>   * s-atopri.adb: New file.
>   * s-atopri.ads (Atomic_Compare_Exchange_8): Renaming of
>   parameters.  Import primitive __sync_val_compare_and_swap_1.
>   (Atomic_Compare_Exchange_16): Renaming of parameters.
>   Import primitive __sync_val_compare_and_swap_2.
>   (Atomic_Compare_Exchange_32): Renaming of parameters.
>   Import primitive __sync_val_compare_and_swap_4.
>   (Atomic_Compare_Exchange_64): Renaming of parameters.  Import
>   primitive __sync_val_compare_and_swap_8.
>   (Atomic_Load_8): Ptr renames parameter X.
>   (Atomic_Load_16): Ptr renames parameter X.
>   (Atomic_Load_32): Ptr renames parameter X.
>   (Atomic_Load_64): Ptr renames parameter X.
>   (Lock_Free_Read_8): New routine.
>   (Lock_Free_Read_16): New routine.
>   (Lock_Free_Read_32): New routine.
>   (Lock_Free_Read_64): New routine.
>   (Lock_Free_Try_Write_8): New routine.
>   (Lock_Free_Try_Write_16): New routine.
>   (Lock_Free_Try_Write_32): New routine.
>   (Lock_Free_Try_Write_64): New routine.

http://gcc.gnu.org/ml/gcc-cvs/2012-07/msg00341.html

This breaks ada bootstrap on powerpc-darwin9 with :
 Undefined symbols:
  "___sync_val_compare_and_swap_8", referenced from:
  _system__atomic_primitives__lock_free_try_write_64 in s-atopri.o
  "___atomic_load_8", referenced from:
  _system__atomic_primitives__lock_free_read_64 in s-atopri.o
ld: symbol(s) not found

(and, I assume any other target without __sync_val_compare_and_swap_8 builtin 
or library fall-back).

If you think this is a target bug, let me know and I'll try and delve further.
thanks
Iain





Re: [patch][rft] Don't mess with debug_hooks in objc

2012-07-16 Thread Mike Stump
On Jul 14, 2012, at 12:21 PM, Steven Bosscher wrote:
> There is code in objc-act.c to save and restore debug hooks to work
> around a problem with the C front end.

> OK for trunk?

Ok.  [ Thanks for waiting, I wanted to ponder this for a day or two... ]


Re: [Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Eric Botcazou
> Agreed.  But I still think that these are two very different issues:
> 
> * Doing implicit conversion to void * for builtins is just a convenient way
> for interfacing with builtins.
> 
> * Using void * for System.Address shouldn't have any immediate advantage
> for users, but would be a better match for the representation.

In fact the latter would unbreak the m68k port (this is PR ada/48835).

-- 
Eric Botcazou


Re: G++ namespace association extension

2012-07-16 Thread Jason Merrill

On 07/15/2012 07:26 AM, Gerald Pfeifer wrote:

I think this also should go into the GCC 4.8 release notes
(gcc-4.8/changes.html)?


I doubt that it has gotten wide enough usage to need that, but I suppose 
it doesn't hurt.


Jason



Re: [PATCH 1/2] gcc symbol database

2012-07-16 Thread Dodji Seketeli
Yunfeng ZHANG  writes:

>> But the "meaning" of the macro_end_arg event is really not clear to
>> ...
>>  and so on.
>
> Let's see a sample:
> #define Z(a) a
> #define Y Z
> #define X(p) p + Y
> X(1)(2);
> With my solution, user get
> 1) `X' -- leader macro token by macro_start_expand.
> 2) `(', `1', `)', `(', `2', `)' -- macro tokens, by cb_lex_token.
> 3) macro_end_arg.
> 4) `1', `+', `2' -- macro replacement tokens, by symdb_cpp_token.
> 5) macro_end_expand.

I see.  So the meaning of macro_end_arg is something like:

"The tokens that were just reported by the lex_token event were
 arguments to a function-like macro".

Is that correct?  

If yes, then I guess you can keep that macro_end_arg event, but then I'd
remove its "cancel" argument by doing what I said in my previous
messages.  Which is, don't call macro_start_expand if X is not going to
be expanded.  To do that, move macro_start_expand in
enter_macro_context, like I proposed there.

Of course, that would not change the sequence of the events you'd get in
the example above.  But in this example below:

 1  #define Y 1
 2  
 3  int
 4  Y (int a)
 5  {
 6return a + 1;
 7  }
 8  
 9  int
10  main ()
11  {
12return Y(a);
13  }

When parsing Y(a), what I am proposing won't emit a
macro_start_expansion at line 12, but with your implementation, it will
emit a macro_start_expansion, followed by a macro_end_arg with the
cancel argument set to true.  Which is unnecessary if the
macro_start_expansion is not called at all there.

Of course, you'd have to change the hunk:

*** enter_macro_context (cpp_reader *pfile, 
*** 1015,1020 
--- 1015,1022 
  pfile->state.parsing_args = 1;
  buff = funlike_invocation_p (pfile, node, &pragma_buff,
   &num_args);
+ if (pfile->cb.macro_end_arg)
+   pfile->cb.macro_end_arg (pfile, buff == NULL);
  pfile->state.parsing_args = 0;
  pfile->keep_tokens--;
  pfile->state.prevent_expansion--;

so that "pfile->cb.macro_end_arg (pfile)" is not invoked when
funlike_invocation_p returns NULL.

Does that make sense?

If yes, the comment of that event should be adapted to have a more
meaningful meaning.  I believe the comments of the other events should
be adapted to, in the light of the description that I did in my previous
message.

>> Please reply to these questions so that I understand why you need this
>> field at all, rather than getting it from the linemap infrastructure
>> by calling, for instance, linemap_expand_location.
>
> linemap_expand_location can return the column and row of a token, not file
> offset of its, there's no more explanation why using token file-offset, when I
> started my project, I think file-offset is better than current
> linemap+source_location because it costed less time to encode/decode
> source_location field and can act just like previous solution,

What I meant was that if you prefer storing file offsets in the database
of your plugin, rather than line/column, then why not saying that it's
equal to something like (line + column), instead of adding a new field
in libcpp itself.

> it's an improvement to gcc too, with it gcc can store
> symbol+fileoffset to elf intern for ld/gdb usage, of course,

I wouldn't be so sure.  DWARF already has a sophisticated and compact
way to store line/column information, so I don't think the file offset
gives us anything in practice.

> my database can benefit from it -- less space and use it as sort field
> directly.

Sure, but then you can just compute it from the result of
linemap_expand_location, as I said above.

> The only thing is it make challenge on gcc infrastructure, so I leave
> it to a seperate patch called gcc_negotiate_patch and hope to discuss
> the first two patches only.

If you are not convinced, then OK, let's leave that part aside from now.

> And to the field file-offset, when the token is macro-replacement token, I
> recommend token.file_offset = -1 * .file_offset. I think
> gdb is happy to this.

Right now, for tokens resulting from macro expansion, the location that
is encoded in debug information is already the location of the expansion
point of the macro.  So we already do what you say, in a sense.

Cheers.

-- 
Dodji


Re: [Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Tristan Gingold

On Jul 16, 2012, at 5:16 PM, Duncan Sands wrote:

> PS: That said, I have to admit that using void* for builtins does cover the
> most important cases.

Agreed.  But I still think that these are two very different issues:

* Doing implicit conversion to void * for builtins is just a convenient way for 
interfacing with builtins.

* Using void * for System.Address shouldn't have any immediate advantage for 
users, but would be a better match for the representation.

Tristan.




Re: [Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Duncan Sands

PS: That said, I have to admit that using void* for builtins does cover the
most important cases.


Re: [PATCH, i386, PR53877] New intrinsics for LZCNT

2012-07-16 Thread Uros Bizjak
On Mon, Jul 16, 2012 at 4:32 PM, H.J. Lu  wrote:
> On Mon, Jul 16, 2012 at 7:14 AM, Kirill Yukhin  
> wrote:
>> Hello guys,
>>
>> Here is a tiny patch which adds two new intrinsics which were
>> introduced in recent spec [1].
>> They're aliased to the existing __lzcnt_*  and live under same CPUID.
>>
>> ChangeLog entry is:
>> 2012-07-16  Kirill Yukhin  
>>
>> PR target/53877
>> * config/i386/lzcntintrin.h (_lzcnt_u32): New.
>> (_lzcnt_u64): Ditto.
>>
>> Is it OK for trunk?
>>
>
> I think we should add a testcase for each.  Also it should
> also be applied on 4.7.

This patch just calls __builtin_clz{,ll}, for which we already have
test coverage. Also, please note a couple of sse-*.c testcases that
check compilation of all intrinsics in one shot.

So, OK for mainline and 4.7.

Thanks,
Uros.


Re: [Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Duncan Sands

Hi Tristan,


Ah, what you want is the use of 'void *' for System.Address.
We didn't choose that because the semantic of System.Address (which includes 
arithmetic on the whole address space) doesn't match the void * one.


void* arithmetic of this kind exists, it's a gcc extension to C :)


The issue is not void * vs char *, but the fact that the C standard has 
restriction on pointer arithmetic.


I see, -fno-strict-overflow would be needed to get System.Address modulo
arithmetic semantics if it was always turned into void*, which would then
presumably pessimize other code.  However this isn't really relevant to
whether Address formal parameters should always be turned into void* or
not.

Ciao, Duncan.


But, you can try to implement this scheme by modifying the runtime.  I don't 
know if this is a small work or not.


It crashes the front-end, so it's not trivial.


:-)






Re: [PATCH] Fix up _xabort for -O0

2012-07-16 Thread Uros Bizjak
On Mon, Jul 16, 2012 at 4:45 PM, Jakub Jelinek  wrote:

> While backporting, I've noticed there is an extra semicolon that shouldn't
> be there in -O0 version of _xabort.  Ok for trunk?
>
> 2012-07-16  Jakub Jelinek  
>
> * config/i386/rtmintrin.h (_xabort): Remove trailing semicolon.

OK, obvious in fact.

Thanks,
Uros.


[PATCH] Fix up _xabort for -O0

2012-07-16 Thread Jakub Jelinek
Hi!

While backporting, I've noticed there is an extra semicolon that shouldn't
be there in -O0 version of _xabort.  Ok for trunk?

2012-07-16  Jakub Jelinek  

* config/i386/rtmintrin.h (_xabort): Remove trailing semicolon.

--- gcc/config/i386/rtmintrin.h 2012-03-14 09:39:41.167265085 +0100
+++ gcc/config/i386/rtmintrin.h 2012-07-16 16:41:11.979329061 +0200
@@ -71,7 +71,7 @@ _xabort (const unsigned int imm)
   __builtin_ia32_xabort (imm);
 }
 #else
-#define _xabort(N)  __builtin_ia32_xabort (N);
+#define _xabort(N)  __builtin_ia32_xabort (N)
 #endif /* __OPTIMIZE__ */
 
 #endif /* _RTMINTRIN_H_INCLUDED */

Jakub


Re: [Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Tristan Gingold

On Jul 16, 2012, at 4:36 PM, Duncan Sands wrote:

> Hi Tristan,
> 
>> Ah, what you want is the use of 'void *' for System.Address.
>> We didn't choose that because the semantic of System.Address (which includes 
>> arithmetic on the whole address space) doesn't match the void * one.
> 
> void* arithmetic of this kind exists, it's a gcc extension to C :)

The issue is not void * vs char *, but the fact that the C standard has 
restriction on pointer arithmetic.

>> But, you can try to implement this scheme by modifying the runtime.  I don't 
>> know if this is a small work or not.
> 
> It crashes the front-end, so it's not trivial.

:-)



Re: [Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Duncan Sands

Hi Tristan,


Ah, what you want is the use of 'void *' for System.Address.
We didn't choose that because the semantic of System.Address (which includes 
arithmetic on the whole address space) doesn't match the void * one.


void* arithmetic of this kind exists, it's a gcc extension to C :)


But, you can try to implement this scheme by modifying the runtime.  I don't 
know if this is a small work or not.


It crashes the front-end, so it's not trivial.

Ciao, Duncan.


Re: [PATCH, i386, PR53877] New intrinsics for LZCNT

2012-07-16 Thread H.J. Lu
On Mon, Jul 16, 2012 at 7:14 AM, Kirill Yukhin  wrote:
> Hello guys,
>
> Here is a tiny patch which adds two new intrinsics which were
> introduced in recent spec [1].
> They're aliased to the existing __lzcnt_*  and live under same CPUID.
>
> ChangeLog entry is:
> 2012-07-16  Kirill Yukhin  
>
> PR target/53877
> * config/i386/lzcntintrin.h (_lzcnt_u32): New.
> (_lzcnt_u64): Ditto.
>
> Is it OK for trunk?
>

I think we should add a testcase for each.  Also it should
also be applied on 4.7.


-- 
H.J.


Re: [Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Tristan Gingold

On Jul 16, 2012, at 3:58 PM, Duncan Sands wrote:

> Hi Tristan,
> 
>>> indeed, for two years already.  Is there any reason not to do this for all
>>> functions, rather than just limiting it to builtins?
>> 
>> I don't understand what do you mean.  We need to do this implicit conversion 
>> for builtins because they are known by the compiler.  Which other functions 
>> (that aren't builtins) are you referring to ?
> 
> all of them!  First off, the LLVM optimizers do a better job if an argument 
> of a
> user defined function that is really a pointer is declared as such, rather 
> than
> declared as an integer then cast to a pointer before being used.  I don't know
> if the GCC optimizers are sensitive to this too.  Also, the LLVM optimizers
> recognize some standard library functions that the gcc optimizers do not, but
> fail to recognize them when called from Ada because they have the wrong
> prototype: an integer rather than a pointer argument.  Finally I would argue
> that as System.Address is really a pointer, playing pretty much exactly the
> same role as void* in C, it is more philosophically correct to express it as a
> void*.  That said, it should probably just be declared as a pointer in the
> System package rather than doing all this mucking around in the gcc interface.

Ah, what you want is the use of 'void *' for System.Address.
We didn't choose that because the semantic of System.Address (which includes 
arithmetic on the whole address space) doesn't match the void * one.

But, you can try to implement this scheme by modifying the runtime.  I don't 
know if this is a small work or not.

Tristan.



[PATCH, i386, PR53877] New intrinsics for LZCNT

2012-07-16 Thread Kirill Yukhin
Hello guys,

Here is a tiny patch which adds two new intrinsics which were
introduced in recent spec [1].
They're aliased to the existing __lzcnt_*  and live under same CPUID.

ChangeLog entry is:
2012-07-16  Kirill Yukhin  

PR target/53877
* config/i386/lzcntintrin.h (_lzcnt_u32): New.
(_lzcnt_u64): Ditto.

Is it OK for trunk?

[1] --  http://software.intel.com/file/45088

Thanks, K


lzcnt-new-intrin-1.gcc.patch
Description: Binary data


Re: [RFC] 4.7 backport crashes (was: Re: Tree tail merging breaks __builtin_unreachable optimization)

2012-07-16 Thread Richard Guenther
On Mon, Jul 16, 2012 at 3:55 PM, Ulrich Weigand  wrote:
> Richard Guenther wrote:
>> On Fri, Jul 6, 2012 at 6:36 PM, Tom de Vries  wrote:
>> > Bootstrapped and reg-tested (ada inclusive) on x86_64.
>> >
>> > OK for trunk?
>>
>> Ok.
>> Thanks,
>> Richard.
>>
>> > 2012-07-06  Tom de Vries  
>> > Richard Guenther  
>> >
>> > * tree-ssa-ccp.c (optimize_unreachable): New function.
>> > (execute_fold_all_builtins): Use optimize_unreachable to optimize
>> > BUILT_IN_UNREACHABLE.  Don't optimize after BUILT_IN_UNREACHABLE.
>> >
>> > * gcc.dg/builtin-unreachable-6.c: New test.
>> > * gcc.dg/builtin-unreachable-5.c: New test.
>
>
> When attempting to backport this patch to our 4.7 branch, I ran into
> segmentation faults.  It turns out that at least in 4.7, gsi_stmt
> crashes when passed an empty gsi (for which gsi_end_p is true);
> on mainline, gsi_stmt simply returns NULL instead.
>
> Now I understand that even on mainline, we're still supposed to check
> gsi_end_p before calling gsi_stmt.  The patch below updates
> tree-ssa-ccp.c:optimize_unreachable to do that.  In the backport
> this fixes the crashes.
>
> This doesn't really have any effect on behaviour on mainline.  Should
> it be installed anyway?

Yes please.

> (Tested on mainline on i386-linux with no regressions.)
>
> In addition, I was wondering whether we should backport Tom's patch
> (including the fix below) to the FSF 4.7 branch: it does fix a
> (performance) regression, in the sense that the original testcase
> calling __builtin_unreachable multiple times was optimized well
> until 4.6, and is now again optimized well on mainline, but it
> generates quite bad code on 4.7 at the moment ...

I'm not sure.

Thanks,
Richard.

> Bye,
> Ulrich
>
>
> ChangeLog:
>
> * tree-ssa-ccp.c (optimize_unreachable): Check gsi_end_p
> before calling gsi_stmt.
>
> Index: gcc/tree-ssa-ccp.c
> ===
> *** gcc/tree-ssa-ccp.c  (revision 189459)
> --- gcc/tree-ssa-ccp.c  (working copy)
> *** optimize_unreachable (gimple_stmt_iterat
> *** 2358,2366 
> FOR_EACH_EDGE (e, ei, bb->preds)
>   {
> gsi = gsi_last_bb (e->src);
> !   stmt = gsi_stmt (gsi);
>
> !   if (stmt && gimple_code (stmt) == GIMPLE_COND)
> {
>   if (e->flags & EDGE_TRUE_VALUE)
> gimple_cond_make_false (stmt);
> --- 2358,2368 
> FOR_EACH_EDGE (e, ei, bb->preds)
>   {
> gsi = gsi_last_bb (e->src);
> !   if (gsi_end_p (gsi))
> !   continue;
>
> !   stmt = gsi_stmt (gsi);
> !   if (gimple_code (stmt) == GIMPLE_COND)
> {
>   if (e->flags & EDGE_TRUE_VALUE)
> gimple_cond_make_false (stmt);
>
>
> --
>   Dr. Ulrich Weigand
>   GNU Toolchain for Linux on System z and Cell BE
>   ulrich.weig...@de.ibm.com
>


Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-07-16 Thread Kirill Yukhin
Reverted.
http://gcc.gnu.org/ml/gcc-cvs/2012-07/msg00442.html

Thanks, K

On Mon, Jul 16, 2012 at 5:36 PM, Kai Tietz  wrote:
> Hi,
>
> I would kindly ask to revert this patch soonish.  The define
> OPTION_BIONIC is defined within linux.h header, which isn't used by
> cygwin and mingw targets.  so this symbol is undefined for them and
> this is causing bootstrap issue for cygwin and mingw targets.
>
> Regards,
> Kai


Re: Allow use of ranges in copyright notices

2012-07-16 Thread Joseph S. Myers
I have now committed this patch to allow the use of ranges.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Duncan Sands

Hi Tristan,


indeed, for two years already.  Is there any reason not to do this for all
functions, rather than just limiting it to builtins?


I don't understand what do you mean.  We need to do this implicit conversion 
for builtins because they are known by the compiler.  Which other functions 
(that aren't builtins) are you referring to ?


all of them!  First off, the LLVM optimizers do a better job if an argument of a
user defined function that is really a pointer is declared as such, rather than
declared as an integer then cast to a pointer before being used.  I don't know
if the GCC optimizers are sensitive to this too.  Also, the LLVM optimizers
recognize some standard library functions that the gcc optimizers do not, but
fail to recognize them when called from Ada because they have the wrong
prototype: an integer rather than a pointer argument.  Finally I would argue
that as System.Address is really a pointer, playing pretty much exactly the
same role as void* in C, it is more philosophically correct to express it as a
void*.  That said, it should probably just be declared as a pointer in the
System package rather than doing all this mucking around in the gcc interface.

Ciao, Duncan.


[RFC] 4.7 backport crashes (was: Re: Tree tail merging breaks __builtin_unreachable optimization)

2012-07-16 Thread Ulrich Weigand
Richard Guenther wrote:
> On Fri, Jul 6, 2012 at 6:36 PM, Tom de Vries  wrote:
> > Bootstrapped and reg-tested (ada inclusive) on x86_64.
> >
> > OK for trunk?
> 
> Ok.
> Thanks,
> Richard.
> 
> > 2012-07-06  Tom de Vries  
> > Richard Guenther  
> >
> > * tree-ssa-ccp.c (optimize_unreachable): New function.
> > (execute_fold_all_builtins): Use optimize_unreachable to optimize
> > BUILT_IN_UNREACHABLE.  Don't optimize after BUILT_IN_UNREACHABLE.
> >
> > * gcc.dg/builtin-unreachable-6.c: New test.
> > * gcc.dg/builtin-unreachable-5.c: New test.


When attempting to backport this patch to our 4.7 branch, I ran into
segmentation faults.  It turns out that at least in 4.7, gsi_stmt
crashes when passed an empty gsi (for which gsi_end_p is true);
on mainline, gsi_stmt simply returns NULL instead.

Now I understand that even on mainline, we're still supposed to check
gsi_end_p before calling gsi_stmt.  The patch below updates
tree-ssa-ccp.c:optimize_unreachable to do that.  In the backport
this fixes the crashes.

This doesn't really have any effect on behaviour on mainline.  Should
it be installed anyway?

(Tested on mainline on i386-linux with no regressions.)

In addition, I was wondering whether we should backport Tom's patch
(including the fix below) to the FSF 4.7 branch: it does fix a
(performance) regression, in the sense that the original testcase
calling __builtin_unreachable multiple times was optimized well
until 4.6, and is now again optimized well on mainline, but it
generates quite bad code on 4.7 at the moment ...

Bye,
Ulrich


ChangeLog:

* tree-ssa-ccp.c (optimize_unreachable): Check gsi_end_p
before calling gsi_stmt.

Index: gcc/tree-ssa-ccp.c
===
*** gcc/tree-ssa-ccp.c  (revision 189459)
--- gcc/tree-ssa-ccp.c  (working copy)
*** optimize_unreachable (gimple_stmt_iterat
*** 2358,2366 
FOR_EACH_EDGE (e, ei, bb->preds)
  {
gsi = gsi_last_bb (e->src);
!   stmt = gsi_stmt (gsi);
  
!   if (stmt && gimple_code (stmt) == GIMPLE_COND)
{
  if (e->flags & EDGE_TRUE_VALUE)
gimple_cond_make_false (stmt);
--- 2358,2368 
FOR_EACH_EDGE (e, ei, bb->preds)
  {
gsi = gsi_last_bb (e->src);
!   if (gsi_end_p (gsi))
!   continue;
  
!   stmt = gsi_stmt (gsi);
!   if (gimple_code (stmt) == GIMPLE_COND)
{
  if (e->flags & EDGE_TRUE_VALUE)
gimple_cond_make_false (stmt);


-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  ulrich.weig...@de.ibm.com



Re: [Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Tristan Gingold

On Jul 16, 2012, at 3:24 PM, Duncan Sands wrote:

> Hi Tristan,
> 
> On 16/07/12 15:17, Tristan Gingold wrote:
>> 
>> On Jul 16, 2012, at 3:16 PM, Duncan Sands wrote:
>> 
>>> Hi Arnaud,
>>> 
 The natural way to import a builtin that returns void * is to use
 System.Address in Ada, which is in fact an integral type.
>>> 
>>> how about doing this for formal arguments too and not just the return type?
>> 
>> Formal arguments were already handled.
> 
> indeed, for two years already.  Is there any reason not to do this for all
> functions, rather than just limiting it to builtins?

I don't understand what do you mean.  We need to do this implicit conversion 
for builtins because they are known by the compiler.  Which other functions 
(that aren't builtins) are you referring to ?

Tristan.



[PATCH, ARM] Fix length attributes for sync.md patterns

2012-07-16 Thread Ulrich Weigand
Hello,

when testing an out-of-tree patch I ran into a latent bug.
The symptom is error messages along the lines of
/tmp/cc6q0E3x.s:38: Error: co-processor offset out of range
caused by an out-of-range reference to a literal pool constant.
This happens only with -O0.

This turns out to caused by insn_and_split patterns in sync.md
used to represent atomic instructions.  Those will (must) always
be split (usually into some form of compare-and-swap loop).  If
optimization is on, this split happens shortly after reload,
before literal pool placement is finalized.

However, when building with -O0, this split is done very late;
in fact it happens *after* the machine-dependent reorg pass
where literal pools are handled.  This means that this pass
sees the atomic patterns as single insns, and unfortunately,
since they have no length attribute, they are handled as if
they had a default length of 4 bytes.

But since those patterns in the end will expand to at least
5-9 actual machine instructions, this default drastically
underestimates the code size, causing the out of range
references.

The patch below adds length attributes giving conservative
estimates of the final resulting code sizes.  (They could
probably be made more specific, but since this is relevant
only for -O0, that's probably not worth the effort.)

This fixes the problems I was seeing.

Tested on arm-linux-gnueabi with no regressions.

OK for mainline?

Bye,
Ulrich


ChangeLog:

* config/arm/sync.md (cas_length): New mode attribute.
(atomic_op_length, atomic_nand_length): Likewise.
("atomic_compare_and_swap_1"): Add length attribute.
("atomic_exchange"): Likewise.
("atomic_"): Likewise.
("atomic_nand"): Likewise.
("atomic_fetch_"): Likewise.
("atomic_fetch_nand"): Likewise.
("atomic__fetch"): Likewise.
("atomic_nand_fetch"): Likewise.

Index: gcc/config/arm/sync.md
===
*** gcc/config/arm/sync.md  (revision 189459)
--- gcc/config/arm/sync.md  (working copy)
***
*** 127,138 
{
  arm_split_compare_and_swap (operands);
  DONE;
!   })
  
  (define_mode_attr cas_cmp_operand
[(SI "arm_add_operand") (DI "cmpdi_operand")])
  (define_mode_attr cas_cmp_str
[(SI "rIL") (DI "rDi")])
  
  (define_insn_and_split "atomic_compare_and_swap_1"
[(set (reg:CC_Z CC_REGNUM)  ;; bool out
--- 127,141 
{
  arm_split_compare_and_swap (operands);
  DONE;
!   }
!   [(set_attr "length" "32")])
  
  (define_mode_attr cas_cmp_operand
[(SI "arm_add_operand") (DI "cmpdi_operand")])
  (define_mode_attr cas_cmp_str
[(SI "rIL") (DI "rDi")])
+ (define_mode_attr cas_length
+   [(SI "32") (DI "44")])
  
  (define_insn_and_split "atomic_compare_and_swap_1"
[(set (reg:CC_Z CC_REGNUM)  ;; bool out
***
*** 155,161 
{
  arm_split_compare_and_swap (operands);
  DONE;
!   })
  
  (define_insn_and_split "atomic_exchange"
[(set (match_operand:QHSD 0 "s_register_operand" "=&r") ;; output
--- 158,165 
{
  arm_split_compare_and_swap (operands);
  DONE;
!   }
!   [(set_attr "length" "")])
  
  (define_insn_and_split "atomic_exchange"
[(set (match_operand:QHSD 0 "s_register_operand" "=&r") ;; output
***
*** 175,181 
  arm_split_atomic_op (SET, operands[0], NULL, operands[1],
 operands[2], operands[3], operands[4]);
  DONE;
!   })
  
  (define_mode_attr atomic_op_operand
[(QI "reg_or_int_operand")
--- 179,186 
  arm_split_atomic_op (SET, operands[0], NULL, operands[1],
 operands[2], operands[3], operands[4]);
  DONE;
!   }
!   [(set_attr "length" "20")])
  
  (define_mode_attr atomic_op_operand
[(QI "reg_or_int_operand")
***
*** 186,191 
--- 191,199 
  (define_mode_attr atomic_op_str
[(QI "rn") (HI "rn") (SI "rn") (DI "r")])
  
+ (define_mode_attr atomic_op_length
+   [(QI "24") (HI "24") (SI "24") (DI "28")])
+ 
  (define_insn_and_split "atomic_"
[(set (match_operand:QHSD 0 "mem_noofs_operand" "+Ua")
(unspec_volatile:QHSD
***
*** 204,210 
  arm_split_atomic_op (, NULL, operands[3], operands[0],
 operands[1], operands[2], operands[4]);
  DONE;
!   })
  
  (define_insn_and_split "atomic_nand"
[(set (match_operand:QHSD 0 "mem_noofs_operand" "+Ua")
--- 212,222 
  arm_split_atomic_op (, NULL, operands[3], operands[0],
 operands[1], operands[2], operands[4]);
  DONE;
!   }
!   [(set_attr "length" "")])
! 
! (define_mode_attr atomic_nand_length
!   [(QI "28") (HI "28") (SI "28") (DI "32")])
  
  (define_insn_and_split "atomic_nand"
[(set (match_operand:QHSD 0 "mem_noofs_operand" "+Ua")
***
*** 225,231 
  arm_split_atomic_op (NOT, NULL, o

Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-07-16 Thread Kai Tietz
Hi,

I would kindly ask to revert this patch soonish.  The define
OPTION_BIONIC is defined within linux.h header, which isn't used by
cygwin and mingw targets.  so this symbol is undefined for them and
this is causing bootstrap issue for cygwin and mingw targets.

Regards,
Kai


Re: [Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Duncan Sands

Hi Tristan,

On 16/07/12 15:17, Tristan Gingold wrote:


On Jul 16, 2012, at 3:16 PM, Duncan Sands wrote:


Hi Arnaud,


The natural way to import a builtin that returns void * is to use
System.Address in Ada, which is in fact an integral type.


how about doing this for formal arguments too and not just the return type?


Formal arguments were already handled.


indeed, for two years already.  Is there any reason not to do this for all
functions, rather than just limiting it to builtins?

Ciao, Duncan.



Tristan.


This would improve optimization by LLVM of calls to standard library functions
since the optimizers bail out when they see an "int" parameter where normally
there would be a void* (or other pointer type).

Ciao, Duncan.



Addressed by this patch, which makes it possible to e.g. compile:

with System;
procedure Btins1 is

function Frame_Address (Level : Integer) return System.Address;
pragma Import (Intrinsic, Frame_Address, "__builtin_frame_address");

Ptr : System.Address;
pragma Volatile (Ptr);
begin
Ptr := Frame_Address (0);
end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-07-16  Tristan Gingold  

* gcc-interface/decl.c (intrin_return_compatible_p): Map Address to
void *.











Re: [Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Tristan Gingold

On Jul 16, 2012, at 3:16 PM, Duncan Sands wrote:

> Hi Arnaud,
> 
>> The natural way to import a builtin that returns void * is to use
>> System.Address in Ada, which is in fact an integral type.
> 
> how about doing this for formal arguments too and not just the return type?

Formal arguments were already handled.

Tristan.

> This would improve optimization by LLVM of calls to standard library functions
> since the optimizers bail out when they see an "int" parameter where normally
> there would be a void* (or other pointer type).
> 
> Ciao, Duncan.
> 
>> 
>> Addressed by this patch, which makes it possible to e.g. compile:
>> 
>> with System;
>> procedure Btins1 is
>> 
>>function Frame_Address (Level : Integer) return System.Address;
>>pragma Import (Intrinsic, Frame_Address, "__builtin_frame_address");
>> 
>>Ptr : System.Address;
>>pragma Volatile (Ptr);
>> begin
>>Ptr := Frame_Address (0);
>> end;
>> 
>> Tested on x86_64-pc-linux-gnu, committed on trunk
>> 
>> 2012-07-16  Tristan Gingold  
>> 
>>  * gcc-interface/decl.c (intrin_return_compatible_p): Map Address to
>>  void *.
>> 
> 
> 



Re: [Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Duncan Sands

Hi Arnaud,


The natural way to import a builtin that returns void * is to use
System.Address in Ada, which is in fact an integral type.


how about doing this for formal arguments too and not just the return type?
This would improve optimization by LLVM of calls to standard library functions
since the optimizers bail out when they see an "int" parameter where normally
there would be a void* (or other pointer type).

Ciao, Duncan.



Addressed by this patch, which makes it possible to e.g. compile:

with System;
procedure Btins1 is

function Frame_Address (Level : Integer) return System.Address;
pragma Import (Intrinsic, Frame_Address, "__builtin_frame_address");

Ptr : System.Address;
pragma Volatile (Ptr);
begin
Ptr := Frame_Address (0);
end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-07-16  Tristan Gingold  

* gcc-interface/decl.c (intrin_return_compatible_p): Map Address to
void *.






PING: PR middle-end/53321: [4.8 Regression] LTO bootstrap failed with bootstrap-profiled

2012-07-16 Thread H.J. Lu
On Fri, Jul 6, 2012 at 9:08 PM, H.J. Lu  wrote:
> Hi,
>
> After inlining, IPA calls tree_profiling which rebuilds edges:
>
> #2  0x00683ccd in rebuild_cgraph_edges ()
> at /export/gnu/import/git/gcc/gcc/cgraphbuild.c:433
> #3  0x00c02de6 in tree_profiling ()
> at /export/gnu/import/git/gcc/gcc/tree-profile.c:564
> #4  0x00a1be4f in execute_one_pass (pass=0x1908520)
> at /export/gnu/import/git/gcc/gcc/passes.c:2165
> #5  0x00a1cb0c in execute_ipa_pass_list (pass=0x1908520)
> at /export/gnu/import/git/gcc/gcc/passes.c:2532
> #6  0x0068b874 in ipa_passes ()
> at /export/gnu/import/git/gcc/gcc/cgraphunit.c:1844
>
>   basic_block bb;
>   struct cgraph_node *node = cgraph_get_node (current_function_decl);
>   gimple_stmt_iterator gsi;
>
>   cgraph_node_remove_callees (node);
>   ipa_remove_all_references (&node->symbol.ref_list);
>
>   node->count = ENTRY_BLOCK_PTR->count;
>
> and creates new edges.  After that, all things went downhill
>
> #0  internal_error (
> gmsgid=0x158c110 "vector %s %s domain error, in %s at %s:%u")
> at /export/gnu/import/git/gcc/gcc/diagnostic.c:955
> #1  0x0124f707 in vec_assert_fail (op=0x12fc800 "index",
> struct_name=0x12fc7e0 "VEC(inline_edge_summary_t,base)",
> file=0x12fc808 "/export/gnu/import/git/gcc/gcc/ipa-inline.h",
> line=200,
> function=0x12fd380 "inline_edge_summary")
> at /export/gnu/import/git/gcc/gcc/vec.c:527
> #2  0x0067c685 in VEC_inline_edge_summary_t_base_index (
> vec_=0x1aea360, ix_=6,
> file_=0x12fc808 "/export/gnu/import/git/gcc/gcc/ipa-inline.h",
> line_=200,
> function_=0x12fd380 "inline_edge_summary")
> at /export/gnu/import/git/gcc/gcc/ipa-inline.h:145
> #3  0x0067c6cd in inline_edge_summary (edge=0x71ab67b8)
> at /export/gnu/import/git/gcc/gcc/ipa-inline.h:199
>
> since inline summary becomes stale after gimple_gen_ic_func_profiler
> generates profiling function calls.  If we don't call
> cgraph_propagate_frequency call when something was changed, LTO will
> generate corrupted output, which leads to
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53865
>
> This patch clears stale inline summary after gimple_gen_ic_func_profiler
> generates profiling function calls.   It fixes both PR 53321 and PR 53865.
> OK to install?
>
> Thanks.
>
>
> H.J.
> 
> 2012-07-06  H.J. Lu  
>
> PR middle-end/53321
> PR middle-end/53865
> * Makefile.in (tree-profile.o): Depend on ipa-inline.h.
>
> * ipa.c (symtab_remove_unreachable_nodes): Restore
> cgraph_propagate_frequency call when something was changed.
>
> * tree-profile.c: Include "ipa-inline.h".
> (gimple_gen_ic_func_profiler): Return bool.
> (tree_profiling): Call inline_free_summary to clear stale inline
> summary if gimple_gen_ic_func_profiler returns true.
>
> * value-prof.h (gimple_gen_ic_func_profiler): Change return
> type to bool.
>
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index 33775ac..9f6c7e5 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -3060,7 +3060,8 @@ mcf.o : mcf.c profile.h $(CONFIG_H) $(SYSTEM_H) $(TM_H) 
> coretypes.h \
> $(BASIC_BLOCK_H) langhooks.h $(GCOV_IO_H) $(TREE_H)
>  tree-profile.o : tree-profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
> $(TM_H) $(TARGET_H) $(TREE_H) $(FLAGS_H) $(FUNCTION_H) \
> -   $(BASIC_BLOCK_H) $(DIAGNOSTIC_CORE_H) $(COVERAGE_H) $(TREE_H) 
> value-prof.h $(TREE_DUMP_H) \
> +   $(BASIC_BLOCK_H) $(DIAGNOSTIC_CORE_H) $(COVERAGE_H) $(TREE_H) \
> +   value-prof.h $(TREE_DUMP_H) ipa-inline.h \
> $(TREE_PASS_H) $(TREE_FLOW_H) $(TIMEVAR_H) gt-tree-profile.h $(CGRAPH_H)
>  value-prof.o : value-prof.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
> $(BASIC_BLOCK_H) hard-reg-set.h profile.h value-prof.h $(EXPR_H) 
> $(FLAGS_H) \
> diff --git a/gcc/ipa.c b/gcc/ipa.c
> index 09351a7..f5cce1b 100644
> --- a/gcc/ipa.c
> +++ b/gcc/ipa.c
> @@ -449,6 +449,11 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, 
> FILE *file)
>verify_symtab ();
>  #endif
>
> +  /* If we removed something, perhaps profile could be improved.  */
> +  if (changed && optimize && inline_edge_summary_vec)
> +FOR_EACH_DEFINED_FUNCTION (node)
> +  cgraph_propagate_frequency (node);
> +
>return changed;
>  }
>
> diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
> index dfd0ef0..b90ab92 100644
> --- a/gcc/tree-profile.c
> +++ b/gcc/tree-profile.c
> @@ -42,6 +42,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "timevar.h"
>  #include "value-prof.h"
>  #include "cgraph.h"
> +#include "ipa-inline.h"
>  #include "profile.h"
>  #include "target.h"
>
> @@ -357,7 +358,7 @@ gimple_gen_ic_profiler (histogram_value value, unsigned 
> tag, unsigned base)
> beginning of every possible called function.
>*/
>
> -void
> +bool
>  gimple_gen_ic_func_profiler (void)
>  {
>struct cgraph_node * c_node = cgraph_get_node 

[Ada] Ease interface with builtins that returns void *

2012-07-16 Thread Arnaud Charlet
The natural way to import a builtin that returns void * is to use
System.Address in Ada, which is in fact an integral type.

Addressed by this patch, which makes it possible to e.g. compile:

with System;
procedure Btins1 is

   function Frame_Address (Level : Integer) return System.Address;
   pragma Import (Intrinsic, Frame_Address, "__builtin_frame_address");

   Ptr : System.Address;
   pragma Volatile (Ptr);
begin
   Ptr := Frame_Address (0);
end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-07-16  Tristan Gingold  

* gcc-interface/decl.c (intrin_return_compatible_p): Map Address to 
void *.

Index: gcc-interface/decl.c
===
--- gcc-interface/decl.c(revision 189524)
+++ gcc-interface/decl.c(working copy)
@@ -8046,6 +8046,10 @@
   && !VOID_TYPE_P (btin_return_type))
 return true;
 
+  /* If return type is Address (integer type), map it to void *.  */
+  if (Is_Descendent_Of_Address (Etype (inb->gnat_entity)))
+ada_return_type = ptr_void_type_node;
+
   /* Check return types compatibility otherwise.  Note that this
  handles void/void as well.  */
   if (intrin_types_incompatible_p (btin_return_type, ada_return_type))


[Ada] Coverage analysis of select statements

2012-07-16 Thread Arnaud Charlet
This change introduces generation of a null statement in alternatives
appearing in various forms of select statement, when they do not have
trailing statements. The purpose of the additional null statement is
to allow a nop to be generated with an appropriate source location indication
in debug information, for coverage analysis purposes.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-07-16  Thomas Quinot  

* exp_ch9.adb (Ensure_Statement_Present): New subprogram.
(Expand_N_Asynchronous_Select,
Expand_N_Selective_Accept.Process_Accept_Alternative,
Expand_N_Selective_Accept.Process_Delay_Alternative,
Expand_N_Timed_Entry_Call): For an alternative with no trailing
statements, introduce a null statement to carry the sloc of
the initial special statement (accept, delay, or entry call)
in the alternative, for coverage analysis purposes.

Index: exp_ch9.adb
===
--- exp_ch9.adb (revision 189534)
+++ exp_ch9.adb (revision 189535)
@@ -339,6 +339,17 @@
--  step of the expansion must to be done after private data has been moved
--  to its final resting scope to ensure proper visibility of debug objects.
 
+   procedure Ensure_Statement_Present (Loc : Source_Ptr; Alt : Node_Id);
+   --  If control flow optimizations are suppressed, and Alt is an accept,
+   --  delay, or entry call alternative with no trailing statements, insert a
+   --  null trailing statement with the given Loc (which is the sloc of the
+   --  accept, delay, or entry call statement). There might not be any
+   --  generated code for the accept, delay, or entry call itself (the
+   --  effect of these statements is part of the general processsing done
+   --  for the enclosing selective accept, timed entry call, or asynchronous
+   --  select), and the null statement is there to carry the sloc of that
+   --  statement to the back-end for trace-based coverage analysis purposes.
+
procedure Extract_Dispatching_Call
  (N: Node_Id;
   Call_Ent : out Entity_Id;
@@ -5468,6 +5479,19 @@
   end loop;
end Debug_Private_Data_Declarations;
 
+   --
+   -- Ensure_Statement_Present --
+   --
+
+   procedure Ensure_Statement_Present (Loc : Source_Ptr; Alt : Node_Id) is
+   begin
+  if Opt.Suppress_Control_Flow_Optimizations
+   and then Is_Empty_List (Statements (Alt))
+  then
+ Set_Statements (Alt, New_List (Make_Null_Statement (Loc)));
+  end if;
+   end Ensure_Statement_Present;
+

-- Entry_Index_Expression --

@@ -6587,7 +6611,7 @@
   Abortable_Block   : Node_Id;
   Actuals   : List_Id;
   Astats: List_Id;
-  Blk_Ent   : Entity_Id;
+  Blk_Ent   : constant Entity_Id := Make_Temporary (Loc, 'A');
   Blk_Typ   : Entity_Id;
   Call  : Node_Id;
   Call_Ent  : Entity_Id;
@@ -6632,15 +6656,16 @@
   Process_Statements_For_Controlled_Objects (Trig);
   Process_Statements_For_Controlled_Objects (Abrt);
 
+  Ecall := Triggering_Statement (Trig);
+
+  Ensure_Statement_Present (Sloc (Ecall), Trig);
+
   --  Retrieve Astats and Tstats now because the finalization machinery may
   --  wrap them in blocks.
 
   Astats := Statements (Abrt);
   Tstats := Statements (Trig);
 
-  Blk_Ent := Make_Temporary (Loc, 'A');
-  Ecall   := Triggering_Statement (Trig);
-
   --  The arguments in the call may require dynamic allocation, and the
   --  call statement may have been transformed into a block. The block
   --  may contain additional declarations for internal entities, and the
@@ -10301,6 +10326,8 @@
 Alt_Stats := New_List;
  end if;
 
+ Ensure_Statement_Present (Sloc (Astmt), Alt);
+
  --  After the call, if any, branch to trailing statements, if any.
  --  We create a label for each, as well as the corresponding label
  --  declaration.
@@ -10330,6 +10357,7 @@
   ---
 
   procedure Process_Delay_Alternative (Alt : Node_Id; Index : Int) is
+ Dloc  : constant Source_Ptr := Sloc (Delay_Statement (Alt));
  Choices   : List_Id;
  Cond  : Node_Id;
  Delay_Alt : List_Id;
@@ -10433,6 +10461,8 @@
 
  Append_List (Delay_Alt, Delay_List);
 
+ Ensure_Statement_Present (Dloc, Alt);
+
  --  If the delay alternative has a statement part, add choice to the
  --  case statements for delays.
 
@@ -11884,6 +11914,8 @@
   Process_Statements_For_Controlled_Objects (E_Alt);
   Process_Statements_For_Controlled_Objects (D_Alt);
 
+  Ensure_Statement_Present (Sloc (D_Stat), D_Alt);
+
   --  Retrieve E_Stats and D_Stats now because the finalization machinery

[Ada] Cleanup of selective accept expansion

2012-07-16 Thread Arnaud Charlet
This change reorganizes code generation for selective accept statements so
that the expanded tree is well formed. This cleanup is desirable in preparation
for further changes related to coverage analysis.

No observable change in generated code's behaviour.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-07-16  Thomas Quinot  

* exp_ch9.adb (Expand_N_Selective_Accept.Process_Accept_Alternative):
Remove junk test that was always true. For the case of no statements
following the ACCEPT, jump directly to End_Lab instead of
introducing an intermediate jump.
(Expand_N_Selective_Accept.Process_Delay_Alternative): Fix
predicate testing for presence of statements following the DELAY.
that was always true. For the case of no statements following
the ACCEPT, jump directly to End_Lab instead of introducing an
intermediate jump.
(Expand_N_Selective_Accept): Fix incorrect insertion point for
end label.

Index: exp_ch9.adb
===
--- exp_ch9.adb (revision 189524)
+++ exp_ch9.adb (working copy)
@@ -3165,7 +3165,6 @@
   end if;
 
   --  Generate:
-
   --if System.Atomic_Primitives.Lock_Free_Try_Write_N
   -- (_Object.Comp'Address,
   --  Interfaces.Unsigned_N (Expected_Comp),
@@ -3177,7 +3176,7 @@
   --end if;
 
   Rewrite (Stmt,
-Make_If_Statement (Loc,
+Make_Implicit_If_Statement (N,
   Condition =>
 Make_Function_Call (Loc,
   Name   =>
@@ -3294,7 +3293,6 @@
 end case;
 
 --  Generate:
-
 --  Expected_Comp : constant Comp_Type :=
 --Comp_Type
 --  (System.Atomic_Primitives.Lock_Free_Read_N
@@ -3381,7 +3379,6 @@
 Process_Stmts (Stmts);
 
 --  Generate:
-
 --exit when System.Atomic_Primitives.Lock_Free_Try_Write_N
 --(_Object.Comp'Address,
 -- Interfaces.Unsigned_N (Expected_Comp),
@@ -3428,7 +3425,6 @@
 end if;
 
 --  Generate:
-
 --loop
 --   declare
 --  
@@ -4788,7 +4784,7 @@
 
  Rewrite (N,
Make_Block_Statement (Loc,
- Declarations => Decls,
+ Declarations   => Decls,
  Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
  Statements => Stats)));
@@ -4838,7 +4834,7 @@
  Name => Name,
  Parameter_Associations =>
New_List (Make_Attribute_Reference (Loc,
- Prefix => New_Occurrence_Of (Chain, Loc),
+ Prefix => New_Occurrence_Of (Chain, Loc),
  Attribute_Name => Name_Unchecked_Access)));
 
  if Nkind (N) = N_Package_Declaration then
@@ -4954,7 +4950,7 @@
   Name => New_Reference_To (RTE (RE_Activate_Tasks), Loc),
   Parameter_Associations => New_List (
 Make_Attribute_Reference (Loc,
-  Prefix => New_Reference_To (Chain, Loc),
+  Prefix => New_Reference_To (Chain, Loc),
   Attribute_Name => Name_Unchecked_Access),
 
   Has_Created_Identifier => True,
@@ -4991,7 +4987,7 @@
   Name => New_Reference_To (RTE (RE_Activate_Tasks), Loc),
   Parameter_Associations => New_List (
 Make_Attribute_Reference (Loc,
-  Prefix => New_Reference_To (Chain, Loc),
+  Prefix => New_Reference_To (Chain, Loc),
   Attribute_Name => Name_Unchecked_Access;
 
   Block :=
@@ -5229,8 +5225,8 @@
   Formal   : Entity_Id;
 
begin
-  --  If the result type is an access_to_subprogram, we must create
-  --  new entities for its spec.
+  --  If the result type is an access_to_subprogram, we must create new
+  --  entities for its spec.
 
   if Nkind (New_Res) = N_Access_Definition
 and then Present (Access_To_Subprogram_Definition (New_Res))
@@ -5354,9 +5350,7 @@
  Make_Explicit_Dereference (Loc, N)),
  Selector_Name => Make_Identifier (Loc, Sel));
 
-  elsif Is_Entity_Name (N)
-and then Is_Concurrent_Type (Entity (N))
-  then
+  elsif Is_Entity_Name (N) and then Is_Concurrent_Type (Entity (N)) then
  if Is_Task_Type (Entity (N)) then
 
 if Is_Current_Task (Entity (N)) then
@@ -5442,9 +5436,7 @@
 
begin
   Decl := First (Decls);
-  while Present (Decl)
-and then not Comes_From_Source (Decl)
-  loop
+  while Present (Decl)

[Ada] Explicitly pass exception occurrence to notifiers

2012-07-16 Thread Arnaud Charlet
This is an internal cleanup and preliminary to removal of useless ada
occurrence copy.
No functional change.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-07-16  Tristan Gingold  

* a-exexpr.adb (Propagate_Exception): Adjust call to
Exception_Traces procedures.
* a-exexpr-gcc.adb (Setup_Current_Excep): Now a
function that returns an access to the Ada occurrence.
(Propagate_GCC_Exception): Adjust calls.
* raise.h (struct Exception_Occurrence): Declare.
* a-exextr.adb: Remove useless pragma.  (Notify_Handled_Exception,
Notify_Unhandled_Exception) (Unhandled_Exception_Terminate):
Add Excep parameter.
* a-except.adb (Notify_Handled_Exception,
Notify_Unhandled_Exception) (Unhandled_Exception_Terminate):
Add Excep parameter.
(Process_Raise_Exception): Adjust calls.
* a-except-2005.adb (Notify_Handled_Exception,
Notify_Unhandled_Exception) (Unhandled_Exception_Terminate): Add
Excep parameter.
(Raise_Exception): Calls Raise_Exception_Always.
* raise-gcc.c (__gnat_setup_current_excep,
__gnat_notify_handled_exception)
(__gnat_notify_unhandled_exception): Adjust declarations.
(PERSONALITY_FUNCTION): Adjust calls.
(__gnat_personality_seh0): Remove warning.

Index: a-exexpr.adb
===
--- a-exexpr.adb(revision 189530)
+++ a-exexpr.adb(working copy)
@@ -43,7 +43,7 @@
pragma No_Return (builtin_longjmp);
pragma Import (Intrinsic, builtin_longjmp, "__builtin_longjmp");
 
-   procedure Propagate_Continue (Excep : EOA);
+   procedure Propagate_Continue (E : Exception_Id);
pragma No_Return (Propagate_Continue);
pragma Export (C, Propagate_Continue, "__gnat_raise_nodefer_with_msg");
--  A call to this procedure is inserted automatically by GIGI, in order
@@ -74,14 +74,14 @@
   if Jumpbuf_Ptr /= Null_Address then
  if not Excep.Exception_Raised then
 Excep.Exception_Raised := True;
-Exception_Traces.Notify_Handled_Exception;
+Exception_Traces.Notify_Handled_Exception (Excep);
  end if;
 
  builtin_longjmp (Jumpbuf_Ptr, 1);
 
   else
- Exception_Traces.Notify_Unhandled_Exception;
- Exception_Traces.Unhandled_Exception_Terminate;
+ Exception_Traces.Notify_Unhandled_Exception (Excep);
+ Exception_Traces.Unhandled_Exception_Terminate (Excep);
   end if;
end Propagate_Exception;
 
@@ -89,9 +89,10 @@
-- Propagate_Continue --

 
-   procedure Propagate_Continue (Excep : EOA) is
+   procedure Propagate_Continue (E : Exception_Id) is
+  pragma Unreferenced (E);
begin
-  Propagate_Exception (Excep);
+  Propagate_Exception (Get_Current_Excep.all);
end Propagate_Continue;
 
 end Exception_Propagation;
Index: raise.h
===
--- raise.h (revision 189524)
+++ raise.h (working copy)
@@ -49,6 +49,8 @@
 
 typedef struct Exception_Data *Exception_Id;
 
+struct Exception_Occurrence;
+
 extern void _gnat_builtin_longjmp  (void *, int);
 extern void __gnat_unhandled_terminate (void);
 extern void *__gnat_malloc (__SIZE_TYPE__);
Index: a-exexpr-gcc.adb
===
--- a-exexpr-gcc.adb(revision 189530)
+++ a-exexpr-gcc.adb(working copy)
@@ -202,8 +202,9 @@
--  Called to implement raise without exception, ie reraise.  Called
--  directly from gigi.
 
-   procedure Setup_Current_Excep
- (GCC_Exception : not null GCC_Exception_Access);
+   function Setup_Current_Excep
+ (GCC_Exception : not null GCC_Exception_Access)
+ return EOA;
pragma Export (C, Setup_Current_Excep, "__gnat_setup_current_excep");
--  Write Get_Current_Excep.all from GCC_Exception
 
@@ -342,8 +343,9 @@
-- Setup_Current_Excep --
-
 
-   procedure Setup_Current_Excep
+   function Setup_Current_Excep
  (GCC_Exception : not null GCC_Exception_Access)
+ return EOA
is
   Excep : constant EOA := Get_Current_Excep.all;
 
@@ -359,6 +361,8 @@
 To_GNAT_GCC_Exception (GCC_Exception);
  begin
 Excep.all := GNAT_Occurrence.Occurrence;
+
+return GNAT_Occurrence.Occurrence'Access;
  end;
   else
 
@@ -370,6 +374,8 @@
  Excep.Exception_Raised := True;
  Excep.Pid := Local_Partition_ID;
  Excep.Num_Tracebacks := 0;
+
+ return Excep;
   end if;
end Setup_Current_Excep;
 
@@ -420,6 +426,7 @@
procedure Propagate_GCC_Exception
  (GCC_Exception : not null GCC_Exception_Access)
is
+  Excep : EOA;
begin
   --  Perform a standard raise first. If a regular handler is found, it
   --  will be entered after all the 

[Ada] Improve support of Storage_Error for Windows 64 SEH

2012-07-16 Thread Arnaud Charlet
Work to support Windows 64 SEH: allow to convert an exception code
to an Ada exception ID and message; Optimize the propagation of Storage_Error
on Windows 64 SEH to avoid requiring a too large stack area.

2012-07-16  Tristan Gingold  

* seh_init.c (__gnat_map_SEH): New function extracted from
__gnat_SEH_error_handler.
* raise-gcc.c: __gnat_personality_seh0: Directly transforms
Windows system exception into GCC one when possible, in order
to save stack room (particularly useful when Storage_Error will
be propagated).

Index: raise-gcc.c
===
--- raise-gcc.c (revision 189524)
+++ raise-gcc.c (working copy)
@@ -1213,9 +1213,23 @@
 #ifdef __SEH__
 
 #define STATUS_USER_DEFINED(1U << 29)
+
+/* From unwind-seh.c.  */
+#define GCC_MAGIC  (('G' << 16) | ('C' << 8) | 'C')
+#define GCC_EXCEPTION(TYPE)\
+   (STATUS_USER_DEFINED | ((TYPE) << 24) | GCC_MAGIC)
+#define STATUS_GCC_THROW   GCC_EXCEPTION (0)
+
 EXCEPTION_DISPOSITION __gnat_SEH_error_handler
  (struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
 
+struct Exception_Data *
+__gnat_map_SEH (EXCEPTION_RECORD* ExceptionRecord, const char **msg);
+
+struct _Unwind_Exception *
+__gnat_create_machine_occurrence_from_signal_handler (Exception_Id,
+ const char *);
+
 /* Unwind opcodes.  */
 #define UWOP_PUSH_NONVOL 0
 #define UWOP_ALLOC_LARGE 1
@@ -1295,7 +1309,10 @@
  exceptions.  */
   if (!(ms_exc->ExceptionCode & STATUS_USER_DEFINED))
 {
+  struct Exception_Data *exception;
+  const char *msg;
   ULONG64 excpip = (ULONG64) ms_exc->ExceptionAddress;
+
   if (excpip != 0
  && excpip >= (ms_disp->ImageBase
+ ms_disp->FunctionEntry->BeginAddress)
@@ -1353,7 +1370,26 @@
__gnat_adjust_context
  ((unsigned char *)(mf_imagebase + mf_func->UnwindData), mf_rsp);
}
-  __gnat_SEH_error_handler (ms_exc, this_frame, ms_orig_context, ms_disp);
+
+  exception = __gnat_map_SEH (ms_exc, &msg);
+  if (exception != NULL)
+   {
+ struct _Unwind_Exception *exc;
+
+ /* Directly convert the system exception to a GCC one.
+This is really breaking the API, but is necessary for stack size
+reasons: the normal way is to call Raise_From_Signal_Handler,
+which build the exception and calls _Unwind_RaiseException, which
+unwinds the stack and will call this personality routine. But
+the Windows unwinder needs about 2KB of stack.  */
+ exc = __gnat_create_machine_occurrence_from_signal_handler
+   (exception, msg);
+ memset (exc->private_, 0, sizeof (exc->private_));
+ ms_exc->ExceptionCode = STATUS_GCC_THROW;
+ ms_exc->NumberParameters = 1;
+ ms_exc->ExceptionInformation[0] = (ULONG_PTR)exc;
+   }
+
 }
 
   return _GCC_specific_handler (ms_exc, this_frame, ms_orig_context,
Index: seh_init.c
===
--- seh_init.c  (revision 189524)
+++ seh_init.c  (working copy)
@@ -68,20 +68,21 @@
 #include 
 #include 
 
+/* Prototypes.  */
 extern void _global_unwind2 (void *);
 
 EXCEPTION_DISPOSITION __gnat_SEH_error_handler
 (struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
 
-EXCEPTION_DISPOSITION
-__gnat_SEH_error_handler (struct _EXCEPTION_RECORD* ExceptionRecord,
- void *EstablisherFrame,
- struct _CONTEXT* ContextRecord ATTRIBUTE_UNUSED,
- void *DispatcherContext ATTRIBUTE_UNUSED)
+struct Exception_Data *
+__gnat_map_SEH (EXCEPTION_RECORD* ExceptionRecord, const char **msg);
+
+/* Convert an SEH exception to an Ada one.  Return the exception ID
+   and set MSG with the corresponding message.  */
+
+struct Exception_Data *
+__gnat_map_SEH (EXCEPTION_RECORD* ExceptionRecord, const char **msg)
 {
-  struct Exception_Data *exception;
-  const char *msg;
-
   switch (ExceptionRecord->ExceptionCode)
 {
 case EXCEPTION_ACCESS_VIOLATION:
@@ -92,93 +93,95 @@
  || IsBadCodePtr
  ((void *)(ExceptionRecord->ExceptionInformation[1] + 4096)))
{
- exception = &program_error;
- msg = "EXCEPTION_ACCESS_VIOLATION";
+ *msg = "EXCEPTION_ACCESS_VIOLATION";
+ return &program_error;
}
   else
{
  /* otherwise it is a stack overflow  */
- exception = &storage_error;
- msg = "stack overflow or erroneous memory access";
+ *msg = "stack overflow or erroneous memory access";
+ return &storage_error;
}
-  break;
 
 case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
-  exception = &constraint_error;
-  msg = "EXCEPTION_ARRAY_BOUNDS_EXCEEDED";
-  break;
+  *msg = "EXCEPTION_ARRAY_BOUNDS_E

[Ada] Introduce the notion of machine occurrence

2012-07-16 Thread Arnaud Charlet
This is preliminary work to have a better support of foreign exceptions and
of Windows 64 SEH. This patch introduce the notion of machine occurrence,
which is the system exception propagated. This occurrence is allocated before
setting up the Ada occurrence, which slightly speed-up occurrence setup.
Previously, the Ada occurrence was built in the ATCB and then copied to a
newly allocated machine occurrence.

No testcase as there is no behavioral change.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-07-16  Tristan Gingold  

* a-exexpr.adb (Propagate_Continue): New function replacing
Raise_Current_Excep.
(Allocate_Occurrence): New function.
(Propagate_Exception): Add Excep parameter, remove call to Call_Chain.
* a-exexpr-gcc.adb (GNAT_GCC_Exception): Occurrence component
is now aliased.
(To_GCC_Exception): Convert from Address.
(Allocate_Occurrence): Allocate an Unwind exception occurrence.
(Setup_Current_Excep): Fill the machine occurrence in case of
foreign exception.
(Propagate_Exception): Add Excep parameter, remove call to Call_Chain.
* a-except.adb (Set_Exception_C_Msg, Set_Exception_Msg): add
Excep parameter.
(Raise_Exception, Raise_Exception_Always,
Raise_Exception_No_Defer): Adjust calls to the above procedures.
(Raise_From_Signal_Handler, Raise_With_Location_And_Msg)
(Rcheck_PE_Finalize_Raised_Exception): Likewise.
* a-except-2005.adb (Set_Exception_C_Msg, Set_Exception_Msg):
add Excep parameter.
(Propagate_Exception): Likewise.
(Allocate_Occurrence): New function.
(Raise_Current_Excep): Removed.
(Complete_Occurrence): New function to save the call chain.
(Complete_And_Propagate_Occurrence): New procedure.
(Create_Occurrence_From_Signal_Handler): New function to build an
occurrence without propagating it.
(Create_Machine_Occurrence_From_Signal_Handler): Likewise, but
return the machine occurrence.
(Raise_From_Signal_Handler): Use Create_Occurrence_From_Signal_Handler.
(Raise_Exception, Raise_Exception_Always, Raise_Exception_No_Defer):
Adjust calls to the above procedures. Allocate the occurrence at
the beginning.
(Raise_With_Location_And_Msg, Raise_With_Msg)
(Rcheck_PE_Finalize_Raised_Exceptionm Reraise): Likewise.
(Reraise_Occurrence): Use Reraise_Occurrence_Always.
(Reraise_Occurrence_Always): Use Reraise_Occurrence_No_Defer.
(Reraise_Occurrence_No_Defer): Preserve machine occurrence.
(Save_Occurrence): Do not save machine occurrence.
* a-except-2005.ads (Exception_Occurrence): Add Machine_Occurrence
component.
(Null_Occurrence): Consider it.
* a-exexda.adb (Set_Exception_C_Msg, Set_Exception_Msg): add
Excep parameter.

Index: a-exexpr.adb
===
--- a-exexpr.adb(revision 189524)
+++ a-exexpr.adb(working copy)
@@ -6,7 +6,7 @@
 --  --
 -- B o d y  --
 --  --
---  Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+--  Copyright (C) 1992-2012, Free Software Foundation, Inc. --
 --  --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -43,42 +43,29 @@
pragma No_Return (builtin_longjmp);
pragma Import (Intrinsic, builtin_longjmp, "__builtin_longjmp");
 
+   procedure Propagate_Continue (Excep : EOA);
+   pragma No_Return (Propagate_Continue);
+   pragma Export (C, Propagate_Continue, "__gnat_raise_nodefer_with_msg");
+   --  A call to this procedure is inserted automatically by GIGI, in order
+   --  to continue the propagation when the exception was not handled.
+   --  The linkage name is historical.
+
-
-   -- Propagate_Exception --
+   -- Allocate_Occurrence --
-
 
-   procedure Propagate_Exception
-   is
-  Jumpbuf_Ptr : constant Address := Get_Jmpbuf_Address.all;
-  Excep   : constant EOA := Get_Current_Excep.all;
+   function Allocate_Occurrence return EOA is
begin
-  --  Compute the backtrace for this occurrence if corresponding binder
-  --  option has been set. Call_Chain takes care of the reraise case.
+  return Get_Current_Excep.all;
+   end Allocate_Occurrence;
 
-  Call_Chain (Excep);
+   -
+   -- Propagate_Exception --
+   -
 
-  --  Note on above call to Call_Chain:
-
-  --  We used to

Re: [PATCH, Android] Runtime stack protector enabling for Android target

2012-07-16 Thread Rainer Emrich
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I'm not sure if that's related, but for x86_64-w64-mingw32 bootstrap fails in
stage 1:

gcc -c -g -DIN_GCC -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual
- -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wc++-compat
- -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../../src/gcc-4.8.0/gcc
- -I../../../src/gcc-4.8.0/gcc/build -I../../../src/gcc-4.8.0/gcc/../include
- -I./../intl -I../../../src/gcc-4.8.0/gcc/../libcpp/include
- -I/SCRATCH/tmp.xipisatGtI/install/include
- -I/SCRATCH/tmp.xipisatGtI/install/include
- -I/SCRATCH/tmp.xipisatGtI/install/include
- -I../../../src/gcc-4.8.0/gcc/../libdecnumber
- -I../../../src/gcc-4.8.0/gcc/../libdecnumber/bid -I../libdecnumber
- -DCLOOG_INT_GMP -I/SCRATCH/tmp.xipisatGtI/install/include
- -I/SCRATCH/tmp.xipisatGtI/install/include  \
-o build/gencondmd.o build/gencondmd.c
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:17784:3: error: 'OPTION_BIONIC'
undeclared here (not in a function)
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:920:5: warning: missing
initializer [-Wmissing-field-initializers]
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:920:5: warning: (near
initialization for 'insn_conditions[657].value') [-Wmissing-field-initializers]
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:17755:5: warning: missing
initializer [-Wmissing-field-initializers]
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:17755:5: warning: (near
initialization for 'insn_conditions[1097].value') [-Wmissing-field-initializers]
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:920:5: warning: missing
initializer [-Wmissing-field-initializers]
../../../src/gcc-4.8.0/gcc/config/i386/i386.md:920:5: warning: (near
initialization for 'insn_conditions[1177].value') [-Wmissing-field-initializers]
make[3]: *** [build/gencondmd.o] Error 1
make[3]: Target `all' not remade because of errors.
make[3]: Leaving directory `/SCRATCH/tmp.xipisatGtI/gcc-4.8.0/gcc-4.8.0/gcc'

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

Rainer
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlAEB6YACgkQoUhjsh59BL7xSgCcDU/zNX19dfNhrlbIxLQu0SRZ
nTYAn3VpO7zF6wIuWUzhfaLLdmw78e+b
=5ylG
-END PGP SIGNATURE-


[Ada] Add support for encoding in Create_Directory and Create_Path.

2012-07-16 Thread Arnaud Charlet
Tested on x86_64-pc-linux-gnu, committed on trunk

2012-07-16  Pascal Obry  

* s-crtl.ads (mkdir): New routine, support encoding.
* adaint.h (__gnat_mkdir): Update spec to pass encoding.
* mkdir.c (__gnat_mkdir): Add encoding parameter.
* a-direct.adb (Create_Directory): Use CRTL.mkdir, parse encoding
in form parameter.
* g-dirope.adb (Make_Dir): Update to pass encoding parameter.

Index: a-direct.adb
===
--- a-direct.adb(revision 189515)
+++ a-direct.adb(working copy)
@@ -395,13 +395,8 @@
  (New_Directory : String;
   Form  : String := "")
is
-  pragma Unreferenced (Form);
-
   C_Dir_Name : constant String := New_Directory & ASCII.NUL;
 
-  function mkdir (Dir_Name : String) return Integer;
-  pragma Import (C, mkdir, "__gnat_mkdir");
-
begin
   --  First, the invalid case
 
@@ -410,10 +405,37 @@
"invalid new directory path name """ & New_Directory & '"';
 
   else
- if mkdir (C_Dir_Name) /= 0 then
-raise Use_Error with
-  "creation of new directory """ & New_Directory & """ failed";
- end if;
+ --  Acquire setting of encoding parameter
+
+ declare
+Formstr  : constant String := To_Lower (Form);
+
+Encoding : CRTL.Filename_Encoding;
+--  Filename encoding specified into the form parameter
+
+V1, V2   : Natural;
+
+ begin
+Form_Parameter (Formstr, "encoding", V1, V2);
+
+if V1 = 0 then
+   Encoding := CRTL.Unspecified;
+
+elsif Formstr (V1 .. V2) = "utf8" then
+   Encoding := CRTL.UTF8;
+
+elsif Formstr (V1 .. V2) = "8bits" then
+   Encoding := CRTL.ASCII_8bits;
+
+else
+   raise Use_Error with "invalid Form";
+end if;
+
+if CRTL.mkdir (C_Dir_Name, Encoding) /= 0 then
+   raise Use_Error with
+ "creation of new directory """ & New_Directory & """ failed";
+end if;
+ end;
   end if;
end Create_Directory;
 
@@ -425,8 +447,6 @@
  (New_Directory : String;
   Form  : String := "")
is
-  pragma Unreferenced (Form);
-
   New_Dir : String (1 .. New_Directory'Length + 1);
   Last: Positive := 1;
   Start   : Positive := 1;
@@ -487,7 +507,8 @@
 "file """ & New_Dir (1 .. Last) & """ already exists";
 
else
-  Create_Directory (New_Directory => New_Dir (1 .. Last));
+  Create_Directory
+(New_Directory => New_Dir (1 .. Last), Form => Form);
end if;
 end if;
  end loop;
Index: g-dirope.adb
===
--- g-dirope.adb(revision 189515)
+++ g-dirope.adb(working copy)
@@ -6,7 +6,7 @@
 --  --
 -- B o d y  --
 --  --
--- Copyright (C) 1998-2010, AdaCore --
+-- Copyright (C) 1998-2012, AdaCore --
 --  --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -605,11 +605,8 @@
procedure Make_Dir (Dir_Name : Dir_Name_Str) is
   C_Dir_Name : constant String := Dir_Name & ASCII.NUL;
 
-  function mkdir (Dir_Name : String) return Integer;
-  pragma Import (C, mkdir, "__gnat_mkdir");
-
begin
-  if mkdir (C_Dir_Name) /= 0 then
+  if CRTL.mkdir (C_Dir_Name, Unspecified) /= 0 then
  raise Directory_Error;
   end if;
end Make_Dir;
Index: s-crtl.ads
===
--- s-crtl.ads  (revision 189515)
+++ s-crtl.ads  (working copy)
@@ -6,7 +6,7 @@
 --  --
 -- S p e c  --
 --  --
---  Copyright (C) 2003-2009, Free Software Foundation, Inc. --
+--  Copyright (C) 2003-2012, Free Software Foundation, Inc. --
 --  --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -165,6 +165,11 @@
function chdir (dir_name : String) return int;
pragma Import (C, chdir, "

Re: [patch] Introduce dumpfile.h, clean up tree-pass.h dependencies

2012-07-16 Thread Steven Bosscher
On Mon, Jul 16, 2012 at 1:49 PM, Richard Guenther
 wrote:
> On Mon, Jul 16, 2012 at 11:12 AM, Steven Bosscher  
> wrote:
>> On Mon, Jul 16, 2012 at 11:00 AM, Richard Guenther
>>  wrote:
>>> On Fri, Jul 13, 2012 at 3:38 PM, Steven Bosscher  
>>> wrote:
 Hello,

 The attached monster patch re-organizes a lot of includes to avoid
 dependencies on tree-pass.h just for having dump_file available.

 I've used the following "rules" to decide what needs to go where:

 * tree-dump.h should be independent of the pass manager, i.e. not
 include tree-pass.h.

 * passes that do not need dumping of GENERIC do not need tree-dump.h 
 either.

 * Any file that defines an opt_pass may include tree-pass.h.

 * If a file includes tree-pass.h, it does not need to include
 dumpfile.h or timevar.h, because tree-pass.h provides these already
 (the *opt_pass structs depend on them)

 * If a file does not include tree-pass.h, but it needs dump_file, it
 should include dumpfile.h. Likewise for timevar.h. This category of
 files are the implementation files for supporting code, like alias.c
 and cfg*.c.

 With those rules in mind, my hackathon started and the result is
 attached. I had to move a few functions around, but not very much. I
 also uncovered a bug in one of the DF files, where it was trying to
 use get_insns without including emit-rtl.h.  No DF file should emit
 RTL, so I don't want to include emit-rtl.h there, so I removed that
 dumping (which was only for debugging purposes anyway, and obviously
 not tested in a while or I wouldn't have run into this problem to
 begin with :-)

 Bootstrapped&tested on powerpc64-unknown-linux-gnu and on
 x86_64-unknown-linux-gnu. OK for trunk?
>>>
>>> You moved get_ref_base_and_extent to tree.c - any reason for that?
>>
>> Yes, tree.c uses it (build_simple_mem_ref_loc) and I don't want tree.c
>> to depend on tree-dfa.c. Longer-term I'd like to split tree.c and
>> tree.h, and this function and the two others you mention below could
>> go into e.g. tree-anal.c.
>>
>>> It is similar to get_inner_reference which is in expr.c and similar to
>>> get_addr_base_and_unit_offset which is still in tree-dfa.c.  I'd prefer
>>> to have it stay where it is for this patch.
>>
>> OK.
>
> Seems to break build with graphite for me:
>
> /space/rguenther/src/svn/trunk/gcc/graphite-dependences.c: In function
> 'graphite_legal_transform':
> /space/rguenther/src/svn/trunk/gcc/graphite-dependences.c:534:
> warning: implicit declaration of function 'timevar_push'
> /space/rguenther/src/svn/trunk/gcc/graphite-dependences.c:534: error:
> 'TV_GRAPHITE_DATA_DEPS' undeclared (first use in this function)
> ...
> /space/rguenther/src/svn/trunk/gcc/graphite-clast-to-gimple.c: In
> function 'translate_clast_user':
> /space/rguenther/src/svn/trunk/gcc/graphite-clast-to-gimple.c:1102:
> error: 'TODO_update_ssa' undeclared (first use in this function)
> ...
> /space/rguenther/src/svn/trunk/gcc/graphite-clast-to-gimple.c:1644:
> error: 'TV_GRAPHITE_CODE_GEN' undeclared (first use in this function)
> ...
>
> /space/rguenther/src/svn/trunk/gcc/graphite-sese-to-poly.c:2341:
> error: 'TODO_update_ssa' undeclared (first use in this function)
> ...

Grr... (/me cursing about being able to build gcc without graphite)


Index: Makefile.in
===
--- Makefile.in (revision 189519)
+++ Makefile.in (working copy)
@@ -2541,11 +2541,11 @@ graphite-blocking.o : graphite-blocking.
coretypes.h dumpfile.h $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
sese.h graphite-poly.h
 graphite-clast-to-gimple.o : graphite-clast-to-gimple.c $(CONFIG_H) \
-   $(SYSTEM_H) coretypes.h dumpfile.h $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) \
+   $(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) $(TREE_PASS_H) \
$(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h \
graphite-poly.h graphite-clast-to-gimple.h
 graphite-dependences.o : graphite-dependences.c $(CONFIG_H) $(SYSTEM_H) \
-   coretypes.h dumpfile.h $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
+   coretypes.h $(TREE_FLOW_H) $(TREE_PASS_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
sese.h graphite-poly.h
 graphite-interchange.o : graphite-interchange.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h dumpfile.h $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
@@ -2557,7 +2557,7 @@ graphite-scop-detection.o : graphite-sco
coretypes.h $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) $(TREE_PASS_H) \
sese.h graphite-poly.h graphite-scop-detection.h
 graphite-sese-to-poly.o : graphite-sese-to-poly.c $(CONFIG_H) \
-   $(SYSTEM_H) coretypes.h dumpfile.h $(TREE_FLOW_H) $(CFGLOOP_H) \
+   $(SYSTEM_H) coretypes.h $(TREE_FLOW_H) $(TREE_PASS_H) $(CFGLOOP_H) \
$(TREE_DATA_REF_H) domwalk.h sese.h graphite-poly.h \
graphite-sese-to-poly.h
 graphite-optimize-isl.o : graphite-optimize-isl.c $(CONFIG_H) $(SYS

Re: [patch] Introduce dumpfile.h, clean up tree-pass.h dependencies

2012-07-16 Thread Richard Guenther
On Mon, Jul 16, 2012 at 11:12 AM, Steven Bosscher  wrote:
> On Mon, Jul 16, 2012 at 11:00 AM, Richard Guenther
>  wrote:
>> On Fri, Jul 13, 2012 at 3:38 PM, Steven Bosscher  
>> wrote:
>>> Hello,
>>>
>>> The attached monster patch re-organizes a lot of includes to avoid
>>> dependencies on tree-pass.h just for having dump_file available.
>>>
>>> I've used the following "rules" to decide what needs to go where:
>>>
>>> * tree-dump.h should be independent of the pass manager, i.e. not
>>> include tree-pass.h.
>>>
>>> * passes that do not need dumping of GENERIC do not need tree-dump.h either.
>>>
>>> * Any file that defines an opt_pass may include tree-pass.h.
>>>
>>> * If a file includes tree-pass.h, it does not need to include
>>> dumpfile.h or timevar.h, because tree-pass.h provides these already
>>> (the *opt_pass structs depend on them)
>>>
>>> * If a file does not include tree-pass.h, but it needs dump_file, it
>>> should include dumpfile.h. Likewise for timevar.h. This category of
>>> files are the implementation files for supporting code, like alias.c
>>> and cfg*.c.
>>>
>>> With those rules in mind, my hackathon started and the result is
>>> attached. I had to move a few functions around, but not very much. I
>>> also uncovered a bug in one of the DF files, where it was trying to
>>> use get_insns without including emit-rtl.h.  No DF file should emit
>>> RTL, so I don't want to include emit-rtl.h there, so I removed that
>>> dumping (which was only for debugging purposes anyway, and obviously
>>> not tested in a while or I wouldn't have run into this problem to
>>> begin with :-)
>>>
>>> Bootstrapped&tested on powerpc64-unknown-linux-gnu and on
>>> x86_64-unknown-linux-gnu. OK for trunk?
>>
>> You moved get_ref_base_and_extent to tree.c - any reason for that?
>
> Yes, tree.c uses it (build_simple_mem_ref_loc) and I don't want tree.c
> to depend on tree-dfa.c. Longer-term I'd like to split tree.c and
> tree.h, and this function and the two others you mention below could
> go into e.g. tree-anal.c.
>
>> It is similar to get_inner_reference which is in expr.c and similar to
>> get_addr_base_and_unit_offset which is still in tree-dfa.c.  I'd prefer
>> to have it stay where it is for this patch.
>
> OK.

Seems to break build with graphite for me:

/space/rguenther/src/svn/trunk/gcc/graphite-dependences.c: In function
'graphite_legal_transform':
/space/rguenther/src/svn/trunk/gcc/graphite-dependences.c:534:
warning: implicit declaration of function 'timevar_push'
/space/rguenther/src/svn/trunk/gcc/graphite-dependences.c:534: error:
'TV_GRAPHITE_DATA_DEPS' undeclared (first use in this function)
...
/space/rguenther/src/svn/trunk/gcc/graphite-clast-to-gimple.c: In
function 'translate_clast_user':
/space/rguenther/src/svn/trunk/gcc/graphite-clast-to-gimple.c:1102:
error: 'TODO_update_ssa' undeclared (first use in this function)
...
/space/rguenther/src/svn/trunk/gcc/graphite-clast-to-gimple.c:1644:
error: 'TV_GRAPHITE_CODE_GEN' undeclared (first use in this function)
...

/space/rguenther/src/svn/trunk/gcc/graphite-sese-to-poly.c:2341:
error: 'TODO_update_ssa' undeclared (first use in this function)
...

> Ciao!
> Steven


[Ada] Suppress false elaboration warnings -- indirect Elaborate_All

2012-07-16 Thread Arnaud Charlet
This patch suppresses certain false-alarm warnings about elaboration in cases
where a pragma Elaborate_All is not present directly, but is found in some
indirectly-with'ed unit.

The following test should compile silently:

gnatmake -q -f -g -gnatwl -gnatE -gnat05 r.adb

package P is
   function F return Boolean;
end P;
package body P is
   function F return Boolean is
   begin
  return True;
   end F;
end P;
with P; pragma Elaborate_All(P);
package Q is
   type T is
  record
 Comp: Boolean := P.F;
  end record;
   procedure Require_Body;
end Q;
package body Q is
   procedure Require_Body is
   begin
  null;
   end Require_Body;
end Q;
package R is
   procedure Require_Body;
end R;
with Q;
package body R is
   procedure Require_Body is
   begin
  null;
   end Require_Body;
   X: Q.T;
end R;

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-07-16  Bob Duff  

* sem_elab.adb (Within_Elaborate_All): Walk the with clauses to
find pragmas Elaborate_All that may be found in the transitive
closure of the dependences.

Index: sem_elab.adb
===
--- sem_elab.adb(revision 189515)
+++ sem_elab.adb(working copy)
@@ -325,11 +325,13 @@
--  Given two scopes E1 and E2, returns True if E1 is equal to E2, or is one
--  of its contained scopes, False otherwise.
 
-   function Within_Elaborate_All (E : Entity_Id) return Boolean;
-   --  Before emitting a warning on a scope E for a missing elaborate_all,
-   --  check whether E may be in the context of a directly visible unit U to
-   --  which the pragma applies. This prevents spurious warnings when the
-   --  called entity is renamed within U.
+   function Within_Elaborate_All
+ (Unit : Unit_Number_Type;
+  E: Entity_Id) return Boolean;
+   --  Return True if we are within the scope of an Elaborate_All for E, or if
+   --  we are within the scope of an Elaborate_All for some other unit U, and U
+   --  with's E. This prevents spurious warnings when the called entity is
+   --  renamed within U, or in case of generic instances.
 
--
-- Activate_Elaborate_All_Desirable --
@@ -831,7 +833,7 @@
 end loop;
  end if;
 
- if Within_Elaborate_All (E_Scope) then
+ if Within_Elaborate_All (Current_Sem_Unit, E_Scope) then
 return;
  end if;
 
@@ -1229,9 +1231,8 @@
 
   P := Parent (N);
   while Present (P) loop
- if Nkind (P) = N_Parameter_Specification
-  or else
-Nkind (P) = N_Component_Declaration
+ if Nkind_In (P, N_Parameter_Specification,
+ N_Component_Declaration)
  then
 return;
 
@@ -3282,46 +3283,121 @@
-- Within_Elaborate_All --
--
 
-   function Within_Elaborate_All (E : Entity_Id) return Boolean is
-  Item: Node_Id;
-  Item2   : Node_Id;
-  Elab_Id : Entity_Id;
-  Par : Node_Id;
+   function Within_Elaborate_All
+ (Unit : Unit_Number_Type;
+  E: Entity_Id) return Boolean
+   is
+  type Unit_Number_Set is array (Main_Unit .. Last_Unit) of Boolean;
+  pragma Pack (Unit_Number_Set);
 
-   begin
-  Item := First (Context_Items (Cunit (Current_Sem_Unit)));
-  while Present (Item) loop
- if Nkind (Item) = N_Pragma
-   and then Pragma_Name (Item) = Name_Elaborate_All
- then
---  Return if some previous error on the pragma itself
+  Seen : Unit_Number_Set := (others => False);
+  --  Seen (X) is True after we have seen unit X in the walk. This is used
+  --  to prevent processing the same unit more than once.
 
-if Error_Posted (Item) then
-   return False;
+  Result : Boolean := False;
+
+  procedure Helper (Unit : Unit_Number_Type);
+  --  This helper procedure does all the work for Within_Elaborate_All. It
+  --  walks the dependency graph, and sets Result to True if it finds an
+  --  appropriate Elaborate_All.
+
+  
+  -- Helper --
+  
+
+  procedure Helper (Unit : Unit_Number_Type) is
+ CU : constant Node_Id := Cunit (Unit);
+
+ Item: Node_Id;
+ Item2   : Node_Id;
+ Elab_Id : Entity_Id;
+ Par : Node_Id;
+
+  begin
+ if Seen (Unit) then
+return;
+ else
+Seen (Unit) := True;
+ end if;
+
+ --  First, check for Elaborate_Alls on this unit
+
+ Item := First (Context_Items (CU));
+ while Present (Item) loop
+if Nkind (Item) = N_Pragma
+  and then Pragma_Name (Item) = Name_Elaborate_All
+then
+   --  Return if some previous error on the pragma itself
+
+   if Error_Posted (Item) then
+  return;
+   end if;
+
+  

Re: [Patch, Fortran, F03] PROCEDURE w/ interface: Bogus "EXTERNAL attribute conflicts with FUNCTION attribute"

2012-07-16 Thread Janus Weil
>> the attached patch is the solution that I came up with for this PR
>> (after two simpler but wrong attempts, see PR). The issue addressed
>> here is the setting of the if_source attribute for dummy procedures.
>> When declaring a procedure (pointer) with the PROCEDURE statement, the
>> attributes of the dummies (including if_source) should be copied from
>> the source interface (cf. gfc_copy_formal_args).
>>
>> The patch was successfully regtested on x86_64-unknown-linux-gnu. Ok for
>> trunk?
>
>
> The patch looks fine. Thanks!

Thanks for the review, Tobias. Committed as r189514.

Cheers,
Janus


Re: [PATCH 1/2] gcc symbol database

2012-07-16 Thread Yunfeng ZHANG
> But the "meaning" of the macro_end_arg event is really not clear to
> ...
>  and so on.

Let's see a sample:
#define Z(a) a
#define Y Z
#define X(p) p + Y
X(1)(2);
With my solution, user get
1) `X' -- leader macro token by macro_start_expand.
2) `(', `1', `)', `(', `2', `)' -- macro tokens, by cb_lex_token.
3) macro_end_arg.
4) `1', `+', `2' -- macro replacement tokens, by symdb_cpp_token.
5) macro_end_expand.
Item 2 is very important since if `X(1)' doesn't return any macro replacement
tokens, then `(2)' is a legal clause.
So please review my former mail again.

And it seems in gcc-4.8, gcc can trace several contiguous macro expansion
contexts can be associated to the same macro, so macro cascaded case has
disappeared.

> Please reply to these questions so that I understand why you need this
> field at all, rather than getting it from the linemap infrastructure
> by calling, for instance, linemap_expand_location.

linemap_expand_location can return the column and row of a token, not file
offset of its, there's no more explanation why using token file-offset, when I
started my project, I think file-offset is better than current
linemap+source_location because it costed less time to encode/decode
source_location field and can act just like previous solution, it's an
improvement to gcc too, with it gcc can store symbol+fileoffset to elf intern
for ld/gdb usage, of course, my database can benefit from  it -- less space and
use it as sort field directly. The only thing is it make challenge on gcc
infrastructure, so I leave it to a seperate patch called gcc_negotiate_patch
and hope to discuss the first two patches only.

And to the field file-offset, when the token is macro-replacement token, I
recommend token.file_offset = -1 * .file_offset. I think
gdb is happy to this.

Sincerely
Yunfeng


Re: [PATCH 1/6] Thread pointer built-in functions, core parts

2012-07-16 Thread Chung-Lin Tang
On 12/7/14 9:58 AM, Mike Stump wrote:
> On Jul 12, 2012, at 11:47 PM, Chung-Lin Tang  wrote:
>>> and then for the return value, maybe a const0_rtx for Pmode.
>>
>> A little unsure what you mean.  Are you referring to return const0_rtx
>> for default_expand_builtin_thread_pointer() instead of NULL?
> 
> Yes.  NULL has the habit of crashing things if they don't expect it.
> 

I've addressed this. The expand function still handles the NULL case
with a ?: for robustness though. Also removed the '()' in the displayed
function names. Patch attached.

Thanks,
Chung-Lin
Index: target.def
===
--- target.def  (revision 189512)
+++ target.def  (working copy)
@@ -2717,6 +2717,22 @@ DEFHOOK
  enum unwind_info_type, (void),
  default_debug_unwind_info)
 
+/* Expand builtin function for returning TLS thread pointer.  */
+DEFHOOK
+(expand_builtin_thread_pointer,
+ "This hook expands the built-in function for reading\
+ the TLS thread pointer, if supported on the target.",
+ rtx, (rtx),
+ default_expand_builtin_thread_pointer)
+
+/* Expand builtin function for setting TLS thread pointer.  */
+DEFHOOK
+(expand_builtin_set_thread_pointer,
+ "This hook expands the built-in function for setting\
+ the TLS thread pointer, if supported on the target.",
+ void, (rtx),
+ default_expand_builtin_set_thread_pointer)
+
 DEFHOOKPOD
 (atomic_test_and_set_trueval,
  "This value should be set if the result written by\
Index: targhooks.c
===
--- targhooks.c (revision 189512)
+++ targhooks.c (working copy)
@@ -1514,4 +1514,18 @@ default_pch_valid_p (const void *data_p, size_t le
   return NULL;
 }
 
+rtx
+default_expand_builtin_thread_pointer (rtx target ATTRIBUTE_UNUSED)
+{
+  error ("%qs is not available for this target", "__builtin_thread_pointer()");
+  return NULL;
+}
+
+void
+default_expand_builtin_set_thread_pointer (rtx val ATTRIBUTE_UNUSED)
+{
+  error ("%qs is not available for this target",
+"__builtin_set_thread_pointer()");
+}
+
 #include "gt-targhooks.h"
Index: targhooks.h
===
--- targhooks.h (revision 189512)
+++ targhooks.h (working copy)
@@ -184,5 +184,8 @@ extern enum machine_mode default_get_reg_raw_mode(
 extern void *default_get_pch_validity (size_t *);
 extern const char *default_pch_valid_p (const void *, size_t);
 
+extern rtx default_expand_builtin_thread_pointer (rtx);
+extern void default_expand_builtin_set_thread_pointer (rtx);
+
 extern void default_asm_output_ident_directive (const char*);
 
Index: builtins.c
===
--- builtins.c  (revision 189512)
+++ builtins.c  (working copy)
@@ -5767,6 +5767,27 @@ expand_builtin_sync_synchronize (void)
   expand_mem_thread_fence (MEMMODEL_SEQ_CST);
 }
 
+static rtx
+expand_builtin_thread_pointer (tree exp, rtx target)
+{
+  if (!validate_arglist (exp, VOID_TYPE))
+return const0_rtx;
+  if (!REG_P (target) || GET_MODE (target) != Pmode)
+target = gen_reg_rtx (Pmode);
+  target = targetm.expand_builtin_thread_pointer (target);
+  return (target ? target : const0_rtx);
+}
+
+static void
+expand_builtin_set_thread_pointer (tree exp)
+{
+  rtx val;
+  if (!validate_arglist (exp, POINTER_TYPE, VOID_TYPE))
+return;
+  val = expand_expr (CALL_EXPR_ARG (exp, 0), NULL_RTX, Pmode, EXPAND_NORMAL);
+  targetm.expand_builtin_set_thread_pointer (val);
+}
+
 
 /* Expand an expression EXP that calls a built-in function,
with result going to TARGET if that's convenient
@@ -6832,6 +6853,13 @@ expand_builtin (tree exp, rtx target, rtx subtarge
maybe_emit_free_warning (exp);
   break;
 
+case BUILT_IN_THREAD_POINTER:
+  return expand_builtin_thread_pointer (exp, target);
+
+case BUILT_IN_SET_THREAD_POINTER:
+  expand_builtin_set_thread_pointer (exp);
+  return const0_rtx;
+
 default:   /* just do library call, if unknown builtin */
   break;
 }
Index: builtins.def
===
--- builtins.def(revision 189512)
+++ builtins.def(working copy)
@@ -782,6 +782,17 @@ DEF_BUILTIN (BUILT_IN_PROFILE_FUNC_ENTER, "__cyg_p
 DEF_BUILTIN (BUILT_IN_PROFILE_FUNC_EXIT, "__cyg_profile_func_exit", 
BUILT_IN_NORMAL, BT_FN_VOID_PTR_PTR, BT_LAST,
 false, false, false, ATTR_NULL, true, true)
 
+/* TLS thread pointer related builtins.  */
+DEF_BUILTIN (BUILT_IN_THREAD_POINTER, "__builtin_thread_pointer",
+BUILT_IN_NORMAL, BT_FN_PTR, BT_LAST,
+false, false, true, ATTR_CONST_NOTHROW_LIST, true,
+targetm.have_tls)
+
+DEF_BUILTIN (BUILT_IN_SET_THREAD_POINTER, "__builtin_set_thread_pointer",
+BUILT_IN_NORMAL, BT_FN_VOID_PTR, BT_LAST,
+false, false, true, ATTR_NOTHROW_LIST, true,
+targetm.have_tls)
+
 /* TLS emulation.  */
 DEF_BUILTIN (BUILT_IN_EMUTLS_GE

Re: [patch] Remove useless sets/clears of EDGE_CAN_FALLTHRU

2012-07-16 Thread Richard Guenther
On Mon, Jul 16, 2012 at 11:03 AM, Steven Bosscher  wrote:
> On Mon, Jul 16, 2012 at 10:53 AM, Richard Guenther
>  wrote:
>> Maybe we should rename EDGE_CAN_FALLTHRU to EDGE_PLF_1
>> and have a #define in bb-reorder.c then?  Other passes might use
>> it for their pass-local handling then and would not be content to set/unset
>> it.
>
> I intend to do a lot more cleanups on the edge and basic block flags
> (that depends on the dumpfile.h patch, eagerly awaiting your ACK or
> comments ;-).

See your inbox ;)

> For EDGE_CAN_FALLTHRU I was more thinking of a pointer map or an
> sbitmap on an edge list, tbd. Or, like you suggest, make it a flag
> available for passes to use. That would also help for a few other
> flags (EDGE_LOOP_EXIT, EDGE_EXECUTABLE, ...).

Indeed - I prefer the pass-specific flags approach, we seem to have this
almost everywhere.

Richard.

> Ciao!
> Steven


Re: [patch] Bail out if the same label is emitted twice

2012-07-16 Thread Richard Guenther
On Sat, Jul 14, 2012 at 9:25 PM, Steven Bosscher  wrote:
> Hello,
>
> Just another small cleanup. This probably made sense before
> function-at-a-time became the norm, 10 years ago.
>
> Bootstrapped&tested on powerpc64-unknown-linux-gnu and 
> x86_64-unknown-linux-gnu.
> OK for trunk?

Ok.

Thanks,
Richard.

> Ciao!
> Steven
>
>
> * emit-rtl.c (emit_label_before): Do not allow the same label
> to be emitted twice.
> (emit_label_after): Likewise.
> (emit_label): Likewise.
>
> Index: emit-rtl.c
> ===
> --- emit-rtl.c  (revision 189482)
> +++ emit-rtl.c  (working copy)
> @@ -4221,14 +4221,9 @@ emit_barrier_before (rtx before)
>  rtx
>  emit_label_before (rtx label, rtx before)
>  {
> -  /* This can be called twice for the same label as a result of the
> - confusion that follows a syntax error!  So make it harmless.  */
> -  if (INSN_UID (label) == 0)
> -{
> -  INSN_UID (label) = cur_insn_uid++;
> -  add_insn_before (label, before, NULL);
> -}
> -
> +  gcc_checking_assert (INSN_UID (label) == 0);
> +  INSN_UID (label) = cur_insn_uid++;
> +  add_insn_before (label, before, NULL);
>return label;
>  }
>
> @@ -4387,15 +4382,9 @@ emit_barrier_after (rtx after)
>  rtx
>  emit_label_after (rtx label, rtx after)
>  {
> -  /* This can be called twice for the same label
> - as a result of the confusion that follows a syntax error!
> - So make it harmless.  */
> -  if (INSN_UID (label) == 0)
> -{
> -  INSN_UID (label) = cur_insn_uid++;
> -  add_insn_after (label, after, NULL);
> -}
> -
> +  gcc_checking_assert (INSN_UID (label) == 0);
> +  INSN_UID (label) = cur_insn_uid++;
> +  add_insn_after (label, after, NULL);
>return label;
>  }
>
> @@ -4811,14 +4800,9 @@ emit_call_insn (rtx x)
>  rtx
>  emit_label (rtx label)
>  {
> -  /* This can be called twice for the same label
> - as a result of the confusion that follows a syntax error!
> - So make it harmless.  */
> -  if (INSN_UID (label) == 0)
> -{
> -  INSN_UID (label) = cur_insn_uid++;
> -  add_insn (label);
> -}
> +  gcc_checking_assert (INSN_UID (label) == 0);
> +  INSN_UID (label) = cur_insn_uid++;
> +  add_insn (label);
>return label;
>  }


Re: [patch] Remove expand_expr_stmt

2012-07-16 Thread Richard Guenther
On Sat, Jul 14, 2012 at 7:34 PM, Steven Bosscher  wrote:
> Hello,
>
> This patch removes expand_expr_stmt and inlines+folds it into its only user.
>
> This relies on TARGET_STACK_PROTECT_FAIL being a CALL_EXPR. The
> documentation only says "a tree expression that (...) should involve a
> call to a @code{noreturn} function". I've changed this to explicitly
> state that the hook must return a CALL_EXPR.
>
> Bootstrapped and tested on powerpc64-unknown-linux-gnu.
> OK for trunk?

Ok.

Thanks,
Richard.

> Ciao!
> Steven
>
>
> * function.c (stack_protect_epilogue): Use expand_call to expand
> targetm.stack_protect_fail.
> * stmt.c (expand_expr_stmt): Remove now-unused function.
> * tree.h (expand_expr_stmt): Remove prototype.
> * doc/tm.texi.in (TARGET_STACK_PROTECT_FAIL): Document that this
> hook must return a CALL_EXPR.
> * doc/tm.texi: Regenerate.


Re: [Patch, Fortran, F03] PROCEDURE w/ interface: Bogus "EXTERNAL attribute conflicts with FUNCTION attribute"

2012-07-16 Thread Tobias Burnus

On 07/16/2012 11:09 AM, Janus Weil wrote:

the attached patch is the solution that I came up with for this PR
(after two simpler but wrong attempts, see PR). The issue addressed
here is the setting of the if_source attribute for dummy procedures.
When declaring a procedure (pointer) with the PROCEDURE statement, the
attributes of the dummies (including if_source) should be copied from
the source interface (cf. gfc_copy_formal_args).

The patch was successfully regtested on x86_64-unknown-linux-gnu. Ok for trunk?


The patch looks fine. Thanks!

Tobias


2012-07-16  Janus Weil  

PR fortran/53956
* gfortran.h (gfc_copy_formal_args,gfc_copy_formal_args_ppc): Modified
prototypes.
* symbol.c (gfc_copy_formal_args): New argument 'if_src'. Copy if_source
of dummy procedures.
(gfc_copy_formal_args_ppc): Ditto.
* resolve.c (resolve_procedure_interface): Pass IFSRC_DECL to
gfc_copy_formal_args.
(resolve_fl_derived0): Pass IFSRC_DECL to gfc_copy_formal_args_ppc.


2012-07-16  Janus Weil  

PR fortran/53956
* gfortran.dg/proc_decl_28.f90: New.





Re: [patch] Introduce dumpfile.h, clean up tree-pass.h dependencies

2012-07-16 Thread Steven Bosscher
On Mon, Jul 16, 2012 at 11:00 AM, Richard Guenther
 wrote:
> On Fri, Jul 13, 2012 at 3:38 PM, Steven Bosscher  
> wrote:
>> Hello,
>>
>> The attached monster patch re-organizes a lot of includes to avoid
>> dependencies on tree-pass.h just for having dump_file available.
>>
>> I've used the following "rules" to decide what needs to go where:
>>
>> * tree-dump.h should be independent of the pass manager, i.e. not
>> include tree-pass.h.
>>
>> * passes that do not need dumping of GENERIC do not need tree-dump.h either.
>>
>> * Any file that defines an opt_pass may include tree-pass.h.
>>
>> * If a file includes tree-pass.h, it does not need to include
>> dumpfile.h or timevar.h, because tree-pass.h provides these already
>> (the *opt_pass structs depend on them)
>>
>> * If a file does not include tree-pass.h, but it needs dump_file, it
>> should include dumpfile.h. Likewise for timevar.h. This category of
>> files are the implementation files for supporting code, like alias.c
>> and cfg*.c.
>>
>> With those rules in mind, my hackathon started and the result is
>> attached. I had to move a few functions around, but not very much. I
>> also uncovered a bug in one of the DF files, where it was trying to
>> use get_insns without including emit-rtl.h.  No DF file should emit
>> RTL, so I don't want to include emit-rtl.h there, so I removed that
>> dumping (which was only for debugging purposes anyway, and obviously
>> not tested in a while or I wouldn't have run into this problem to
>> begin with :-)
>>
>> Bootstrapped&tested on powerpc64-unknown-linux-gnu and on
>> x86_64-unknown-linux-gnu. OK for trunk?
>
> You moved get_ref_base_and_extent to tree.c - any reason for that?

Yes, tree.c uses it (build_simple_mem_ref_loc) and I don't want tree.c
to depend on tree-dfa.c. Longer-term I'd like to split tree.c and
tree.h, and this function and the two others you mention below could
go into e.g. tree-anal.c.

> It is similar to get_inner_reference which is in expr.c and similar to
> get_addr_base_and_unit_offset which is still in tree-dfa.c.  I'd prefer
> to have it stay where it is for this patch.

OK.

Ciao!
Steven


[Patch, Fortran, F03] PROCEDURE w/ interface: Bogus "EXTERNAL attribute conflicts with FUNCTION attribute"

2012-07-16 Thread Janus Weil
Hi all,

the attached patch is the solution that I came up with for this PR
(after two simpler but wrong attempts, see PR). The issue addressed
here is the setting of the if_source attribute for dummy procedures.
When declaring a procedure (pointer) with the PROCEDURE statement, the
attributes of the dummies (including if_source) should be copied from
the source interface (cf. gfc_copy_formal_args).

The patch was successfully regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus



2012-07-16  Janus Weil  

PR fortran/53956
* gfortran.h (gfc_copy_formal_args,gfc_copy_formal_args_ppc): Modified
prototypes.
* symbol.c (gfc_copy_formal_args): New argument 'if_src'. Copy if_source
of dummy procedures.
(gfc_copy_formal_args_ppc): Ditto.
* resolve.c (resolve_procedure_interface): Pass IFSRC_DECL to
gfc_copy_formal_args.
(resolve_fl_derived0): Pass IFSRC_DECL to gfc_copy_formal_args_ppc.


2012-07-16  Janus Weil  

PR fortran/53956
* gfortran.dg/proc_decl_28.f90: New.


pr53956_v3.diff
Description: Binary data


proc_decl_28.f90
Description: Binary data


Re: Fix PR53908

2012-07-16 Thread Richard Guenther
On Fri, Jul 13, 2012 at 11:49 PM, Steven Bosscher  wrote:
> On Fri, Jul 13, 2012 at 10:56 AM, Hans-Peter Nilsson
>  wrote:
>>> From: Richard Guenther 
>>> Date: Fri, 13 Jul 2012 10:08:05 +0200
>>> On Fri, Jul 13, 2012 at 9:59 AM, Hans-Peter Nilsson
>>>  wrote:
>>> > Ok for 4.7 too?
>>>
>>> Of course.
>>
>> Committed to trunk as follows, including the test-case which
>> doesn't fail on trunk but does on 4.6 and 4.7.
>>
>> Will commit to 4.7 branch too.  I'll leave 4.6 to those
>> interested enough to invest time to do the testing.
>
> I've bootstrapped and tested this on x86_64-unknown-linux-gnu. Without
> the patch, the test case fails, with the patch it passes. OK for 4.6
> too?

Sure.

Thanks,
Richard.

> Ciao!
> Steven


Re: [PATCH][MIPS] NetLogic XLP scheduling

2012-07-16 Thread Richard Sandiford
Maxim Kuvyrkov  writes:
> On 16/07/2012, at 6:37 PM, Chung-Lin Tang wrote:
>> On 2012/7/16 12:28 AM, Richard Sandiford wrote:
>>> Chung-Lin Tang  writes:
>>> Tested on mips64-elf, and by making sure that there were no changes in
>>> -O2 output for a recent set of cc1 .ii files.  Applied.
>>> 
>>> I'm probably punishing you for being honest here, but the only other
>>> thing is that you've listed NetLogic Microsystems Inc. as one of the
>>> authors.  I think that means they'll need to sign a copyright assignment.
>>> Have they already done that?
>> 
>> They have assigned the copyright to Mentor Graphics, so it should mean
>> the code can be contributed by us.
>
> That is correct.  NetLogic developed the original xlp.md description, which 
> Chung-Lin essentially rewrote.  In any case, Mentor has copyright assignment 
> for the original xlp.md specifically so that we can contribute this upstream.

Ah, excellent, thanks.

Richard


Re: [patch] Call free_after_parsing earlier

2012-07-16 Thread Richard Guenther
On Fri, Jul 13, 2012 at 4:33 PM, Steven Bosscher  wrote:
> On Thu, Jul 12, 2012 at 9:21 AM, Richard Guenther
>  wrote:
>> On Wed, Jul 11, 2012 at 9:39 PM, Steven Bosscher  
>> wrote:
>>> Hello,
>>>
>>> GCC calls free_after_parsing in rest_of_clean_state.
>>> That's way too late, it can be done in free_lang_data_in_cgraph instead.
>>
>> But that's only called with -flto ... I think it should be called in
>> cgraph_finalize_function instead (being optimistic here - heh).
>
> Quite optimistic, indeed...

;)

Btw, the

* final.c (final): Don't loop to find max_uid.

part is ok if you want to commit it separately.

> I choose for free_lang_data_in_cgraph (which, BTW, doesn't belong in
> tree.c, but that aside) because I thought the C++ front end might need
> its function->language after cgraph_finalize_function. And indeed
> so...

Ok, so how about doing it at the end of cgraph_analyze_function?

Thanks,
Richard.

> Ciao!
> Steven
>
>
> $ cat t.C
> #line 14971 "configure"
> struct S { ~S(); };
> void bar();
> void foo()
> {
>   S s;
>   bar();
> }
>
> $ gdb --args ./cc1plus t.C
> GNU gdb 6.8-debian
> Copyright (C) 2008 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later 
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-linux-gnu"...
> Breakpoint 1 at 0x38a80b5: file ../../trunk/gcc/diagnostic.c, line 1011.
> Breakpoint 2 at 0x38a7ed6: file ../../trunk/gcc/diagnostic.c, line 955.
> Function "exit" not defined.
> Make breakpoint pending on future shared library load? (y or [n])
> [answered N; input not from terminal]
> Function "abort" not defined.
> Make breakpoint pending on future shared library load? (y or [n])
> [answered N; input not from terminal]
> (gdb) run
> Starting program: /home/stevenb/devel/build-test/gcc/cc1plus t.C
>  void foo()
> Analyzing compilation unit
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0096b93a in stmts_are_full_exprs_p () at
> ../../trunk/gcc/cp/semantics.c:370
> 370   return current_stmt_tree ()->stmts_are_full_exprs_p;
> (gdb) bt
> #0  0x0096b93a in stmts_are_full_exprs_p () at
> ../../trunk/gcc/cp/semantics.c:370
> #1  0x00b1f294 in cp_gimplify_expr (expr_p=0x77232a20,
> pre_p=0x7fff97a8, post_p=0x7fff8ba8) at
> ../../trunk/gcc/cp/cp-gimplify.c:530
> #2  0x0156fb44 in gimplify_expr (expr_p=0x77232a20,
> pre_p=0x7fff97a8, post_p=0x7fff8ba8, gimple_test_f=0x155d16c
> , fallback=0)
> at ../../trunk/gcc/gimplify.c:7064
> #3  0x01563bb7 in gimplify_stmt (stmt_p=0x77232a20,
> seq_p=0x7fff97a8) at ../../trunk/gcc/gimplify.c:5678
> #4  0x01562d43 in gimplify_cleanup_point_expr
> (expr_p=0x77245ad8, pre_p=0x7fffb3b0) at
> ../../trunk/gcc/gimplify.c:5455
> #5  0x01572c33 in gimplify_expr (expr_p=0x77245ad8,
> pre_p=0x7fffb3b0, post_p=0x7fff9998, gimple_test_f=0x155d16c
> , fallback=0)
> at ../../trunk/gcc/gimplify.c:7479
> #6  0x01563bb7 in gimplify_stmt (stmt_p=0x77245ad8,
> seq_p=0x7fffb3b0) at ../../trunk/gcc/gimplify.c:5678
> #7  0x01543e69 in gimplify_statement_list
> (expr_p=0x7fffb288, pre_p=0x7fffb3b0) at
> ../../trunk/gcc/gimplify.c:1527
> #8  0x0157352f in gimplify_expr (expr_p=0x7fffb288,
> pre_p=0x7fffb3b0, post_p=0x7fffa6e8, gimple_test_f=0x155d16c
> , fallback=0)
> at ../../trunk/gcc/gimplify.c:7531
> #9  0x01563bb7 in gimplify_stmt (stmt_p=0x7fffb288,
> seq_p=0x7fffb3b0) at ../../trunk/gcc/gimplify.c:5678
> #10 0x0153eb49 in gimplify_and_add (t=0x77247600,
> seq_p=0x7fffb3b0) at ../../trunk/gcc/gimplify.c:358
> #11 0x01572a22 in gimplify_expr (expr_p=0x77245ac0,
> pre_p=0x7fffcd40, post_p=0x7fffb3f8, gimple_test_f=0x155d16c
> , fallback=0)
> at ../../trunk/gcc/gimplify.c:7457
> #12 0x01563bb7 in gimplify_stmt (stmt_p=0x77245ac0,
> seq_p=0x7fffcd40) at ../../trunk/gcc/gimplify.c:5678
> #13 0x01543e69 in gimplify_statement_list
> (expr_p=0x7724c098, pre_p=0x7fffcd40) at
> ../../trunk/gcc/gimplify.c:1527
> #14 0x0157352f in gimplify_expr (expr_p=0x7724c098,
> pre_p=0x7fffcd40, post_p=0x7fffc148, gimple_test_f=0x155d16c
> , fallback=0)
> at ../../trunk/gcc/gimplify.c:7531
> #15 0x01563bb7 in gimplify_stmt (stmt_p=0x7724c098,
> seq_p=0x7fffcd40) at ../../trunk/gcc/gimplify.c:5678
> #16 0x01542106 in gimplify_bind_expr (expr_p=0x7723c898,
> pre_p=0x7fffdc80) at ../../trunk/gcc/gimplify.c:1220
> #17 0x01571446 in gimplify_expr (expr_p=0x7723c898,
> pre_p=0x7fffdc80, post_p=0x7fffd068, gimple_test_f=0x155d16c
> , fallback=0)
> at ../../trunk/gcc/gimplify.c:7316
> #18 0x01563bb7 in gimplify_stmt (

Re: [PATCH][MIPS] NetLogic XLP scheduling

2012-07-16 Thread Richard Sandiford
Chung-Lin Tang  writes:
>>> Other generic changes include a new "hilo" insn attribute, to mark which
>>> of HI/LO does a m[ft]hilo insn access.
>> 
>> The way other schedulers handle this is with things like:
>> 
>> (define_insn_reservation "ir_sb1_mfhi" 1
>>   (and (eq_attr "cpu" "sb1,sb1a")
>>(and (eq_attr "type" "mfhilo")
>>  (not (match_operand 1 "lo_operand"
>>   "sb1_ex1")
>> 
>> which seems simpler.  mfhilo and mthilo are required to read operand 1
>> and write to operand 0 (respectively) in order to support this kind of
>> construct.
>> 
>> That said, even the above is a hold-over from when we tried to allow
>> high registers to store independent values.  These days we can be a bit
>> more precise, as with the patch below.  (As the comment says:
>> 
>>   ;; If a doubleword move uses these expensive instructions,
>>   ;; it is usually better to schedule them in the same way
>>   ;; as the singleword form, rather than as "multi".
>> 
>> I'm continuing to assume that mflo and mtlo are the best type choices
>> for unsplit double-register moves.  That path should be very rarely
>> outside of MIPS16 anyway -- just by sched1 if hi and lo are exposed
>> directly -- and no current scheduler tries to model a doubleword hi/lo
>> move separately from single-register ones.  The information is available
>> via the dword_mode attribute if required.)
>
> I suppose this means that actual generation of moves as mfhi/mthi should
> almost never happen out of normal conditions?

Yeah, the move patterns themselves never generate mfhi or mthi in isolation.
They either generate mflo, mtlo, mfhi+mflo, or mthi+mtlo.  mfhi and mthi
have special patterns that are generated by post-reload splits.

Richard


Re: [patch] Remove useless sets/clears of EDGE_CAN_FALLTHRU

2012-07-16 Thread Steven Bosscher
On Mon, Jul 16, 2012 at 10:53 AM, Richard Guenther
 wrote:
> Maybe we should rename EDGE_CAN_FALLTHRU to EDGE_PLF_1
> and have a #define in bb-reorder.c then?  Other passes might use
> it for their pass-local handling then and would not be content to set/unset
> it.

I intend to do a lot more cleanups on the edge and basic block flags
(that depends on the dumpfile.h patch, eagerly awaiting your ACK or
comments ;-).

For EDGE_CAN_FALLTHRU I was more thinking of a pointer map or an
sbitmap on an edge list, tbd. Or, like you suggest, make it a flag
available for passes to use. That would also help for a few other
flags (EDGE_LOOP_EXIT, EDGE_EXECUTABLE, ...).

Ciao!
Steven


Re: [patch] Introduce dumpfile.h, clean up tree-pass.h dependencies

2012-07-16 Thread Richard Guenther
On Fri, Jul 13, 2012 at 3:38 PM, Steven Bosscher  wrote:
> Hello,
>
> The attached monster patch re-organizes a lot of includes to avoid
> dependencies on tree-pass.h just for having dump_file available.
>
> I've used the following "rules" to decide what needs to go where:
>
> * tree-dump.h should be independent of the pass manager, i.e. not
> include tree-pass.h.
>
> * passes that do not need dumping of GENERIC do not need tree-dump.h either.
>
> * Any file that defines an opt_pass may include tree-pass.h.
>
> * If a file includes tree-pass.h, it does not need to include
> dumpfile.h or timevar.h, because tree-pass.h provides these already
> (the *opt_pass structs depend on them)
>
> * If a file does not include tree-pass.h, but it needs dump_file, it
> should include dumpfile.h. Likewise for timevar.h. This category of
> files are the implementation files for supporting code, like alias.c
> and cfg*.c.
>
> With those rules in mind, my hackathon started and the result is
> attached. I had to move a few functions around, but not very much. I
> also uncovered a bug in one of the DF files, where it was trying to
> use get_insns without including emit-rtl.h.  No DF file should emit
> RTL, so I don't want to include emit-rtl.h there, so I removed that
> dumping (which was only for debugging purposes anyway, and obviously
> not tested in a while or I wouldn't have run into this problem to
> begin with :-)
>
> Bootstrapped&tested on powerpc64-unknown-linux-gnu and on
> x86_64-unknown-linux-gnu. OK for trunk?

You moved get_ref_base_and_extent to tree.c - any reason for that?
It is similar to get_inner_reference which is in expr.c and similar to
get_addr_base_and_unit_offset which is still in tree-dfa.c.  I'd prefer
to have it stay where it is for this patch.

Thus, ok with that change.

Thanks,
Richard.

> Ciao!
> Steven
>
>
> * system.h (dump_file): Do not define.
> * tree-pass.h: Include dumpfile.h, which is a new file containing...
> (enum tree_dump_index, TDF_*, get_dump_file_name, dump_enabled_p,
> dump_initialized_p, dump_begin, dump_end, dump_node, dump_switch_p,
> dump_flag_name, dump_file, dump_flags, dump_file_name,
> get_dump_file_info, struct dump_file_info): all of this, moved to...
> * dumpfile.h: Here, new file.
> * tree-dump.h: Include dumpfile.h, but not tree-pass.h.
> (dump_stmt): Remove prototype for C++ specific function.
> (dump_enumerated_decls): Move prototype from here...
> * tree-flow.h (dump_enumerated_decls): ... to here.
> (get_ref_base_and_extent) Move prototype from here ...
> * tree.h (get_ref_base_and_extent) ... to here.
> * tree-ssa-live.c: Do not inclde tree-pretty-print.h, because
> gimple-pretty-print.h is enough.  Do not include tree-dump.h,
> include timevar.h and dumpfile.h instead.
> (struct numbered_tree_d, compare_decls_by_uid,
> dump_enumerated_decls_push, dump_enumerated_decls): Move from here ...
> * tree-dfa.c:(struct numbered_tree_d, compare_decls_by_uid,
> dump_enumerated_decls_push, dump_enumerated_decls):... to here.
> Do not include timevar.h.
> (get_ref_base_and_extent): Move from here ...
> * tree.c (get_ref_base_and_extent): ... to here.
> Do not include timevar.h.
> * tree-cfg.c: Do not include langhooks.h, tree-pretty-print.h, and
> timevar.h.
> (dump_cfg_stats): Use current_function_name.
> (gimple_cfg2vcg): Likewise.
> (dump_function_to_file): Likewise.
> * df-scan.c: Do not include tree-pass.h and timevar.h.
> Include dumpfile.h.
> (df_entry_block_bitmap_verify, df_exit_block_bitmap_verify): Do not
> use print_current_pass.
> * df-problems.c: Include dumpfile.h.
> Always define REG_DEAD_DEBUGGING, avoid #ifdef code, because it
> leads to errors in the code not selected.
> (df_note_compute): Do not print_rtl_with_bb here.  Fix compilation
> bug if REG_DEAD_DEBUGGING is not 0, get_insns is not available here.
> * lcm.c: Include dumpfile.h.
> Remove obsolete include of insn-attr.h.
> * dojump.c (do_compare_rtx_and_jump): Remove failure printing for
> missing probability notes.
> * stmt.c: Include dumpfile.h.
> (emit_case_decision_tree): Re-enable printing expand details only
> if TDF_DETAILS.
> * alias.c, auto-inc-dec.c, bb-reorder.c, caller-save.c, cfg.c,
> cfgcleanup.c, cfgexpand.c, cfgloop.c, cfgloopmanip.c, cgraph.c,
> cgraphclones.c, cgraphunit.c, combine.c, combine-stack-adj.c,
> coverage.c, cprop.c, cse.c, cselib.c, dbgcnt.c, dce.c, df-core.c,
> dse.c, dwarf2out.c, emit-rtl.c, except.c, expr.c, final.c,
> function.c, fwprop.c, gcse.c, gimple-fold.c,
> gimple-pretty-print.c, gimple-ssa-strength-reduction.c,
> gimplify.c, graphite-bloc

Re: [patch] Remove useless sets/clears of EDGE_CAN_FALLTHRU

2012-07-16 Thread Richard Guenther
On Sat, Jul 14, 2012 at 11:40 PM, Steven Bosscher  wrote:
> Hello,
>
> EDGE_CAN_FALLTHRU is internal to bb-reorder.c,
> set_edge_can_fallthru_flag() clears it on all edges and computes it
> fresh for bb-reorder.
>
> The test in rtl_verify_flow_info_1 has to stay because bb-reorder
> doesn't clean up the flag after it's done.
>
> Bootstrapped&tested on powerpc64-unknown-linux-gnu. OK?

Ok.

Maybe we should rename EDGE_CAN_FALLTHRU to EDGE_PLF_1
and have a #define in bb-reorder.c then?  Other passes might use
it for their pass-local handling then and would not be content to set/unset
it.

Thanks,
Richard.

> Ciao!
> Steven
>
> * haifa-sched.c (init_before_recovery): Do not set EDGE_CAN_FALLTHRU.
> * cfgrtl.c (force_nonfallthru_and_redirect): Likewise.
>
> Index: haifa-sched.c
> ===
> --- haifa-sched.c   (revision 189478)
> +++ haifa-sched.c   (working copy)
> @@ -7193,8 +7193,7 @@ init_before_recovery (basic_block *before_recovery
>
>redirect_edge_succ (e, single);
>make_single_succ_edge (single, empty, 0);
> -  make_single_succ_edge (empty, EXIT_BLOCK_PTR,
> -EDGE_FALLTHRU | EDGE_CAN_FALLTHRU);
> +  make_single_succ_edge (empty, EXIT_BLOCK_PTR, EDGE_FALLTHRU);
>
>label = block_label (empty);
>x = emit_jump_insn_after (gen_jump (label), BB_END (single));
> Index: cfgrtl.c
> ===
> --- cfgrtl.c(revision 189478)
> +++ cfgrtl.c(working copy)
> @@ -1365,8 +1365,8 @@ force_nonfallthru_and_redirect (edge e, basic_bloc
>  one and create separate abnormal edge to original destination.
>  This allows bb-reorder to make such edge non-fallthru.  */
>gcc_assert (e->dest == target);
> -  abnormal_edge_flags = e->flags & ~(EDGE_FALLTHRU | EDGE_CAN_FALLTHRU);
> -  e->flags &= EDGE_FALLTHRU | EDGE_CAN_FALLTHRU;
> +  abnormal_edge_flags = e->flags & ~EDGE_FALLTHRU;
> +  e->flags &= EDGE_FALLTHRU;
>  }
>else
>  {


Re: [patch] PR web/53919 - Add note to install.texi

2012-07-16 Thread Gerald Pfeifer
On Mon, 16 Jul 2012, Jonathan Wakely wrote:
> Thanks, revised patch attached. OK for trunk like this?

Oh, yes!  I meant to imply this in my previous message.

Thanks,
Gerald


Re: [PATCH] Enable vectorizer cost model by default at -O3

2012-07-16 Thread Richard Guenther
On Sun, 15 Jul 2012, William J. Schmidt wrote:

> The auto-vectorizer is overly aggressive when not constrained by the
> vectorizer cost model.  Although the cost model is by no means perfect,
> it does a reasonable job of avoiding many poor vectorization decisions.
> Since the auto-vectorizer is enabled by default at -O3 and above, we
> should also enable the vectorizer cost model by default at -O3 and
> above.
> 
> Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
> regressions.  Ok for trunk?

I agree this makes sense.  It probably will cause some missed-optimization
bugreports which means we need to make more target cost implementation
adjustments.

Thus, ok.

Thanks,
Richard.

> Thanks,
> Bill
> 
> 
> 2012-07-15  Bill Schmidt  
> 
>   * opts.c (default_option): Add -fvect-cost-model to default options
>   at -O3 and above.
> 
> 
> Index: gcc/opts.c
> ===
> --- gcc/opts.c(revision 189481)
> +++ gcc/opts.c(working copy)
> @@ -501,6 +501,7 @@ static const struct default_options default_option
>  { OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 },
>  { OPT_LEVELS_3_PLUS, OPT_fgcse_after_reload, NULL, 1 },
>  { OPT_LEVELS_3_PLUS, OPT_ftree_vectorize, NULL, 1 },
> +{ OPT_LEVELS_3_PLUS, OPT_fvect_cost_model, NULL, 1 },
>  { OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 },
>  { OPT_LEVELS_3_PLUS, OPT_ftree_partial_pre, NULL, 1 },
>  
> 
> 
> 

-- 
Richard Guenther 
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend


Re: PATCH: PR bootstrap/53963: [4.8 Regression] LTO bootstrap failed with bootstrap-profiled

2012-07-16 Thread Richard Guenther
On Sat, Jul 14, 2012 at 8:49 PM, H.J. Lu  wrote:
> Hi,
>
> Revision 189453:
>
> http://gcc.gnu.org/ml/gcc-cvs/2012-07/msg00357.html
>
> removes type attribute comparison in gimple_types_compatible_p_1 and
> caused PR middle-end/53959 and PR bootstrap/53963.  This restores type
> attribute comparison.  Tested on Linux/x86-64.  OK to install?

Ok.

Thanks,
Richard.

> Thanks.
>
>
> H.J.
> ---
> 2012-07-14  H.J. Lu  
>
> PR middle-end/53959
> PR bootstrap/53963
> * gimple.c (gimple_types_compatible_p_1): Restore type attribute
> comparison.
>
> diff --git a/gcc/gimple.c b/gcc/gimple.c
> index b419591..4d2a0f5 100644
> --- a/gcc/gimple.c
> +++ b/gcc/gimple.c
> @@ -3422,6 +3422,10 @@ gimple_types_compatible_p_1 (tree t1, tree t2, 
> type_pair_t p,
> goto different_types;
>  }
>
> +  /* If their attributes are not the same they can't be the same type.  */
> +  if (!attribute_list_equal (TYPE_ATTRIBUTES (t1), TYPE_ATTRIBUTES (t2)))
> +goto different_types;
> +
>/* Do type-specific comparisons.  */
>switch (TREE_CODE (t1))
>  {


Re: [patch] PR web/53919 - Add note to install.texi

2012-07-16 Thread Jonathan Wakely
On 16 July 2012 01:14, Gerald Pfeifer wrote:
> Hi Jonathan,
>
> On Sat, 14 Jul 2012, Jonathan Wakely wrote:
>> Attached this time, here's the original mail again:
>>
>> PR c++/53919
>> * doc/install.texi (Installing GCC): Refer to instructions for
>> released versions. Fix hyphenation.
>>
>> Whether or not we want the release-specific installation instructions
>> online, I don't think it hurts to point out that the docs at
>> http://gcc.gnu.org/install/ refer to the SVN trunk.
>
> This is good, with one caveat.  Can we please not refer to SVN? ;-)
>
> This is one of those lessons learned, where just "current development
> sources" or similar says the same, de facto, and makes it easier to
> change things.  (You'd be surprised how long we kept finding references
> to CVS.)
>
>  The latest version of this document is always available at
>  @uref{http://gcc.gnu.org/install/,,http://gcc.gnu.org/install/}.
> +The latest version refers to the SVN development sources, instructions for
> +specific released versions are included with the sources.
>
> And here, instead of repeating "The latest version", how about just
> "It refers..."?

Thanks, revised patch attached. OK for trunk like this?
commit 87cfa98ff2e5f885b44c21074e4991cb6d5c449c
Author: Jonathan Wakely 
Date:   Fri Jul 13 10:06:09 2012 +0100

PR c++/53919
* doc/install.texi (Installing GCC): Refer to instructions for
released versions. Fix hypenation.

diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index b35d803..6d40348 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -149,13 +149,15 @@ Free Documentation License}''.
 
 The latest version of this document is always available at
 @uref{http://gcc.gnu.org/install/,,http://gcc.gnu.org/install/}.
+It refers to the current development sources, instructions for
+specific released versions are included with the sources.
 
 This document describes the generic installation procedure for GCC as well
 as detailing some target specific installation instructions.
 
 GCC includes several components that previously were separate distributions
 with their own installation instructions.  This document supersedes all
-package specific installation instructions.
+package-specific installation instructions.
 
 @emph{Before} starting the build/install procedure please check the
 @ifnothtml


[Committed] Add new testcase

2012-07-16 Thread Andrew Pinski
Hi,
  When I was debugging a modified GCC 4.3 I ran into an ICE which was
fixed by http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00217.html .
The patch did not mention it was fixing an ICE, so I decided to add a testcase.

Committed the testcase as obvious.

Thanks,
Andrew Pinski

* gcc.dg/torture/builtins-1.c: New testcase.
Index: gcc.dg/torture/builtins-1.c
===
--- gcc.dg/torture/builtins-1.c (revision 0)
+++ gcc.dg/torture/builtins-1.c (revision 0)
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-rtl-expand-all" */
+/* { dg-final { cleanup-rtl-dump "expand" } } */
+int isdigit(int c)
+{
+return c >= 0;
+}
+
+
Index: ChangeLog
===
--- ChangeLog   (revision 189509)
+++ ChangeLog   (working copy)
@@ -1,3 +1,7 @@
+2012-07-16  Andrew Pinski  
+
+   * gcc.dg/torture/builtins-1.c: New testcase.
+
 2012-07-16  Hans-Peter Nilsson  
 
* gcc.target/cris/sync-2i.c, gcc.target/cris/sync-2s.c,