Re: [patch, build] Restore bootstrap in building libcc1 on darwin

2014-12-13 Thread Paolo Bonzini


On 05/12/2014 23:47, Jakub Jelinek wrote:
> On Fri, Dec 05, 2014 at 11:34:28PM +0100, Dominique Dhumieres wrote:
>>> As I've tried to explain, that is IMHO wrong though.
>>> If what you are after is the -B stuff too, then perhaps:
>>> ...
>>
>> Sorry but it does not work:
> 
> Sorry, make that (just removed 4x ' in each file):
> 
> 2014-12-05  Jakub Jelinek  
> 
>   PR bootstrap/64023
>   * Makefile.tpl (EXTRA_TARGET_FLAGS): Set STAGE1_LDFLAGS
>   to POSTSTAGE1_LDFLAGS and STAGE1_LIBS to POSTSTAGE1_LIBS.
>   Add -B to libstdc++-v3/src/.libs and libstdc++-v3/libsupc++/.libs
>   to CXX.
>   * Makefile.in: Regenerated.
> 
> --- Makefile.tpl.jj   2014-11-12 09:31:59.0 +0100
> +++ Makefile.tpl  2014-12-05 21:12:21.486031062 +0100
> @@ -641,7 +641,9 @@ EXTRA_TARGET_FLAGS = \
>   'AS=$(COMPILER_AS_FOR_TARGET)' \
>   'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
>   'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
> - 'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
> + 'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
> +  -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
> +  $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
>   'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
>   'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
>   'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
> @@ -659,6 +661,8 @@ EXTRA_TARGET_FLAGS = \
>   'WINDRES=$$(WINDRES_FOR_TARGET)' \
>   'WINDMC=$$(WINDMC_FOR_TARGET)' \
>   'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
> + 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
> + 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
>   "TFLAGS=$$TFLAGS"
>  
>  TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
> --- Makefile.in.jj2014-11-28 14:40:52.0 +0100
> +++ Makefile.in   2014-12-05 21:11:48.276616008 +0100
> @@ -835,7 +835,9 @@ EXTRA_TARGET_FLAGS = \
>   'AS=$(COMPILER_AS_FOR_TARGET)' \
>   'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
>   'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
> - 'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
> + 'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
> +  -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
> +  $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
>   'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
>   'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
>   'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
> @@ -853,6 +855,8 @@ EXTRA_TARGET_FLAGS = \
>   'WINDRES=$$(WINDRES_FOR_TARGET)' \
>   'WINDMC=$$(WINDMC_FOR_TARGET)' \
>   'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
> + 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
> + 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
>   "TFLAGS=$$TFLAGS"
>  
>  TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
> 
>   Jakub
> 

If it also works for --disable-bootstrap, this is okay.

Paolo



Re: [PATCH][rtlanal.c][BE][1/2] Fix vector load/stores to not use ld1/st1

2014-12-13 Thread Eric Botcazou
> FWIW I agree this is the right approach, although I can't approve it.
> The assert above is guarding code that deals with a very general case,
> including some unusual combinations, so I don't think it would be a
> good idea to try to remove it entirely.

Yes, but the patch is a bit of kludge since it short-circuits the meat of the 
function:

   /* This should always pass, otherwise we don't know how to verify
 the constraint.  These conditions may be relaxed but
 subreg_regno_offset would need to be redesigned.  */
  gcc_assert ((GET_MODE_SIZE (xmode) % GET_MODE_SIZE (ymode)) == 0);
  gcc_assert ((nregs_xmode % nregs_ymode) == 0);

So what would it take to do things properly here, i.e. relax the conditions 
and adjust downstream?

-- 
Eric Botcazou


Re: [hsa] HSA: support for direct function call is introduced.

2014-12-13 Thread Eric Botcazou
Martin,

> gcc/c-family/ChangeLog:
> 
> 2014-12-05  Martin Liska  
> 
>   * c-common.c: New 'hsafunc' attribute is added.
>
> 2014-12-05  Martin Liska  
> 
>   * hsa-brig.c (struct function_linkage_pair): New data structure.
>   (hsa_brig_section::get_ptr_by_offset): New function.
>   (emit_directive_variable): Linkage is retrieved by symbol.
>   (emit_function_directives): Emitted function is added to map
>   with offsets.

Would you mind writing ChangeLog entries in the standard form, please?


2014-12-05  Martin Liska  

* c-common.c: Add 'hsafunc' attribute.


2014-12-05  Martin Liska  

* hsa-brig.c (struct function_linkage_pair): New data structure.
(hsa_brig_section::get_ptr_by_offset): New function.
(emit_directive_variable): Retrieve the linkage by symbol.
(emit_function_directives): Add emitted function to map with offsets.


Entries must (generally) start with either "New", "Likewise" or a verb.

-- 
Eric Botcazou


Re: [PATCH][AARCH64]Fix AArch64 CLZ_DEFINED_AT_ZERO and CTZ_DEFINED_AT_ZERO definition.

2014-12-13 Thread Richard Earnshaw
On Wed, 2014-12-10 at 12:59 +, Renlin Li wrote:
> Hi all,
> 
> This patch update the CTZ_DEFINED_VALUE_AT_ZERO definition to support 
> more modes. In addition, those two macros should both return 2 in 
> aarch64 back-end.
> 
> Here are the explanations from GCC documentation:
> 
> CLZ_DEFINED_VALUE_AT_ZERO (mode, value)
> CTZ_DEFINED_VALUE_AT_ZERO (mode, value)
> A C expression that indicates whether the architecture defines a value
> for @code{clz} or @code{ctz} with a zero operand.
> A result of 0 indicates the value is undefined.
> If the value is defined for only the RTL expression, the macro should
> evaluate to 1; if the value applies also to the corresponding optab
> entry (which is normally the case if it expands directly into
> the corresponding RTL), then the macro should evaluate to 2.
> In the cases where the value is defined, @var{value} should be set to
> this value.
> 
> 
> aarch64-none-elf has been test on the model, no new issue.
> Okay for trunk?
> 
> Regards,
> Renlin Li
> 
> gcc/ChangeLog:
> 
> 2014-12-10 Renlin Li 
> 
>  * config/aarch64/aarch64.h (CLZ_DEFINED_VALUE_AT_ZERO): make it 
> return 2.
>  (CTZ_DEFINED_VALUE_AT_ZERO): Update to support more modes.

OK.

R.



[SH][committed] Fix sp-switch testcase when there is no underscore prefix

2014-12-13 Thread Oleg Endo
Hi,

The attached patch fixes symbol matching in the sh/sp-switch.c testcase
to allow zero or more prefix underscores.  This should make the test
pass on sh4-linux.
Tested on sh-sim with
make check-gcc RUNTESTFLAGS="sh.exp=sp-switch.c --target_board=sh-sim
\{-m4/-ml}"
and
make check-gcc RUNTESTFLAGS="sh.exp=sp-switch.c --target_board=sh-sim
\{-m4/-ml/-fno-leading-underscore}"
Committed as r218706.

Cheers,
Oleg

gcc/testsuite/ChangeLog:
* gcc.target/sh/sp-switch.c: Match zero or more underscores in
alt_stack symbol.
Index: gcc/testsuite/gcc.target/sh/sp-switch.c
===
--- gcc/testsuite/gcc.target/sh/sp-switch.c	(revision 218604)
+++ gcc/testsuite/gcc.target/sh/sp-switch.c	(working copy)
@@ -1,6 +1,6 @@
 /* { dg-do compile }  */
 /* { dg-final { scan-assembler "mov\tr0,r15" } } */
-/* { dg-final { scan-assembler ".long\t_alt_stack" } } */
+/* { dg-final { scan-assembler ".long\t\[_\]*alt_stack" } } */
 
 void *alt_stack;
 void f() __attribute__ ((interrupt_handler, sp_switch ("alt_stack")));


[SH][committed] PR 53513 - Fix test case failures

2014-12-13 Thread Oleg Endo
Hi,

After the changes regarding the FPSCR handling, some SH test cases
started to fail.  This fixes it.  Tested with
make -k check-gcc RUNTESTFLAGS="sh.exp --target_board=sh-sim
\{-m4/-ml,-m2/-ml}"
to verify that the test case passes again.  Committed as r218707.

Cheers,
Oleg

gcc/testsuite/ChangeLog:
PR target/53513
* gcc.target/sh/attr-isr-nosave_low_regs.c: Fix matching of expected
register push/pop sequences.
* gcc.target/sh/attr-isr.c: Likewise.
* gcc.target/sh/attr-isr-trapa.c: Likewise.
* gcc.target/sh/pragma-isr-nosave_low_regs.c: Likewise.
* gcc.target/sh/pragma-isr-trapa.c: Likewise.
* gcc.target/sh/pragma-isr-trapa2.c: Likewise.
Index: gcc/testsuite/gcc.target/sh/attr-isr-nosave_low_regs.c
===
--- gcc/testsuite/gcc.target/sh/attr-isr-nosave_low_regs.c	(revision 218705)
+++ gcc/testsuite/gcc.target/sh/attr-isr-nosave_low_regs.c	(working copy)
@@ -1,15 +1,14 @@
 /* A call will clobber all call-saved registers.
If #pragma nosave_low_regs is specified, do not save/restore r0..r7.
(On SH3* and SH4* r0..r7 are banked)
-   One of these registers will also do fine to hold the function address.
-   Call-saved registers r8..r13 also don't need to be restored.  */
+   Call-saved registers r8..r13 also don't need to be restored.
+   To test that we look for register push insns such as 'mov.l r0,@-r15'.  */
 /* { dg-do compile { target { { "sh*-*-*" } && nonpic } } }  */
 /* { dg-skip-if "" { "sh*-*-*" } { "-m1*" "-m2*" "-m5*" } { "" } }  */
 /* { dg-options "-O" }  */
 /* { dg-final { scan-assembler-times "rte" 1 } }  */
-/* { dg-final { scan-assembler-not "\[^f\]r\[0-9\]\[ \t\]*," } }  */
-/* { dg-final { scan-assembler-not "\[^f\]r\[89\]" } }  */
-/* { dg-final { scan-assembler-not "\[^f\]r1\[,0-3\]" } }  */
+/* { dg-final { scan-assembler-not "mov.l\tr\[0-9\],@-r15" } }  */
+/* { dg-final { scan-assembler-not "mov.l\tr1\[0-4\],@-r15" } }  */
 /* { dg-final { scan-assembler-times "macl" 2 } }  */
 
 extern void bar (void);
Index: gcc/testsuite/gcc.target/sh/pragma-isr-nosave_low_regs.c
===
--- gcc/testsuite/gcc.target/sh/pragma-isr-nosave_low_regs.c	(revision 218705)
+++ gcc/testsuite/gcc.target/sh/pragma-isr-nosave_low_regs.c	(working copy)
@@ -1,15 +1,14 @@
 /* A call will clobber all call-saved registers.
If #pragma nosave_low_regs is specified, do not save/restore r0..r7.
(On SH3* and SH4* r0..r7 are banked)
-   One of these registers will also do fine to hold the function address.
-   Call-saved registers r8..r13 also don't need to be restored.  */
+   Call-saved registers r8..r14 also don't need to be restored.
+   To test that we look for register push insns such as 'mov.l r0,@-r15'.  */
 /* { dg-do compile { target { { "sh*-*-*" } && nonpic } } }  */
 /* { dg-skip-if "" { "sh*-*-*" } { "-m1*" "-m2*" "-m5*" } { "" } }  */
 /* { dg-options "-O" }  */
 /* { dg-final { scan-assembler-times "rte" 1 } }  */
-/* { dg-final { scan-assembler-not "\[^f\]r\[0-9\]\[ \t\]*," } }  */
-/* { dg-final { scan-assembler-not "\[^f\]r\[89\]" } }  */
-/* { dg-final { scan-assembler-not "\[^f\]r1\[,0-3\]" } }  */
+/* { dg-final { scan-assembler-not "mov.l\tr\[0-9\],@-r15" } }  */
+/* { dg-final { scan-assembler-not "mov.l\tr1\[0-4\],@-r15" } }  */
 /* { dg-final { scan-assembler-times "macl" 2 } }  */
 
 extern void foo (void);
Index: gcc/testsuite/gcc.target/sh/attr-isr.c
===
--- gcc/testsuite/gcc.target/sh/attr-isr.c	(revision 218705)
+++ gcc/testsuite/gcc.target/sh/attr-isr.c	(working copy)
@@ -1,6 +1,14 @@
+/* The call will clobber r0..r7, which will need not be saved/restored, but
+   not the call-saved registers r8..r14.  Check this by counting the register
+   push insns.  */
 /* { dg-do compile { target { { { sh-*-* sh[1234ble]*-*-* } && { ! sh2a*-*-* } } && nonpic } } } */
 /* { dg-skip-if "" { "sh*-*-*" } { "-m2a*" } { "" } } */
 /* { dg-options "-O" } */
+/* { dg-final { scan-assembler-times "rte" 1} } */
+/* { dg-final { scan-assembler-times "mov.l\tr\[0-7\],@-r15" 8 } }  */
+/* { dg-final { scan-assembler-not "mov.l\tr\[89\],@-r15" } }  */
+/* { dg-final { scan-assembler-not "mov.l\tr1\[0-4\],@-r15" } }  */
+
 extern void foo ();
 
 void
@@ -8,13 +16,3 @@
 {
   foo ();
 }
-
-/* { dg-final { scan-assembler-times "rte" 1} } */
-/* The call will clobber r0..r7, which will need not be saved/restored.
-   One of these registers will do fine to hold the function address,
-   hence the all-saved registers r8..r13 don't need to be restored.  */
-/* { dg-final { scan-assembler-times "r15\[+\],\[ \t\]*r\[0-9\]\[ \t\]*\n" 8 } } */
-/* { dg-final { scan-assembler-times "\[^f\]r\[0-9\]\[ \t\]*," 8 } } */
-/* { dg-final { scan-assembler-not "\[^f\]r1\[0-3\]" } } */
-/* { dg-final { scan-assembler-times "macl" 2} } */
-/* { dg-final { scan-assembler-not

Re: [PATCH] Fix for PR ipa/64278

2014-12-13 Thread Richard Biener
On December 12, 2014 5:54:20 PM CET, "Martin Liška"  wrote:
>Hello.
>
>This is patch for PR ipa/64278, where I replace ambiguous std::abs with
>absu_hwi.
>
>Patch can bootstrap on ppc64-linux and no new regression was seen.
>
>Ready for thunk?

OK

Thanks,
Richard.

>Thanks,
>Martin




[patch] Update std::experimental::{any,optional,string_view}

2014-12-13 Thread Jonathan Wakely

This updates the Library Fundamentals types to reflect the changes
approved in Urbana.

Tested x86_64-linux, committed to trunk.

commit de8bfae1fd96f002edc115ddeb2cb4e28c6164ce
Author: Jonathan Wakely 
Date:   Fri Dec 12 22:28:57 2014 +

Post-Urbana updates to Library Fundamentals v1.

	* include/experimental/any (any): Remove allocator support and update
	feature-testing macro.
	* include/experimental/functional: Update feature-testing macro.
	* include/experimental/optional (optional::_M_get()): Add constexpr.
	(optional::operator*(), optional::value()): Overload and add
	ref-qualifiers. Update feature-testing macro.
	* include/experimental/string_view (basic_string_view::clear): Remove
	and update feature-testing macro.
	* testsuite/experimental/any/cons/3.cc: Remove.
	* testsuite/experimental/any/cons/4.cc: Remove.
	* testsuite/experimental/any/misc/any_cast.cc: Remove allocator tests.
	* testsuite/experimental/any/misc/any_cast_neg.cc: Adjust dg-error.
	* testsuite/experimental/string_view/capacity/1.cc: Don't test clear().

diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any
index 87dd7a1..3af925f 100644
--- a/libstdc++-v3/include/experimental/any
+++ b/libstdc++-v3/include/experimental/any
@@ -36,11 +36,9 @@
 #else
 
 #include 
-#include 
+#include 
 #include 
 #include 
-#include 
-#include 
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -60,7 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @{
*/
 
-#define __cpp_lib_experimental_any 201402
+#define __cpp_lib_experimental_any 201411
 
   /**
*  @brief Exception class thrown by a failed @c any_cast
@@ -96,7 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   std::aligned_storage::type _M_buffer;
 };
 
-template,
+template,
 	 bool _Fits = (sizeof(_Tp) <= sizeof(_Storage))>
   using _Internal = std::integral_constant;
 
@@ -111,19 +109,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
  _Manager_internal<_Tp>,
  _Manager_external<_Tp>>;
 
-#if __cpp_rtti
-// When RTTI is disabled __any_caster assumes the manager is either
-// _Manager_internal or _Manager_external, so this type must not be used.
-template
-  struct _Manager_alloc; // creates contained object using an allocator
-
-template>
-  using _ManagerAlloc = conditional_t<_Internal<_Tp>::value,
-	  _Manager_internal<_Tp>,
-	  _Manager_alloc<_Tp, _TpAlloc>>;
-#endif
-
 template>
   using _Decay = enable_if_t::value, _Decayed>;
 
@@ -165,35 +150,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		  "The contained object must be CopyConstructible");
   }
 
-/// Allocator-extended default constructor (the allocator is ignored).
-template 
-  any(allocator_arg_t, const _Allocator&) noexcept : any() { }
-
-#if __cpp_rtti
-/// Construct with a copy of @p __value as the contained object.
-template ,
-	  typename _Mgr = _ManagerAlloc<_Tp, _Allocator>>
-  any(allocator_arg_t, const _Allocator& __a, _ValueType&& __value)
-  : _M_manager(&_Mgr::_S_manage),
-_M_storage(_Mgr::_S_alloc(__a, std::forward<_ValueType>(__value)))
-  {
-	static_assert(is_copy_constructible<_Tp>::value,
-		  "The contained object must be CopyConstructible");
-  }
-#endif
-
-/* TODO: implement this somehow
-/// Allocator-extended copy constructor.
-template 
-  any(allocator_arg_t, const _Allocator& __a, const any& __other);
-*/
-
-/// Allocator-extended move constructor (the allocator is ignored).
-template 
-  any(allocator_arg_t, const _Allocator&, any&& __other) noexcept
-  : any(std::move(__other)) { }
-
 /// Destructor, calls @c clear()
 ~any() { clear(); }
 
@@ -281,13 +237,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 template
   friend void* __any_caster(const any* __any)
   {
-#if __cpp_rtti
-	if (__any->type() != typeid(_Tp))
-	  return nullptr;
-#else
 	if (__any->_M_manager != &_Manager>::_S_manage)
 	  return nullptr;
-#endif
 	_Arg __arg;
 	__any->_M_manager(_Op_access, __any, &__arg);
 	return __arg._M_obj;
@@ -334,29 +285,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	return __storage;
 	  }
   };
-
-#if __cpp_rtti
-// Manage external contained object using an allocator
-template
-  struct _Manager_alloc
-  {
-	static_assert(std::is_same<_Tp, typename _Alloc::value_type>::value,
-		  "Allocator's value_type is correct");
-
-	// Type that holds contained object and allocator
-	struct _Data;
-
-	using _Traits = typename std::allocator_traits<_Alloc>::template
-	  rebind_traits<_Data>;
-
-	static void
-	_S_manage(_Op __which, const any* __anyp, _Arg* __arg);
-
-	template
-	  static _Storage
-	  _S_alloc(const _Alloc& __a, _Up&& __value);
-  };
-#endif
   };
 
   /// Exchange the states of two @c any objects.
@@ -446,71 +374,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 }
   // @}
 
-#if __cpp_rtti
-  template
-struct any:

[Patch, Fortran] PR 63674: procedure pointer and non/pure procedure

2014-12-13 Thread Janus Weil
Hi all,

it's been a while since I have contributed to this list and to
gfortran, but it's good to see that you guys are still making a lot of
progress with this great compiler.

In any case, I recently found some time to prepare a small patch
related to my old pet (procedure pointers). It adds some diagnostics
for the PURE attribute.

Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus



2014-12-13  Janus Weil  

PR fortran/63674
* resolve.c (pure_function): Treat procedure-pointer components.
(check_pure_function): New function.
(resolve_function): Use it.
(pure_subroutine): Return a bool to indicate success and modify
arguments.
(resolve_generic_s0,resolve_specific_s0,resolve_unknown_s): Use return
value of 'pure_subroutine'.
(resolve_ppc_call): Call 'pure_subroutine'.
(resolve_expr_ppc): Call 'check_pure_function'.


2014-12-13  Janus Weil  

PR fortran/63674
* gfortran.dg/proc_ptr_comp_39.f90: New.
Index: gcc/fortran/resolve.c
===
--- gcc/fortran/resolve.c   (Revision 218705)
+++ gcc/fortran/resolve.c   (Arbeitskopie)
@@ -2746,6 +2746,7 @@ static int
 pure_function (gfc_expr *e, const char **name)
 {
   int pure;
+  gfc_component *comp;
 
   *name = NULL;
 
@@ -2754,8 +2755,14 @@ pure_function (gfc_expr *e, const char **name)
 && e->symtree->n.sym->attr.proc == PROC_ST_FUNCTION)
 return pure_stmt_function (e, e->symtree->n.sym);
 
-  if (e->value.function.esym)
+  comp = gfc_get_proc_ptr_comp (e);
+  if (comp)
 {
+  pure = gfc_pure (comp->ts.interface);
+  *name = comp->name;
+}
+  else if (e->value.function.esym)
+{
   pure = gfc_pure (e->value.function.esym);
   *name = e->value.function.esym->name;
 }
@@ -2801,6 +2808,40 @@ pure_stmt_function (gfc_expr *e, gfc_symbol *sym)
 }
 
 
+/* Check if a non-pure function function is allowed in the current context. */
+
+static bool check_pure_function (gfc_expr *e)
+{
+  const char *name = NULL;
+  if (!pure_function (e, &name) && name)
+{
+  if (forall_flag)
+{
+  gfc_error ("Reference to non-PURE function '%s' at %L inside a "
+ "FORALL %s", name, &e->where,
+ forall_flag == 2 ? "mask" : "block");
+  return false;
+}
+  else if (gfc_do_concurrent_flag)
+{
+  gfc_error ("Reference to non-PURE function '%s' at %L inside a "
+ "DO CONCURRENT %s", name, &e->where,
+ gfc_do_concurrent_flag == 2 ? "mask" : "block");
+  return false;
+}
+  else if (gfc_pure (NULL))
+{
+  gfc_error ("Reference to non-PURE function '%s' at %L "
+ "within a PURE procedure", name, &e->where);
+  return false;
+}
+
+  gfc_unset_implicit_pure (NULL);
+}
+  return true;
+}
+
+
 /* Resolve a function call, which means resolving the arguments, then figuring
out which entity the name refers to.  */
 
@@ -2809,7 +2850,6 @@ resolve_function (gfc_expr *expr)
 {
   gfc_actual_arglist *arg;
   gfc_symbol *sym;
-  const char *name;
   bool t;
   int temp;
   procedure_type p = PROC_INTRINSIC;
@@ -2982,34 +3022,10 @@ resolve_function (gfc_expr *expr)
 #undef GENERIC_ID
 
   need_full_assumed_size = temp;
-  name = NULL;
 
-  if (!pure_function (expr, &name) && name)
-{
-  if (forall_flag)
-   {
- gfc_error ("Reference to non-PURE function %qs at %L inside a "
-"FORALL %s", name, &expr->where,
-forall_flag == 2 ? "mask" : "block");
- t = false;
-   }
-  else if (gfc_do_concurrent_flag)
-   {
- gfc_error ("Reference to non-PURE function %qs at %L inside a "
-"DO CONCURRENT %s", name, &expr->where,
-gfc_do_concurrent_flag == 2 ? "mask" : "block");
- t = false;
-   }
-  else if (gfc_pure (NULL))
-   {
- gfc_error ("Function reference to %qs at %L is to a non-PURE "
-"procedure within a PURE procedure", name, &expr->where);
- t = false;
-   }
+  if (!check_pure_function(expr))
+t = false;
 
-  gfc_unset_implicit_pure (NULL);
-}
-
   /* Functions without the RECURSIVE attribution are not allowed to
* call themselves.  */
   if (expr->value.function.esym && !expr->value.function.esym->attr.recursive)
@@ -3056,23 +3072,32 @@ resolve_function (gfc_expr *expr)
 
 /* Subroutine resolution */
 
-static void
-pure_subroutine (gfc_code *c, gfc_symbol *sym)
+static bool
+pure_subroutine (gfc_symbol *sym, const char *name, locus *loc)
 {
   if (gfc_pure (sym))
-return;
+return true;
 
   if (forall_flag)
-gfc_error ("Subroutine call to %qs in FORALL block at %L is not PURE",
-  sym->name, &c->loc);
+{
+  gfc_err

Go patch committed: Traverse type in a type descriptor expression

2014-12-13 Thread Ian Lance Taylor
Due to an oversight, traversing a type descriptor expression in the Go
frontend failed to traverse the type.  This caused GCC PR 61244.  This
patch from Chris Manghane fixes the problem.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff -r 08fdb81ed1ec go/expressions.cc
--- a/go/expressions.cc Fri Dec 12 17:57:44 2014 -0800
+++ b/go/expressions.cc Sat Dec 13 16:52:12 2014 -0800
@@ -13657,6 +13657,9 @@
   { }
 
  protected:
+  int
+  do_traverse(Traverse*);
+
   Type*
   do_type()
   { return Type::make_type_descriptor_ptr_type(); }
@@ -13688,6 +13691,14 @@
   Type* type_;
 };
 
+int
+Type_descriptor_expression::do_traverse(Traverse* traverse)
+{
+  if (Type::traverse(this->type_, traverse) == TRAVERSE_EXIT)
+return TRAVERSE_EXIT;
+  return TRAVERSE_CONTINUE;
+}
+
 // Dump ast representation for a type descriptor expression.
 
 void


Merge from trunk to gccgo branch

2014-12-13 Thread Ian Lance Taylor
I merged trunk revision 218715 to the gccgo branch.

Ian