Re: [PATH] Intel offload library

2014-08-25 Thread Andrey Turetskiy
Ping.

On Tue, Aug 19, 2014 at 12:45 PM, Kirill Yukhin  wrote:
> Hello,
> On 12 Aug 10:58, Andrey Turetskiy wrote:
>> All remarks from
>> https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02166.html are fixed.
>> Updated version of liboffloadmic you can find in GIT branch
>> kyukhin/gomp4-offload:
>> https://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=refs/heads/kyukhin/gomp4-offload.
>> Commit: HEAD~3 ("Add liboffloadmic with offloading emulator").
> Is it ok for trunk now?
>
> --
> Thanks, K



-- 
Best regards,
Andrey Turetskiy


[PATCH] Small fix for r214086 Asan regression

2014-08-25 Thread Yury Gribov

Hi all,

Deja pattern in r214086's test is too strict (Asan runtime will not 
always be able to detect that invalid memory access is 
use-after-poison). I've cooked a trivial patch to loosen the check so 
test now also works on i386.


Tested on x64 and i386. Ok to commit?

-Y
commit aa3258be3749174a407185835a0484ebcbaf9bd3
Author: Yury Gribov 
Date:   Mon Aug 25 12:04:01 2014 +0400

2014-08-26  Yury Gribov  

	* c-c++-common/asan/pr62089.c: Fix test on 32-bit platforms.

diff --git a/gcc/testsuite/c-c++-common/asan/pr62089.c b/gcc/testsuite/c-c++-common/asan/pr62089.c
index 22b877b..b436b41 100644
--- a/gcc/testsuite/c-c++-common/asan/pr62089.c
+++ b/gcc/testsuite/c-c++-common/asan/pr62089.c
@@ -34,4 +34,4 @@ main () {
   return 0;
 }
 
-/* { dg-output "ERROR: AddressSanitizer: use-after-poison" } */
+/* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */


Re: [PATCH 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__

2014-08-25 Thread James Clarke
So I should just take that particular check out then?

James Clarke

> On 25 Aug 2014, at 21:05, Mike Stump  wrote:
> 
>> On Aug 25, 2014, at 11:03 AM, James Clarke  wrote:
>> Previously, this macro had taken the form 10X0, where X is the minor
>> version number, e.g. 1090 for OS X 10.9 Mavericks. However, as of OS X
>> 10.10 Yosemite, it should take the form 10XX00, i.e. 101000 for 10.10.
> 
> So, if they continue using the same scheme, I’d prefer to future proof this 
> (I don’t like software time bombs) so that 10.11.0 works as well as 10.12.0 
> and so on.
> 
> We didn’t do this last time, as we were unsure how the numbers would work 
> out.  Now, it is much safer to see what the likely format will be.
> 
> Could you try that?
> 
>> -  if (major_vers > 4 + 9)
>> +  if (major_vers > 4 + 10)
> 
> I think this is the only thing that has to change.


[debug-early] New branch for streaming dwarf early (and status)

2014-08-25 Thread Aldy Hernandez

Gentlemen!

As discussed behind closed doors previously... I'll be working on 
streaming dwarf early.  This ultimately benefits Andrew's aspirations 
for a gimple type system, removing the front-end tentacles from the rest 
of the compilation, and LTO debugging in the presence of language hooks.


My main/current goal is calling dwarf2out early for the type system, 
with the streaming part for LTO/dwarf as a side-effect (but not a 
short-term goal).  I hope I can work on everything onto LTO, but I make 
no guarantees.  So, let's start with building the dwarf tables earlier 
(near free_lang_data) and see how this party goes.


I have created a new branch in aldyh/debug-early (patch attached) which 
contains my initial work, if only for feedback and so I don't take 
horribly wrong turns as I move along.  I'm hoping to lean on each one of 
you for advice as debugging, and dwarf, is this black box of magic bits 
I know very little about (not unlike the rest of GCC for me ;-)).


A few notes.

I started with some old patches Michael Matz had for calling dwarf2out() 
on decls early (and by consequence types), as well as supporting 
infrastructure to fix the mess calling dwarf2out twice creates.  For 
reference, his initial work ported to mainline is this commit:


327f62603a222d9e9ca31f56ae8b52993f649d93

Everything else is my fault.  Michael, I'd appreciate you taking a peek 
at how I have adapted your work.  Feedback, is greatly appreciated.


I have made some changes to gen_formal_parameter_die() to survive being 
called twice.  We initially make the DIE through dwarf2out_early_decl(), 
and augment it with location information when we call dwarf2out again 
from rest_of_handle_final().


With the current branch, I'm slowly going through guality failures and 
fixing them.


My current predicament is that dwarf2out_early_decl() is called early 
enough such that dwarf2out_decl() sets the context die to the entire 
compilation unit.  Which means, that local variables end up with global 
scope.  I was thinking of hacking gen_variable_die() such that the 
second time around through gen_variable_die(), we fix the parent_die to 
point to the correct place, but I haven't thought too much about it. 
Perhaps dwarf2out_early_decl() should set things up correctly??  I'm 
open to suggestions.


The usual branch rules apply.  I'm certainly not above receiving charity 
patches from any of you :).


Fire away!

Aldy
diff --git a/gcc/debug.h b/gcc/debug.h
index 3ac7976..28bc210 100644
--- a/gcc/debug.h
+++ b/gcc/debug.h
@@ -187,6 +187,8 @@ extern void dwarf2out_switch_text_section (void);
 const char *remap_debug_filename (const char *);
 void add_debug_prefix_map (const char *);
 
+extern void dwarf2out_early_decl (tree);
+
 /* For -fdump-go-spec.  */
 
 extern const struct gcc_debug_hooks *
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 1a9e50a..1ee5c26 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3677,7 +3677,7 @@ decl_ultimate_origin (const_tree decl)
   /* output_inline_function sets DECL_ABSTRACT_ORIGIN for all the
  nodes in the function to point to themselves; ignore that if
  we're trying to output the abstract instance of this function.  */
-  if (DECL_ABSTRACT (decl) && DECL_ABSTRACT_ORIGIN (decl) == decl)
+  if (/*DECL_ABSTRACT (decl) &&*/ DECL_ABSTRACT_ORIGIN (decl) == decl)
 return NULL_TREE;
 
   /* Since the DECL_ABSTRACT_ORIGIN for a DECL is supposed to be the
@@ -4777,6 +4777,7 @@ remove_child_TAG (dw_die_ref die, enum dwarf_tag tag)
 while (c->die_tag == tag)
   {
 	remove_child_with_prev (c, prev);
+	c->die_parent = NULL;
 	/* Might have removed every child.  */
 	if (c == c->die_sib)
 	  return;
@@ -5515,6 +5516,49 @@ debug_dwarf (void)
   print_indent = 0;
   print_die (comp_unit_die (), stderr);
 }
+
+/* Perform some sanity checks on DIEs after they have been generated
+   earlier in the compilation process.  */
+
+static void
+check_die (dw_die_ref die, unsigned level)
+{
+  static unsigned long mark = 1;
+  dw_die_ref c, p;
+  /* Check that all our childs have their parent set to us.  */
+  c = die->die_child;
+  if (c) do {
+  c = c->die_sib;
+  gcc_assert (c->die_parent == die);
+} while (c != die->die_child);
+
+  /* Check the we are part of our parent's child list.  */
+  mark++;
+  p = die->die_parent;
+  if (p)
+{
+  c = p->die_child;
+  gcc_assert (c);
+  do {
+	c = c->die_sib;
+	/* Found it.  */
+	if (c == die)
+	  break;
+	/* If we're at start --> not found.  */
+	gcc_assert (c != p->die_child);
+	/* If we've seen this node already the circular list doesn't
+	   even go back to start.  */
+	gcc_assert (c->die_abbrev != mark);
+	c->die_abbrev = mark;
+  } while (1);
+}
+
+  if (!level)
+return;
+
+  FOR_EACH_CHILD (die, c, check_die (c, level - 1));
+}
+
 
 /* Start a new compilation unit DIE for an include file.  OLD_UNIT is the CU
for the enclosing include file, if any.  BINCL_DIE is the DW_TAG_GNU_BINCL

Re: C++ PATCH to support non-constexpr variable templates

2014-08-25 Thread Jason Merrill

On 08/25/2014 03:15 PM, Ville Voutilainen wrote:

Another ICE


Fixed:

Jason


commit 351ac0a147cbfe01e4f8b13a79432d3f37f42caa
Author: Jason Merrill 
Date:   Mon Aug 25 20:29:21 2014 -0400

	* pt.c (check_explicit_specialization): Don't complain about
	non-template variable.
	(template_for_substitution): Allow variable templates.
	(check_template_variable): Fix logic for member var template.
	* decl.c (start_decl): Don't complain about extra template header
	here.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 80696dd..d03f8a4 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4672,14 +4672,6 @@ start_decl (const cp_declarator *declarator,
 		}
 		  field = DECL_TEMPLATE_RESULT (field);
 		}
-	  else if (this_tmpl)
-		{
-		  error_at (DECL_SOURCE_LOCATION (decl),
-			"member template declaration of %qD", decl);
-		  inform (DECL_SOURCE_LOCATION (field), "does not match "
-			  "non-member-template declaration here");
-		  return error_mark_node;
-		}
 
 	  if (DECL_CONTEXT (field) != context)
 		{
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3e6d777..59df387 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2308,7 +2308,8 @@ check_template_variable (tree decl)
 {
   tree ctx = CP_DECL_CONTEXT (decl);
   int wanted = num_template_headers_for_class (ctx);
-  if (!TYPE_P (ctx) || !CLASSTYPE_TEMPLATE_INFO (ctx))
+  if (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)
+  && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl)))
 {
   if (cxx_dialect < cxx14)
 pedwarn (DECL_SOURCE_LOCATION (decl), 0,
@@ -2323,7 +2324,8 @@ check_template_variable (tree decl)
   bool warned = pedwarn (DECL_SOURCE_LOCATION (decl), 0,
 			 "too many template headers for %D (should be %d)",
 			 decl, wanted);
-  if (warned && CLASSTYPE_TEMPLATE_SPECIALIZATION (ctx))
+  if (warned && CLASS_TYPE_P (ctx)
+	  && CLASSTYPE_TEMPLATE_SPECIALIZATION (ctx))
 	inform (DECL_SOURCE_LOCATION (decl),
 		"members of an explicitly specialized class are defined "
 		"without a template header");
@@ -2451,11 +2453,9 @@ check_explicit_specialization (tree declarator,
   /* Fall through.  */
 case tsk_expl_spec:
   if (VAR_P (decl) && TREE_CODE (declarator) != TEMPLATE_ID_EXPR)
-{
-   // In cases like template<> constexpr bool v = true;
-   error ("%qD is not a template variable", dname);
-   break;
-}
+	/* In cases like template<> constexpr bool v = true;
+	   We'll give an error in check_template_variable.  */
+	break;
 
   SET_DECL_TEMPLATE_SPECIALIZATION (decl);
   if (ctype)
@@ -19711,8 +19711,6 @@ template_for_substitution (tree decl)
 	 cannot restructure the loop to just keep going until we find
 	 a template with a definition, since that might go too far if
 	 a specialization was declared, but not defined.  */
-  gcc_assert (!VAR_P (decl)
-		  || DECL_IN_AGGR_P (DECL_TEMPLATE_RESULT (tmpl)));
 
   /* Fetch the more general template.  */
   tmpl = DECL_TI_TEMPLATE (tmpl);
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ10.C b/gcc/testsuite/g++.dg/cpp1y/var-templ10.C
new file mode 100644
index 000..ece2eb2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ10.C
@@ -0,0 +1,16 @@
+// { dg-do compile { target c++14 } }
+
+template 
+struct Y
+{
+  template  static U x;
+};
+
+template 
+template 
+U Y::x = U();
+
+int main()
+{
+  int y = Y::x;
+}


Re: C++ PATCH to support non-constexpr variable templates

2014-08-25 Thread Jason Merrill

On 08/25/2014 03:15 PM, Ville Voutilainen wrote:

should we just add these test-for-valid cases as new
tests? Or should they become
bug reports instead? Please advise how to best handle these.


Bug reports, please.  Or perhaps multiple testcases on one bug report, 
for now.  :)


Jason



[4.9] PR 62146

2014-08-25 Thread Easwaran Raman
This patch deletes REG_EQUAL note when a src register is replaced by a
constant in an assignment. This is to prevent spurious equivalences
between the constant and the expression in the REG_EQUAL note. In the
bug reported in PR 62146, an assignment in one branch (which is
actually dead) of an IF statement has a REG_EQUAL note equating a
register with an expression. Conditional copy propagation replaces the
register with 0. The instruction is hoisted above the branch
subsequently and then the value 0 is equated with the expression in
the REG_EQUAL. Is this ok for 4.9 branch if all tests pass?

This patch looks applicable to trunk as well, but I don't have a test
case to reproduce the issue in trunk.


ChangeLog:

2014-08-25  Easwaran Raman  

PR rtl-optimization/62146
* cprop.c (try_replace_reg): Remove REG_EQUAL note when a constant is
propagated into the src of an assignment.

testsuite/ChangeLog

2014-08-25  Easwaran Raman  

PR rtl-optimization/62146
* testsuite/g++.dg/opt/pr62146.C: New.
Index: gcc/testsuite/g++.dg/opt/pr62146.C
===
--- gcc/testsuite/g++.dg/opt/pr62146.C	(revision 0)
+++ gcc/testsuite/g++.dg/opt/pr62146.C	(revision 0)
@@ -0,0 +1,51 @@
+/* PR rtl-optimization/62146 */
+/* { dg-do compile } */
+/* { dg-options "-O2 " } */
+class F
+{
+public:
+virtual ~ F ();
+};
+template < class CL > class G:public F
+{
+int *member_;
+public:
+G ( int *b): member_ (0)
+{
+}
+};
+
+class D
+{
+public:
+template < class CL > void RegisterNonTagCallback (int,
+void (CL::
+  *p3) ())
+{
+InternalRegisterNonTag (p3 ? new G < CL > ( 0) : 0);
+} void InternalRegisterNonTag (F *);
+};
+
+void fn1 ();
+class C1
+{
+void  foo();
+class TokenType
+{
+public:
+void AddToken ()
+{
+}
+};
+C1::TokenType bar_t;
+};
+D a;
+void C1::foo()
+{
+if (&bar_t)
+fn1 ();
+for (int i = 0; i < sizeof 0; ++i)
+a.RegisterNonTagCallback (0, &TokenType::AddToken);
+}
+
+/* { dg-final { scan-assembler-not "mov.*_ZN2C19TokenType8AddTokenEv, .\\\(" } } */
Index: gcc/cprop.c
===
--- gcc/cprop.c	(revision 214472)
+++ gcc/cprop.c	(working copy)
@@ -790,8 +790,11 @@ try_replace_reg (rtx from, rtx to, rtx insn)
   /* REG_EQUAL may get simplified into register.
  We don't allow that. Remove that note. This code ought
  not to happen, because previous code ought to synthesize
- reg-reg move, but be on the safe side.  */
-  if (note && REG_NOTE_KIND (note) == REG_EQUAL && REG_P (XEXP (note, 0)))
+ reg-reg move, but be on the safe side. The REG_EQUAL note is
+ also removed when the source is a constant.  */
+  if (note && REG_NOTE_KIND (note) == REG_EQUAL
+  && (REG_P (XEXP (note, 0))
+  || (set && CONSTANT_P (SET_SRC (set)
 remove_note (insn, note);
 
   return success;


PATCH: PR bootstrap/62260: Build inside source tree doesn't work with lto-plugin

2014-08-25 Thread H.J. Lu
Inside lto-plugin, when $host_subdir is '.', which means GCC is configured
inside source tree, gcc_build_dir is ../../$host_subdir/gcc, not
../$(host_subdir)/gcc. Tested with both in-tree and out-tree build on
Linux/x86-64.  OK for trunk?

Thanks.


H.J.
---
2014-08-25  H.J. Lu  

PR bootstrap/62260
* Makefile.am (gcc_build_dir): Set to @gcc_build_dir@.
* configure.ac (gcc_build_dir): Set according to $host_subdir.
* Makefile.in: Regenerated.
* configure: Likewise.

diff --git a/lto-plugin/Makefile.am b/lto-plugin/Makefile.am
index f3fb89b..93ea649 100644
--- a/lto-plugin/Makefile.am
+++ b/lto-plugin/Makefile.am
@@ -15,7 +15,7 @@ override CFLAGS := $(filter-out -fsanitize=address,$(CFLAGS))
 override LDFLAGS := $(filter-out -fsanitize=address,$(LDFLAGS))
 
 libexecsub_LTLIBRARIES = liblto_plugin.la
-gcc_build_dir = ../$(host_subdir)/gcc
+gcc_build_dir = @gcc_build_dir@
 in_gcc_libs = $(foreach lib, $(libexecsub_LTLIBRARIES), 
$(gcc_build_dir)/$(lib))
 
 liblto_plugin_la_SOURCES = lto-plugin.c
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index 6a5ae8a..c3ae93e 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -27,6 +27,13 @@ if test "x$have_static_libgcc" = xyes; then
 fi
 AC_SUBST(ac_lto_plugin_ldflags)
 
+if test x"$host_subdir" = x.; then
+   gcc_build_dir=../gcc
+else
+   gcc_build_dir=../../$host_subdir/gcc
+fi
+AC_SUBST(gcc_build_dir)
+
 AM_PROG_LIBTOOL
 ACX_LT_HOST_FLAGS
 AC_SUBST(target_noncanonical)


Re: [PATCH GCC]Fix broken Canadian when checking isl library support

2014-08-25 Thread Sebastian Pop
Sebastian Pop wrote:
> Richard Biener wrote:
> > I think it would be better to identify a set of features we rely on that
> > are not present in earlier versions and make the test a link
> > test unconditionally.
> > 
> > Tobias, are there include files / types / functions we require
> > that are not available in earlier versions?
> 
> The version 0.12 of ISL has an include file isl/val.h that is not present in
> previous versions of ISL.
> 
> There also was a patch from Mircea a few weeks ago that was missing the
> configure bits to check that the isl version contained isl/val.h.
> I will update both patches and submit for review.

I see that Mircea's patch has been committed:

commit c5ec3cc336c7d42d9ad2995395d430b99a9a34cc
Author: mircea 
Date:   Mon Aug 11 15:05:48 2014 +

Replacement of isl_int by isl_val

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

Attached a patch to check for isl/val.h instead of ISL's release number.

Bootstrapping on x86-64. Ok to commit?

Thanks,
Sebastian
>From 03ca0abce2a8f76aa7e935567d4ce6f1953ed1bf Mon Sep 17 00:00:00 2001
From: Sebastian Pop 
Date: Mon, 25 Aug 2014 20:55:09 +
Subject: [PATCH] check functionality of isl version 0.12

	* config/isl.m4 (_ISL_CHECK_CT_PROG): Removed.
	(ISL_CHECK_VERSION): Check for functionality added to ISL 0.12 instead
	of checking for version number.
	* configure: Regenerated.
* configure.ac (ISL_CHECK_VERSION): Do not use ISL version number.
---
 config/isl.m4 |   27 +---
 configure |   79 +++--
 configure.ac  |2 +-
 3 files changed, 11 insertions(+), 97 deletions(-)

diff --git a/config/isl.m4 b/config/isl.m4
index 57ae3c5..e940f10 100644
--- a/config/isl.m4
+++ b/config/isl.m4
@@ -93,20 +93,9 @@ AC_DEFUN([ISL_REQUESTED],
 ]
 )
 
-# _ISL_CHECK_CT_PROG(MAJOR, MINOR)
-# 
-# Helper for verifying ISL compile time version.
-m4_define([_ISL_CHECK_CT_PROG],[AC_LANG_PROGRAM(
-  [#include 
-   #include ],
-  [if (strncmp (isl_version (), "isl-$1.$2", strlen ("isl-$1.$2")) != 0)
- return 1;
-   ])])
-
-# ISL_CHECK_VERSION ISL_CHECK_VERSION (MAJOR, MINOR)
+# ISL_CHECK_VERSION ISL_CHECK_VERSION ()
 # 
-# Test the found ISL to be exact of version MAJOR.MINOR and at least
-# REVISION.
+# Test that ISL contains functionality added to the minimum expected version.
 AC_DEFUN([ISL_CHECK_VERSION],
 [
   if test "${ENABLE_ISL_CHECK}" = yes ; then
@@ -118,15 +107,11 @@ AC_DEFUN([ISL_CHECK_VERSION],
 LDFLAGS="${_isl_saved_LDFLAGS} ${isllibs}"
 LIBS="${_isl_saved_LIBS} -lisl"
 
-AC_MSG_CHECKING([for version $1.$2 of ISL])
-AC_RUN_IFELSE([_ISL_CHECK_CT_PROG($1,$2)],
+AC_MSG_CHECKING([for version 0.12 of ISL])
+# isl/val.h has first been added to ISL in 0.12.
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[;]])],
 	[gcc_cv_isl=yes],
-	[gcc_cv_isl=no],
-	[
-	  AC_LINK_IFELSE([_ISL_CHECK_CT_PROG($1,$2)],
-	  [gcc_cv_isl=yes],
-	  [gcc_cv_isl=no])
-	])
+	[gcc_cv_isl=no])
 AC_MSG_RESULT([$gcc_cv_isl])
 
 CFLAGS=$_isl_saved_CFLAGS
diff --git a/configure b/configure
index c292b09..5941821 100755
--- a/configure
+++ b/configure
@@ -1874,48 +1874,6 @@ fi
   return $ac_retval
 
 } # ac_fn_c_try_link
-
-# ac_fn_c_try_run LINENO
-# --
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
-ac_fn_c_try_run ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-   $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-   ac_retval=$ac_status
-fi
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  return $ac_retval
-
-} # ac_fn_c_try_run
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -5906,18 +5864,14 @@ $as_echo "$as_me: W

Re: [PATCH 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__

2014-08-25 Thread Mike Stump
On Aug 25, 2014, at 11:03 AM, James Clarke  wrote:
> Previously, this macro had taken the form 10X0, where X is the minor
> version number, e.g. 1090 for OS X 10.9 Mavericks. However, as of OS X
> 10.10 Yosemite, it should take the form 10XX00, i.e. 101000 for 10.10.

So, if they continue using the same scheme, I’d prefer to future proof this (I 
don’t like software time bombs) so that 10.11.0 works as well as 10.12.0 and so 
on.

We didn’t do this last time, as we were unsure how the numbers would work out.  
Now, it is much safer to see what the likely format will be.

Could you try that?

> -  if (major_vers > 4 + 9)
> +  if (major_vers > 4 + 10)

I think this is the only thing that has to change.

Re: [BUILDROBOT][PATCH] frv-linux fallout (was: [PATCH 009/236] Replace BB_HEAD et al macros with functions)

2014-08-25 Thread Mike Stump
On Aug 25, 2014, at 12:45 PM, Steven Bosscher  wrote:
> On Mon, Aug 25, 2014 at 9:29 PM, Mike Stump wrote:
>> On Aug 25, 2014, at 7:08 AM, David Malcolm wrote:
>>> It's too late now to switch to this approach, so in the meantime I've
>>> been working on ways to make my bootstraps as fast as possible.
>> 
>> -j64 works wonders.  :-)  Though, it is annoying watching the build run at 
>> 98% idle.
> 
> And genautomata just sits there... waiting... waiting... wai……

Sometimes I want it to run first, sometimes I want it to run last.  :-(  When 
the build will work, I want it first.  When it fails for any other reason, I 
want it last.  Can anyone else think of a way to order these guys (apart from a 
filsystem change hook that is wired into make and auto-rebuilds in the 
background)?  I haven’t yet found anything I like.

Re: [PATCH 2/2] Fixed dirent sanitizer for 32-bit OS X builds

2014-08-25 Thread Mike Stump
On Aug 25, 2014, at 11:03 AM, James Clarke  wrote:
> The __DARWIN_64_BIT_INO_T macro is used to indicate whether dirent.d_ino
> is 64-bit or not, and so should be sized appropriately. Additionally,
> dirent.d_seekoff should only be defined/checked when
> __DARWIN_64_BIT_INO_T is defined.
> 
> libsanitizer/ChangeLog:

I’m fine with this, I’d think that the sanitizer people want to review and push 
this into the tree.

Re: [BUILDROBOT][PATCH] frv-linux fallout (was: [PATCH 009/236] Replace BB_HEAD et al macros with functions)

2014-08-25 Thread Steven Bosscher
On Mon, Aug 25, 2014 at 9:29 PM, Mike Stump wrote:
> On Aug 25, 2014, at 7:08 AM, David Malcolm wrote:
>> It's too late now to switch to this approach, so in the meantime I've
>> been working on ways to make my bootstraps as fast as possible.
>
> -j64 works wonders.  :-)  Though, it is annoying watching the build run at 
> 98% idle.

And genautomata just sits there... waiting... waiting... wai..

Ciao!
Steven


Re: [BUILDROBOT][PATCH] frv-linux fallout (was: [PATCH 009/236] Replace BB_HEAD et al macros with functions)

2014-08-25 Thread Mike Stump
On Aug 25, 2014, at 7:08 AM, David Malcolm  wrote:
> 
> I'm testing and committing individual patches, but this
> could have gone into trunk in one go.

Yeah, it’s a hard choice between bit rot and incrementally going in.

> what I realize now is that I should have
> continued rebasing my patches in git until they were ready to go... but
> then committed them to a svn branch, with a ChangeLog.rtx-classes, and
> *immediately* merged that branch to trunk.

If you go all in at once, you forgot to list the build just after checkin.  :-) 
 Most work doesn’t require it, but for larger work, it is nice to build post 
checkin and resolve build errors, if any, when there are any changes from trunk 
post the last build.

> It's too late now to switch to this approach, so in the meantime I've
> been working on ways to make my bootstraps as fast as possible.

-j64 works wonders.  :-)  Though, it is annoying watching the build run at 98% 
idle.


[PATCH] Fix UB in expmed.c (PR middle-end/61903)

2014-08-25 Thread Marek Polacek
The following ought to fix two spots where an undefined behavior
can occur when compiling pr28045.c with instrumented compiler.
It does so by changing the type of V to an unsigned HOST_WIDE_INT
and performing the shift on unsigned HOST_WIDE_INT.
Hopefully it doesn't break anything...

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2014-08-25  Marek Polacek  

PR middle-end/61903
* expmed.c (store_fixed_bit_field_1): Shift UHWI 1 instead of HWI 1.
Change the type of V to unsigned HOST_WIDE_INT.

diff --git gcc/expmed.c gcc/expmed.c
index 7b71616a2..e8d5c23 100644
--- gcc/expmed.c
+++ gcc/expmed.c
@@ -1051,16 +1051,17 @@ store_fixed_bit_field_1 (rtx op0, unsigned 
HOST_WIDE_INT bitsize,
 
   if (CONST_INT_P (value))
 {
-  HOST_WIDE_INT v = INTVAL (value);
+  unsigned HOST_WIDE_INT v = UINTVAL (value);
 
   if (bitsize < HOST_BITS_PER_WIDE_INT)
-   v &= ((HOST_WIDE_INT) 1 << bitsize) - 1;
+   v &= ((unsigned HOST_WIDE_INT) 1 << bitsize) - 1;
 
   if (v == 0)
all_zero = 1;
   else if ((bitsize < HOST_BITS_PER_WIDE_INT
-   && v == ((HOST_WIDE_INT) 1 << bitsize) - 1)
-  || (bitsize == HOST_BITS_PER_WIDE_INT && v == -1))
+   && v == ((unsigned HOST_WIDE_INT) 1 << bitsize) - 1)
+  || (bitsize == HOST_BITS_PER_WIDE_INT
+  && v == (unsigned HOST_WIDE_INT) -1))
all_one = 1;
 
   value = lshift_value (mode, v, bitnum);

Marek


Re: [PATCH GCC]Fix broken Canadian when checking isl library support

2014-08-25 Thread Sebastian Pop
Richard Biener wrote:
> I think it would be better to identify a set of features we rely on that
> are not present in earlier versions and make the test a link
> test unconditionally.
> 
> Tobias, are there include files / types / functions we require
> that are not available in earlier versions?

The version 0.12 of ISL has an include file isl/val.h that is not present in
previous versions of ISL.

There also was a patch from Mircea a few weeks ago that was missing the
configure bits to check that the isl version contained isl/val.h.
I will update both patches and submit for review.

Sebastian


Re: C++ PATCH to support non-constexpr variable templates

2014-08-25 Thread Ville Voutilainen
On 25 August 2014 17:08,   wrote:
>> Anyway, here's a fix for your recent test.
>
> Thanks, I'll take a look at the tests and will send a patch if something 
> seems missing; static member variable templates of a class template and 
> explicit specializations thereof are the likely starting point.

Another ICE (should we just add these test-for-valid cases as new
tests? Or should they become
bug reports instead? Please advise how to best handle these.):

template 
struct Y
{
  template  static U x;
};

template 
template 
U Y::x = U();

int main()
{
  int y = Y::x;
}

variable-template.cpp:9:3: warning: too many template headers for
Y::x (should be 1)
 U Y::x = U();
   ^
variable-template.cpp: In instantiation of ‘int Y::x’:
variable-template.cpp:13:19:   required from here
variable-template.cpp:13:19: internal compiler error: in
template_for_substitution, at cp/pt.c:19714
   int y = Y::x;
   ^
0x5c4bf9 template_for_substitution(tree_node*)
../../gcc/cp/pt.c:19714
0x5d0874 instantiate_decl(tree_node*, int, bool)
../../gcc/cp/pt.c:19891
0x6521c2 mark_used(tree_node*, int)
../../gcc/cp/decl2.c:5035
0x707f5b finish_id_expression(tree_node*, tree_node*, tree_node*,
cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**,
unsigned int)
../../gcc/cp/semantics.c:3515
0x67f13b cp_parser_primary_expression
../../gcc/cp/parser.c:4654
0x6804e7 cp_parser_postfix_expression
../../gcc/cp/parser.c:6008
0x6832b9 cp_parser_unary_expression
../../gcc/cp/parser.c:7285
0x683ef4 cp_parser_binary_expression
../../gcc/cp/parser.c:8028
0x68449b cp_parser_assignment_expression
../../gcc/cp/parser.c:8270
0x684935 cp_parser_assignment_expression
../../gcc/cp/parser.c:8320
0x684935 cp_parser_constant_expression
../../gcc/cp/parser.c:8524
0x69557e cp_parser_init_declarator
../../gcc/cp/parser.c:16996
0x696b65 cp_parser_simple_declaration
../../gcc/cp/parser.c:11406
0x67a6a3 cp_parser_block_declaration
../../gcc/cp/parser.c:11287
0x67b821 cp_parser_declaration_statement
../../gcc/cp/parser.c:10934
0x67bf0b cp_parser_statement
../../gcc/cp/parser.c:9649
0x67cd39 cp_parser_statement_seq_opt
../../gcc/cp/parser.c:9927
0x67cea6 cp_parser_compound_statement
../../gcc/cp/parser.c:9881
0x68e11b cp_parser_function_body
../../gcc/cp/parser.c:18952
0x68e11b cp_parser_ctor_initializer_opt_and_function_body
../../gcc/cp/parser.c:18988
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.


Re: [PATCH 2/2] Fixed dirent sanitizer for 32-bit OS X builds

2014-08-25 Thread James Clarke
Please note that this fixes PR 61407 (forgot to add it to 
libsanitizer/ChangeLog).

James Clarke

> On 25 Aug 2014, at 19:03, James Clarke  wrote:
> 
> The __DARWIN_64_BIT_INO_T macro is used to indicate whether dirent.d_ino
> is 64-bit or not, and so should be sized appropriately. Additionally,
> dirent.d_seekoff should only be defined/checked when
> __DARWIN_64_BIT_INO_T is defined.
> 
> libsanitizer/ChangeLog:
> 
>* sanitizer_common/sanitizer_platform_limits_posix.cc: Only check
>dirent.d_seekoff on OS X when performing a 64-bit build.
>* sanitizer_common/sanitizer_platform_limits_posix.h: Only define
>dirent.d_seekoff on OS X when performing a 64-bit build, and make
>dirent.d_ino the correct size (32-bit) when performing a 32-bit
>build.
> ---
> libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | 3 ++-
> libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h  | 9 +
> 2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 
> b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
> index a93d38d..0d1870b 100644
> --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
> +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
> @@ -940,7 +940,8 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
> 
> COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent));
> CHECK_SIZE_AND_OFFSET(dirent, d_ino);
> -#if SANITIZER_MAC
> +#if SANITIZER_MAC && __DARWIN_64_BIT_INO_T
> +// The 'd_seekoff' field is only present on OS X for 64-bit builds
> CHECK_SIZE_AND_OFFSET(dirent, d_seekoff);
> #elif SANITIZER_FREEBSD
> // There is no 'd_off' field on FreeBSD.
> diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 
> b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
> index dece2d3..73a4c3f 100644
> --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
> +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
> @@ -392,12 +392,21 @@ namespace __sanitizer {
> #endif
> 
> #if SANITIZER_MAC
> +# if __DARWIN_64_BIT_INO_T
>   struct __sanitizer_dirent {
> unsigned long long d_ino;
> unsigned long long d_seekoff;
> unsigned short d_reclen;
> // more fields that we don't care about
>   };
> +# else
> +  struct __sanitizer_dirent {
> +unsigned int d_ino;
> +// No d_seekoff for 32-bit
> +unsigned short d_reclen;
> +// more fields that we don't care about
> +  };
> +# endif
> #elif SANITIZER_FREEBSD
>   struct __sanitizer_dirent {
> unsigned int d_fileno;
> -- 
> 2.1.0
> 


[PATCH 2/2] Fixed dirent sanitizer for 32-bit OS X builds

2014-08-25 Thread James Clarke
The __DARWIN_64_BIT_INO_T macro is used to indicate whether dirent.d_ino
is 64-bit or not, and so should be sized appropriately. Additionally,
dirent.d_seekoff should only be defined/checked when
__DARWIN_64_BIT_INO_T is defined.

libsanitizer/ChangeLog:

* sanitizer_common/sanitizer_platform_limits_posix.cc: Only check
dirent.d_seekoff on OS X when performing a 64-bit build.
* sanitizer_common/sanitizer_platform_limits_posix.h: Only define
dirent.d_seekoff on OS X when performing a 64-bit build, and make
dirent.d_ino the correct size (32-bit) when performing a 32-bit
build.
---
 libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | 3 ++-
 libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h  | 9 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 
b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index a93d38d..0d1870b 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -940,7 +940,8 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
 
 COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent));
 CHECK_SIZE_AND_OFFSET(dirent, d_ino);
-#if SANITIZER_MAC
+#if SANITIZER_MAC && __DARWIN_64_BIT_INO_T
+// The 'd_seekoff' field is only present on OS X for 64-bit builds
 CHECK_SIZE_AND_OFFSET(dirent, d_seekoff);
 #elif SANITIZER_FREEBSD
 // There is no 'd_off' field on FreeBSD.
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 
b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index dece2d3..73a4c3f 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -392,12 +392,21 @@ namespace __sanitizer {
 #endif
 
 #if SANITIZER_MAC
+# if __DARWIN_64_BIT_INO_T
   struct __sanitizer_dirent {
 unsigned long long d_ino;
 unsigned long long d_seekoff;
 unsigned short d_reclen;
 // more fields that we don't care about
   };
+# else
+  struct __sanitizer_dirent {
+unsigned int d_ino;
+// No d_seekoff for 32-bit
+unsigned short d_reclen;
+// more fields that we don't care about
+  };
+# endif
 #elif SANITIZER_FREEBSD
   struct __sanitizer_dirent {
 unsigned int d_fileno;
-- 
2.1.0



[PATCH 1/2] Fix __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__

2014-08-25 Thread James Clarke
Previously, this macro had taken the form 10X0, where X is the minor
version number, e.g. 1090 for OS X 10.9 Mavericks. However, as of OS X
10.10 Yosemite, it should take the form 10XX00, i.e. 101000 for 10.10.

Added a test for the new format and fixed the formatting for the
existing ones.

gcc/ChangeLog:

* config/darwin-c.c (version_as_macro): Added extra 0 for OS X
10.10 and above
* config/darwin-driver.c (darwin_find_version_from_kernel): Bump
supported kernel version

gcc/testsuite/ChangeLog:

* gcc.db/darwin-minversion-1.c: Fixed formatting
* gcc.db/darwin-minversion-2.c: Fixed formatting
* gcc.db/darwin-minversion-3.c: Fixed formatting
* gcc.dg/darwin-minversion-4.c: Added test for OS X 10.10
---
 gcc/config/darwin-c.c  | 25 +++--
 gcc/config/darwin-driver.c |  2 +-
 gcc/testsuite/gcc.dg/darwin-minversion-1.c |  3 ++-
 gcc/testsuite/gcc.dg/darwin-minversion-2.c |  3 ++-
 gcc/testsuite/gcc.dg/darwin-minversion-3.c |  3 ++-
 gcc/testsuite/gcc.dg/darwin-minversion-4.c | 12 
 6 files changed, 38 insertions(+), 10 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/darwin-minversion-4.c

diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 892ba35..7fe4b1f 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -571,21 +571,34 @@ find_subframework_header (cpp_reader *pfile, const char 
*header, cpp_dir **dirp)
 }
 
 /* Return the value of darwin_macosx_version_min suitable for the
-   __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
-   so '10.4.2' becomes 1040.  The lowest digit is always zero.
+   __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, so '10.4.2'
+   becomes 1040 and '10.10.0' becomes 101000.  The lowest digit is
+   always zero, as is the second lowest for '10.10.x' and above.
Print a warning if the version number can't be understood.  */
 static const char *
 version_as_macro (void)
 {
-  static char result[] = "1000";
+  static char result[7] = "1000";
+  int minorDigitIdx;
 
   if (strncmp (darwin_macosx_version_min, "10.", 3) != 0)
 goto fail;
   if (! ISDIGIT (darwin_macosx_version_min[3]))
 goto fail;
-  result[2] = darwin_macosx_version_min[3];
-  if (darwin_macosx_version_min[4] != '\0'
-  && darwin_macosx_version_min[4] != '.')
+
+  minorDigitIdx = 3;
+  result[2] = darwin_macosx_version_min[minorDigitIdx++];
+  if (ISDIGIT (darwin_macosx_version_min[minorDigitIdx]))
+  {
+/* Starting with OS X 10.10, the macro ends '00' rather than '0',
+   i.e. 10.10.x becomes 101000 rather than 10100.  */
+result[3] = darwin_macosx_version_min[minorDigitIdx++];
+result[4] = '0';
+result[5] = '0';
+result[6] = '\0';
+  }
+  if (darwin_macosx_version_min[minorDigitIdx] != '\0'
+  && darwin_macosx_version_min[minorDigitIdx] != '.')
 goto fail;
 
   return result;
diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
index 8b6ae93..a115616 100644
--- a/gcc/config/darwin-driver.c
+++ b/gcc/config/darwin-driver.c
@@ -57,7 +57,7 @@ darwin_find_version_from_kernel (char *new_flag)
   version_p = osversion + 1;
   if (ISDIGIT (*version_p))
 major_vers = major_vers * 10 + (*version_p++ - '0');
-  if (major_vers > 4 + 9)
+  if (major_vers > 4 + 10)
 goto parse_failed;
   if (*version_p++ != '.')
 goto parse_failed;
diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-1.c 
b/gcc/testsuite/gcc.dg/darwin-minversion-1.c
index d8a3243..6221d61 100644
--- a/gcc/testsuite/gcc.dg/darwin-minversion-1.c
+++ b/gcc/testsuite/gcc.dg/darwin-minversion-1.c
@@ -2,7 +2,8 @@
 /* { dg-options "-mmacosx-version-min=10.1" } */
 /* { dg-do run { target *-*-darwin* } } */
 
-int main(void)
+int
+main ()
 {
 #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010
   fail me;
diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-2.c 
b/gcc/testsuite/gcc.dg/darwin-minversion-2.c
index fd4975a..8e18d52 100644
--- a/gcc/testsuite/gcc.dg/darwin-minversion-2.c
+++ b/gcc/testsuite/gcc.dg/darwin-minversion-2.c
@@ -2,7 +2,8 @@
 /* { dg-options "-mmacosx-version-min=10.1 -mmacosx-version-min=10.3" } */
 /* { dg-do run { target *-*-darwin* } } */
 
-int main(void)
+int
+main ()
 {
 #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1030
   fail me;
diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-3.c 
b/gcc/testsuite/gcc.dg/darwin-minversion-3.c
index d0c5934..4fcb969 100644
--- a/gcc/testsuite/gcc.dg/darwin-minversion-3.c
+++ b/gcc/testsuite/gcc.dg/darwin-minversion-3.c
@@ -2,7 +2,8 @@
 /* { dg-options "-mmacosx-version-min=10.4.10" } */
 /* { dg-do compile { target *-*-darwin* } } */
 
-int main(void)
+int
+main ()
 {
 #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1040
   fail me;
diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-4.c 
b/gcc/testsuite/gcc.dg/darwin-minversion-4.c
new file mode 100644
index 000..1cb42eb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/darwin-minversion-4.c
@@ -0,0 +1,12 @@
+/* Test that major v

Re: [Patch] Switch elimination pass for PR 54742

2014-08-25 Thread Jeff Law

On 08/21/14 04:30, Richard Biener wrote:

It turns Jeff's jump-threading code in to a strange franken-pass of bits and
pieces of detection and optimisation, and would need some substantial
reworking to fit in with Jeff's changes last Autumn, but if it is more
likely to be acceptable for trunk then perhaps we could look to revive it.
It would be nice to reuse the path copy code Jeff added last year, but I
don't have much intuition as to how feasible that is.

Was this the sort of thing that you were imagining?


Yeah, didn't look too closely though.
It'd be pretty ugly I suspect.  But it's probably worth pondering since 
that approach would eliminate the concerns about the cost of detection 
(which is problematical for the jump threader) by using Steve's code for 
that.


On the update side, I suspect most, if not all of the framework is in 
place to handle this kind of update if the right threading paths were 
passed to the updater.  I can probably cobble together that by-hand and 
see what the tree-ssa-threadupdate does with it.  But it'll be a week or 
so before I could look at it.


jeff



Re: Enable EBX for x86 in 32bits PIC code

2014-08-25 Thread Jeff Law

On 08/22/14 06:21, Ilya Enkovich wrote:


Such approach worked well on small tests but trying to run some
benchmarks we faced a problem with reload of address constants.  The
problem is that when we try to rematerialize address constant or some
constant memory reference, we have to use pic_offset_table_rtx.  It
means we insert new usages of a speudo register and alocator cannot
handle it correctly.  Same problem also applies for float and vector
constants.
Isn't this typically handled with secondary reloads?   It's not an exact 
match, but if you look at the PA port, you can see cases where we need 
to have %r1 available when we rematerialize certain constants.  Several 
ports have secondary reloads that you may be able to refer back to.  LRA 
may handle things differently, so first check LRA's paths.






Rematerialization is not the only case causing new
pic_offset_table_rtx usage.  Another case is a split of some
instructions using constant but not having proper constraints.  E.g.
pushtf pattern allows push of constant but it has to be replaced with
push of memory in reload pass causing additional usage of
pic_offset_table_rtx.

Yup.  I think those would be handled the same way.


Jeff


Re: [PATCH 204/236] final.c: Use rtx_sequence

2014-08-25 Thread Jeff Law

On 08/15/14 18:56, David Malcolm wrote:

On Fri, 2014-08-15 at 18:38 -0400, Trevor Saunders wrote:

i.e. back to just a GET_CODE check again (albeit with a new local, of
the subclass ptr type; I don't know how well our optimizations handle
that yet: the idea that a local ptr X is either equal to another local
ptr Y or is NULL.  Does our value-numbering cope with this, where one
ptr is a subclass of another?).
I'm not sure what you're asking.  If you can give me the gimple I can 
probably answer ;-)


In general the gimple optimizers don't care/know about class 
relationships.   So if the pointers point to the same object, but have 
different types, it's likely we won't optimize away things as well as 
we'd like.

jeff


Re: [PATCH 204/236] final.c: Use rtx_sequence

2014-08-25 Thread Jeff Law

On 08/15/14 16:38, Trevor Saunders wrote:

On Fri, Aug 15, 2014 at 04:24:49PM -0600, Jeff Law wrote:

On 08/06/14 11:23, David Malcolm wrote:

gcc/
* final.c (get_attr_length_1): Replace GET_CODE check with a
dyn_cast, introducing local "seq" and the use of methods of
rtx_sequence.
(shorten_branches): Likewise, introducing local "body_seq".
Strengthen local "inner_insn" from rtx to rtx_insn *.
(reemit_insn_block_notes): Replace GET_CODE check with a
dyn_cast, strengthening local "body" from rtx to rtx_sequence *.
Use methods of rtx_sequence.
(final_scan_insn): Likewise, introducing local "seq" for when
"body" is known to be a SEQUENCE, using its methods.

So presumably a dyn_cast isn't terribly expensive here?  I guess I'm a bit
fuzzy on whether or not we agreed to allow using dynamic casts?!? Doesn't
that have to check the RTTI info which I would think would be considerably
more expensive than just checking the code.  Or am I missing something here?


  your missing dyn_cast != dynamic_cast, the first is just a wrapper
  around as_a / is_a, and so doesn't use rtti.

Ah.  Nevermind my concerns then :-)

jeff



[PATCH libcpp] Use CPP() for Wendif-labels and other flags

2014-08-25 Thread Manuel López-Ibáñez
This patch is on top of https://gcc.gnu.org/ml/gcc-patches/2014-08/msg02244.html

The main issue here is Wendif-labels, since we were not using the
correct CPP_W_* flag. The rest are straight-forward.

libcpp/ChangeLog:

2014-08-25  Manuel López-Ibáñez  

* directives.c (check_eol_1): New.
(check_eol_endif_labels): New.
(check_eol): Call check_eol_1.
(do_else,do_endif): Call check_eol_endif_labels.

gcc/c-family/ChangeLog:

2014-08-25  Manuel López-Ibáñez  

* c.opt (Wbuiltin-macro-redefined,Wdeprecated,Wendif-labels,
Winvalid-pch,Wliteral-suffix,Wmissing-include-dirs,Wtrigraphs,
Wundef): Use CPP, Var and Init.
* c-opts.c (c_common_handle_option): Do not handle the above flags here.
diff -u gcc/c-family/c.opt gcc/c-family/c.opt
--- gcc/c-family/c.opt  (working copy)
+++ gcc/c-family/c.opt  (working copy)
@@ -292,7 +292,7 @@
 Warn about boolean expression compared with an integer value different from 
true/false
 
 Wbuiltin-macro-redefined
-C ObjC C++ ObjC++ CPP(warn_builtin_macro_redefined) 
Var(cpp_warn_builtin_macro_redefined) Warning
+C ObjC C++ ObjC++ CPP(warn_builtin_macro_redefined) 
Var(cpp_warn_builtin_macro_redefined) Init(1) Warning
 Warn when a built-in preprocessor macro is undefined or redefined
 
 Wc90-c99-compat
@@ -368,7 +368,7 @@
 ;
 
 Wdeprecated
-C C++ ObjC ObjC++ Var(warn_deprecated) Init(1) Warning
+C C++ ObjC ObjC++ CPP(cpp_warn_deprecated) Var(warn_deprecated) Init(1) Warning
 Warn if a deprecated compiler feature, class, method, or field is used
 
 Wdesignated-init
@@ -392,7 +392,7 @@
 Warn about an empty body in an if or else statement
 
 Wendif-labels
-C ObjC C++ ObjC++ Warning
+C ObjC C++ ObjC++ CPP(warn_endif_labels) Var(cpp_warn_endif_labels) Init(1) 
Warning
 Warn about stray tokens after #elif and #endif
 
 Wenum-compare
@@ -503,7 +503,7 @@
 Warn about invalid uses of the \"offsetof\" macro
 
 Winvalid-pch
-C ObjC C++ ObjC++ Warning
+C ObjC C++ ObjC++ CPP(warn_invalid_pch) Var(cpp_warn_invalid_pch) Warning
 Warn about PCH files that are found but not used
 
 Wjump-misses-init
@@ -511,7 +511,7 @@
 Warn when a jump misses a variable initialization
 
 Wliteral-suffix
-C++ ObjC++ Warning
+C++ ObjC++ CPP(warn_literal_suffix) Var(cpp_warn_literal_suffix) Init(1) 
Warning
 Warn when a string or character literal is followed by a ud-suffix which does 
not begin with an underscore.
 
 Wlogical-op
@@ -583,7 +583,7 @@
 ;
 
 Wmissing-include-dirs
-C ObjC C++ ObjC++ Warning
+C ObjC C++ ObjC++ CPP(warn_missing_include_dirs) 
Var(cpp_warn_missing_include_dirs) Warning
 Warn about user-specified include directories that do not exist
 
 Wmissing-parameter-type
@@ -794,7 +794,7 @@
 Warn of prototypes causing type conversions different from what would happen 
in the absence of prototype
 
 Wtrigraphs
-C ObjC C++ ObjC++ Warning
+C ObjC C++ ObjC++ CPP(warn_trigraphs) Var(cpp_warn_trigraphs) Init(2) Warning
 Warn if trigraphs are encountered that might affect the meaning of the program
 
 Wundeclared-selector
@@ -802,7 +802,7 @@
 Warn about @selector()s without previously declared methods
 
 Wundef
-C ObjC C++ ObjC++ Warning
+C ObjC C++ ObjC++ CPP(warn_undef) Var(cpp_warn_undef) Warning
 Warn if an undefined macro is used in an #if directive
 
 Wuninitialized
diff -u gcc/c-family/c-opts.c gcc/c-family/c-opts.c
--- gcc/c-family/c-opts.c   (working copy)
+++ gcc/c-family/c-opts.c   (working copy)
@@ -389,29 +389,10 @@
   cpp_opts->warn_cxx_operator_names = value;
   break;
 
-case OPT_Wdeprecated:
-  cpp_opts->cpp_warn_deprecated = value;
-  break;
-
-case OPT_Wendif_labels:
-  cpp_opts->warn_endif_labels = value;
-  break;
-
-case OPT_Winvalid_pch:
-  cpp_opts->warn_invalid_pch = value;
-  break;
-
-case OPT_Wliteral_suffix:
-  cpp_opts->warn_literal_suffix = value;
-  break;
-
 case OPT_Wlong_long:
   cpp_opts->cpp_warn_long_long = value;
   break;
 
-case OPT_Wmissing_include_dirs:
-  cpp_opts->warn_missing_include_dirs = value;
-  break;
 case OPT_Wnormalized_:
   /* FIXME: Move all this to c.opt.  */
   if (kind == DK_ERROR)
@@ -439,14 +420,6 @@
   cpp_opts->cpp_warn_traditional = value;
   break;
 
-case OPT_Wtrigraphs:
-  cpp_opts->warn_trigraphs = value;
-  break;
-
-case OPT_Wundef:
-  cpp_opts->warn_undef = value;
-  break;
-
 case OPT_Wunknown_pragmas:
   /* Set to greater than 1, so that even unknown pragmas in
 system headers will be warned about.  */
diff -u libcpp/directives.c libcpp/directives.c
--- libcpp/directives.c (working copy)
+++ libcpp/directives.c (working copy)
@@ -213,16 +213,33 @@
   ;
 }
 
-/* Ensure there are no stray tokens at the end of a directive.  If
-   EXPAND is true, tokens macro-expanding to nothing are allowed.  */
+/* Helper function for check_oel.  */
+
 static void
-check_eol (cpp_reader *pfile, bool expand)
+check_eol_1 (cpp_reader *pfile, bool expand, int reason)
 {
   if (

Re: [BUILDROBOT][PATCH] ppc{,64}-linux broken (IPA C++ refactoring 4/N)

2014-08-25 Thread Jan-Benedict Glaw
On Mon, 2014-08-25 18:09:09 +0200, Martin Liška  wrote:
> On 08/25/2014 05:29 PM, Jan-Benedict Glaw wrote:
> > Your recent change left one cgraph_state in place in the rs6000
> > backend, resulting in (see
> > http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=346638
> > and
> > http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=346630):
> >
> >g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions 
> >-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual 
> >-Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long 
> >-Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H 
> >-I. -I. -I/home/jbglaw/repos/gcc/gcc -I/home/jbglaw/repos/gcc/gcc/. 
> >-I/home/jbglaw/repos/gcc/gcc/../include 
> >-I/home/jbglaw/repos/gcc/gcc/../libcpp/include  
> >-I/home/jbglaw/repos/gcc/gcc/../libdecnumber 
> >-I/home/jbglaw/repos/gcc/gcc/../libdecnumber/dpd -I../libdecnumber 
> >-I/home/jbglaw/repos/gcc/gcc/../libbacktrace-o rs6000.o -MT rs6000.o 
> >-MMD -MP -MF ./.deps/rs6000.TPo 
> >/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c
> >/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c: In function ‘bool 
> >call_ABI_of_interest(tree_node*)’:
> >/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:9057: error: 
> >‘cgraph_state’ was not declared in this scope
> >/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:9057: error: 
> >‘CGRAPH_STATE_EXPANSION’ was not declared in this scope
[...]
> > make[1]: *** [rs6000.o] Error 1
> 
> Hello Jan-Benedict,
>thank you for the fallout fix. Even though I tested all
> back-ends, I am unable to build a cross-compiler:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61974.

Builds for me eg. here:
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=346652

MfG, JBG

-- 
  Jan-Benedict Glaw  jbg...@lug-owl.de  +49-172-7608481
Signature of: Alles wird gut! ...und heute wirds schon ein bißchen 
besser.
the second  :


signature.asc
Description: Digital signature


Re: Invalid gimple for nested functions

2014-08-25 Thread Bernd Schmidt

On 08/05/2014 10:54 AM, Richard Biener wrote:

The better interface for this is gimple_assign_set_rhs_from_tree.  But it
seems the code can be re-structured to avoid re-setting the RHS by
simply doing

if (!is_gimple_reg (x)
   && is_gimple_reg_type (TREE_TYPE (x))
 x = init_tmp_var (root, x, &gsi);

right after x is assigned to?

Ok with that change.


That also works, I've committed the following.


Bernd

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f22f09f..c5ef281 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2014-08-25  Bernd Schmidt  
+
+	* tree-nested.c (finalize_nesting_tree_1): Initialize temporary earlier
+	rather than modifying the stmt.
+
 2014-08-25  Jan-Benedict Glaw  
 
 	* config/rs6000/rs6000.c (rs6000_return_in_msb): Fix fallout from
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 82cec96..6ca594d 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -2715,10 +2715,6 @@ finalize_nesting_tree_1 (struct nesting_info *root)
 	  else
 	x = p;
 
-	  y = build3 (COMPONENT_REF, TREE_TYPE (field),
-		  root->frame_decl, field, NULL_TREE);
-	  stmt = gimple_build_assign (y, x);
-	  gimple_seq_add_stmt (&stmt_list, stmt);
 	  /* If the assignment is from a non-register the stmt is
 	 not valid gimple.  Make it so by using a temporary instead.  */
 	  if (!is_gimple_reg (x)
@@ -2726,8 +2722,12 @@ finalize_nesting_tree_1 (struct nesting_info *root)
 	{
 	  gimple_stmt_iterator gsi = gsi_last (stmt_list);
 	  x = init_tmp_var (root, x, &gsi);
-	  gimple_assign_set_rhs1 (stmt, x);
 	}
+
+	  y = build3 (COMPONENT_REF, TREE_TYPE (field),
+		  root->frame_decl, field, NULL_TREE);
+	  stmt = gimple_build_assign (y, x);
+	  gimple_seq_add_stmt (&stmt_list, stmt);
 	}
 }
 


Re: Migrating gcc.c-torture

2014-08-25 Thread Bernd Schmidt

On 08/22/2014 10:39 PM, Mike Stump wrote:

Before you check it in, consider:

930529-1.x has some alpha bits but I didn’t notice a discussion nor
do I have state on the bug to know if the resolution is correct.


Those are commented out, and I assume superseded by the use of -fwrapv.

Thanks!


Bernd


Re: [PATCH 2/5] Existing call graph infrastructure enhancement

2014-08-25 Thread Jan Hubicka
> Hello,
>after fixing an issue with callgraph thunk creation, I would like to 
> enhance callgraph API a bit. My problem was that I was trying to expand_thunk 
> after a body of the original function was removed. As a result, I created a 
> call without arguments. The change was suggested by Honza.
> 
> Thank you,
> Martin
> 
> On 07/17/2014 03:49 PM, Martin Liška wrote:
> >
> >On 06/30/2014 08:54 PM, Jeff Law wrote:
> >>On 06/30/14 05:49, Martin Liška wrote:
> >>>
> >>>On 06/17/2014 10:00 PM, Jeff Law wrote:
> On 06/13/14 04:26, mliska wrote:
> >Hi,
> > this small patch prepares remaining needed infrastructure for
> >the new pass.
> >
> >Changelog:
> >
> >2014-06-13  Martin Liska  
> >Honza Hubicka  
> >
> >* ipa-utils.h (polymorphic_type_binfo_p): Function marked external
> >instead of static.
> >* ipa-devirt.c (polymorphic_type_binfo_p): Likewise.
> >* ipa-prop.h (count_formal_params): Likewise.
> >* ipa-prop.c (count_formal_params): Likewise.
> >* ipa-utils.c (ipa_merge_profiles): Be more tolerant if we merge
> >profiles for semantically equivalent functions.
> >* passes.c (do_per_function): If we load body of a function
> >during WPA,
> >this condition should behave same.
> >* varpool.c (ctor_for_folding): More tolerant assert for variable
> >aliases created during WPA.
> Presumably we don't have any useful way to merge the cases where we
> have provides for SRC & DST in ipa_merge_profiles or even to guess
> which is more useful when presented with both?  Does it make sense to
> log this into a debugging file when we drop one?
> >>>Hello,
> >>>this merge function was written by Honza, what do you think Honza
> >>>about this note?
> >>>
> I think this patch is fine.  If adding logging makes sense, then feel
> free to do so and consider that trivial change pre-approved.
> >>>I made a small change to this patch, where I moved
> >>>'gsi_next_nonvirtual_phi' from the pass to gimple-iterator.h.
> >>>
> >>>Ready for trunk with this change?
> >>Yes.  I think with the exception of patch #3/5 everything looks good. I'll 
> >>try to get another pass over #3 this week.  What I looked at last week was 
> >>pretty good; I'm pretty confident this will be wrapped up shortly.
> >>
> >>If #1/#2 make sense to install independent of #3, go ahead. #4/#5 are 
> >>obviously dependent on #3.
> >>
> >>Jeff
> >
> >Hello,
> >   thank you for approval, this final version removes few hunks that are not 
> > needed any more. Changes are just cosmetic and I will commit the patch at 
> > the beginning of next week.
> >
> >Thanks,
> >Martin
> >
> 

> 2014-08-25  Martin Liska  
> 
>   * cgraph.h (release_body):  new argument keep_arguments added.
>   * cgraph.c (release_body): Likewise.

OK,
thanks!
Honza

> diff --git a/gcc/cgraph.c b/gcc/cgraph.c
> index cb49cdc..ad32fb8 100644
> --- a/gcc/cgraph.c
> +++ b/gcc/cgraph.c
> @@ -1716,13 +1716,15 @@ release_function_body (tree decl)
> are free'd in final.c via free_after_compilation().  */
>  
>  void
> -cgraph_node::release_body (void)
> +cgraph_node::release_body (bool keep_arguments)
>  {
>ipa_transforms_to_apply.release ();
>if (!used_as_abstract_origin && cgraph_state != CGRAPH_STATE_PARSING)
>  {
>DECL_RESULT (decl) = NULL;
> -  DECL_ARGUMENTS (decl) = NULL;
> +
> +  if (!keep_arguments)
> +   DECL_ARGUMENTS (decl) = NULL;
>  }
>/* If the node is abstract and needed, then do not clear DECL_INITIAL
>   of its associated function function declaration because it's
> diff --git a/gcc/cgraph.h b/gcc/cgraph.h
> index 2594ae5..5edcf74 100644
> --- a/gcc/cgraph.h
> +++ b/gcc/cgraph.h
> @@ -890,7 +890,7 @@ public:
>   Use this only for functions that are released before being translated to
>   target code (i.e. RTL).  Functions that are compiled to RTL and beyond
>   are free'd in final.c via free_after_compilation().  */
> -  void release_body (void);
> +  void release_body (bool keep_arguments = false);
>  
>/* cgraph_node is no longer nested function; update cgraph accordingly.  */
>void unnest (void);



Re: [BUILDROBOT][PATCH] ppc{,64}-linux broken (IPA C++ refactoring 4/N)

2014-08-25 Thread Martin Liška


On 08/25/2014 05:29 PM, Jan-Benedict Glaw wrote:

Hi!

Your recent change left one cgraph_state in place in the rs6000
backend, resulting in (see
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=346638
and
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=346630):

g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions 
-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual 
-Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long 
-Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. 
-I. -I/home/jbglaw/repos/gcc/gcc -I/home/jbglaw/repos/gcc/gcc/. 
-I/home/jbglaw/repos/gcc/gcc/../include 
-I/home/jbglaw/repos/gcc/gcc/../libcpp/include  
-I/home/jbglaw/repos/gcc/gcc/../libdecnumber 
-I/home/jbglaw/repos/gcc/gcc/../libdecnumber/dpd -I../libdecnumber 
-I/home/jbglaw/repos/gcc/gcc/../libbacktrace-o rs6000.o -MT rs6000.o -MMD 
-MP -MF ./.deps/rs6000.TPo /home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c: In function ‘bool 
call_ABI_of_interest(tree_node*)’:
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:9057: error: ‘cgraph_state’ 
was not declared in this scope
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:9057: error: 
‘CGRAPH_STATE_EXPANSION’ was not declared in this scope
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c: In function ‘tree_node* 
rs6000_handle_longcall_attribute(tree_node**, tree_node*, tree_node*, int, 
bool*)’:
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:28517: warning: unknown 
conversion type character ‘E’ in format
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:28517: warning: too many 
arguments for format
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c: In function ‘tree_node* 
rs6000_handle_struct_attribute(tree_node**, tree_node*, tree_node*, int, 
bool*)’:
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:28590: warning: unknown 
conversion type character ‘E’ in format
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:28590: warning: too many 
arguments for format
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:28600: warning: unknown 
conversion type character ‘E’ in format
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:28600: warning: too many 
arguments for format
make[1]: *** [rs6000.o] Error 1


Hello Jan-Benedict,
   thank you for the fallout fix. Even though I tested all back-ends, I 
am unable to build a cross-compiler:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61974.

Thanks,
Martin





This should fix it, ok to apply?


2014-08.25  Jan-Benedict Glaw  

* config/rs6000/rs6000.c (rs6000_return_in_msb): Fix fallout from
cgraph_state conversion.
  
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c

index 00fa070..225f21e 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -9054,7 +9054,7 @@ rs6000_return_in_msb (const_tree valtype)
  static bool
  call_ABI_of_interest (tree fndecl)
  {
-  if (cgraph_state == CGRAPH_STATE_EXPANSION)
+  if (symtab->state == EXPANSION)
  {
struct cgraph_node *c_node;
  





Re: Fix ARM ICE for register var asm ("pc") (PR target/60606)

2014-08-25 Thread Richard Henderson
On 08/22/2014 02:14 PM, Joseph S. Myers wrote:
> Tested with no regressions for cross to arm-none-eabi (it also fixes
> failures of gcc.dg/noncompile/920507-1.c, which is PR 61330).  OK to
> commit?
> 
> 2014-08-22  Joseph Myers  
> 
>   PR target/60606
>   PR target/61330
>   * varasm.c (make_decl_rtl): Clear DECL_ASSEMBLER_NAME and
>   DECL_HARD_REGISTER and return for invalid register specifications.
>   * cfgexpand.c (expand_one_var): If expand_one_hard_reg_var clears
>   DECL_HARD_REGISTER, call expand_one_error_var.
>   * config/arm/arm.c (arm_hard_regno_mode_ok): Do not allow
>   CC_REGNUM with non-MODE_CC modes.
>   (arm_regno_class): Return NO_REGS for PC_REGNUM.
> 
> 2014-08-22  Joseph Myers  
> 
>   PR target/60606
>   PR target/61330
>   * gcc.dg/torture/pr60606-1.c, gcc.target/arm/pr60606-2.c,
>   gcc.target/arm/pr60606-3.c, gcc.target/arm/pr60606-4.c: New tests.

Ok.


r~


Re: [BUILDROBOT][PATCH] ppc{,64}-linux broken (IPA C++ refactoring 4/N)

2014-08-25 Thread Jan-Benedict Glaw
On Mon, 2014-08-25 11:44:58 -0400, David Edelsohn  wrote:
> 2014-08.25  Jan-Benedict Glaw  
> 
> * config/rs6000/rs6000.c (rs6000_return_in_msb): Fix fallout from
> cgraph_state conversion.
> 
> 
> The patch seems reasonable to me based on the other changes.

Committed as r214429.

MfG, JBG

-- 
  Jan-Benedict Glaw  jbg...@lug-owl.de  +49-172-7608481
  Signature of:  Zensur im Internet? Nein danke!
  the second  :


signature.asc
Description: Digital signature


Re: [BUILDROBOT][PATCH] ppc{,64}-linux broken (IPA C++ refactoring 4/N)

2014-08-25 Thread David Edelsohn
2014-08.25  Jan-Benedict Glaw  

* config/rs6000/rs6000.c (rs6000_return_in_msb): Fix fallout from
cgraph_state conversion.


The patch seems reasonable to me based on the other changes.

Thanks, David


[BUILDROBOT][PATCH] ppc{,64}-linux broken (IPA C++ refactoring 4/N)

2014-08-25 Thread Jan-Benedict Glaw
Hi!

Your recent change left one cgraph_state in place in the rs6000
backend, resulting in (see
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=346638
and
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=346630):

g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions 
-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual 
-Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long 
-Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. 
-I. -I/home/jbglaw/repos/gcc/gcc -I/home/jbglaw/repos/gcc/gcc/. 
-I/home/jbglaw/repos/gcc/gcc/../include 
-I/home/jbglaw/repos/gcc/gcc/../libcpp/include  
-I/home/jbglaw/repos/gcc/gcc/../libdecnumber 
-I/home/jbglaw/repos/gcc/gcc/../libdecnumber/dpd -I../libdecnumber 
-I/home/jbglaw/repos/gcc/gcc/../libbacktrace-o rs6000.o -MT rs6000.o -MMD 
-MP -MF ./.deps/rs6000.TPo /home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c: In function ‘bool 
call_ABI_of_interest(tree_node*)’:
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:9057: error: ‘cgraph_state’ 
was not declared in this scope
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:9057: error: 
‘CGRAPH_STATE_EXPANSION’ was not declared in this scope
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c: In function ‘tree_node* 
rs6000_handle_longcall_attribute(tree_node**, tree_node*, tree_node*, int, 
bool*)’:
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:28517: warning: unknown 
conversion type character ‘E’ in format
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:28517: warning: too many 
arguments for format
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c: In function ‘tree_node* 
rs6000_handle_struct_attribute(tree_node**, tree_node*, tree_node*, int, 
bool*)’:
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:28590: warning: unknown 
conversion type character ‘E’ in format
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:28590: warning: too many 
arguments for format
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:28600: warning: unknown 
conversion type character ‘E’ in format
/home/jbglaw/repos/gcc/gcc/config/rs6000/rs6000.c:28600: warning: too many 
arguments for format
make[1]: *** [rs6000.o] Error 1



This should fix it, ok to apply?


2014-08.25  Jan-Benedict Glaw  

* config/rs6000/rs6000.c (rs6000_return_in_msb): Fix fallout from
cgraph_state conversion.
 
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 00fa070..225f21e 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -9054,7 +9054,7 @@ rs6000_return_in_msb (const_tree valtype)
 static bool
 call_ABI_of_interest (tree fndecl)
 {
-  if (cgraph_state == CGRAPH_STATE_EXPANSION)
+  if (symtab->state == EXPANSION)
 {
   struct cgraph_node *c_node;
 

-- 
  Jan-Benedict Glaw  jbg...@lug-owl.de  +49-172-7608481
Signature of: 17:44 <@uschebit> Evangelist ist doch ein Vertriebler
the second  :   für unverkäufliche Produkte, oder? (#korsett, 20120821)


signature.asc
Description: Digital signature


Re: [PATCH] Fix libbacktrace and libiberty tests fail on sanitized GCC due to wrong link options.

2014-08-25 Thread Bernhard Reutner-Fischer
On 25 August 2014 16:23:54 CEST, Yury Gribov  wrote:
>On 08/25/2014 11:04 AM, Maxim Ostapenko wrote:
>> This patch adds necessary flags to provide a linkage of these tests
>in
> > bootstrap-asan case.
>
>I think you'll want to modify Makefile.def and Makefile.tpl because 
>Makefile is generated from them.

Sounds like this would fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56781

Thanks,



Re: Enable EBX for x86 in 32bits PIC code

2014-08-25 Thread Vladimir Makarov

On 2014-08-22 8:21 AM, Ilya Enkovich wrote:

Hi,

On Cauldron 2014 we had a couple of talks about relaxation of ebx usage in 
32bit PIC mode.  It was decided that the best approach would be to not fix ebx 
register, use speudo register for GOT base address and let allocator do the 
rest.  This should be similar to how clang and icc work with GOT base address.  
I've been working for some time on such patch and now want to share my results.

The idea of the patch was very simple and included few things;
  1.  Set PIC_OFFSET_TABLE_REGNUM to INVALID_REGNUM to specify that we do not 
have any hard reg fixed for PIC.
  2.  Initialize pic_offset_table_rtx with a new pseudo register in the 
begining of a function expand.
  3.  Change ABI so that there is a possible implicit PIC argument for calls; 
pic_offset_table_rtx is used as an arg value if such implicit arg exist.

Such approach worked well on small tests but trying to run some benchmarks we 
faced a problem with reload of address constants.  The problem is that when we 
try to rematerialize address constant or some constant memory reference, we 
have to use pic_offset_table_rtx.  It means we insert new usages of a speudo 
register and alocator cannot handle it correctly.  Same problem also applies 
for float and vector constants.

Rematerialization is not the only case causing new pic_offset_table_rtx usage.  
Another case is a split of some instructions using constant but not having 
proper constraints.  E.g. pushtf pattern allows push of constant but it has to 
be replaced with push of memory in reload pass causing additional usage of 
pic_offset_table_rtx.

There are two ways to fix it.  The first one is to support modifications of 
pseudo register live range during reload and correctly allocate hard regs for 
its new usages (currently we have some hard reg allocated for new usage of 
pseudo reg but it may contain value of some other pseudo reg; thus we reveal 
the problem at runtime only).



I believe there is already code to deal with this situation.  It is code 
for risky transformations (please check flag 
lra_risky_transformation_p).  If this flag is set, next lra assign 
subpass is running and checking correctness of assignments (e.g. 
checking situation when two different pseudos have intersected live 
ranges and the same assigned hard reg.  If such dangerous situation is 
found, it is fixed).



The second way is to avoid all cases when new usages of pic_offset_table_rtx 
appear in reload.  That is a way I chose because it appeared simplier to me and 
would allow me to get some performance data faster.  Also having 
rematerialization of address anf float constants in PIC mode would mean we have 
higher register pressure, thus having them on stack should be even more 
efficient.  To achieve it I had to cut off reg equivs to all exprs using symbol 
references and all constants living in the memory.  I also had to avoid 
instructions requiring split in reload causing load of constant from memory 
(*push[txd]f).

Resulting compiler successfully passes make check, compiles EEMBC and SPEC2000 
benchmarks.  There is no confidence I covered all cases and there still may be 
some templates causing split in reload with new pic_offset_table_rtx usages.  I 
think support of reload with pseudo PIC would be better and more general 
solution.  But I don't know how difficult is to implement it though.  Any ideas 
on resolving this reload issue?



Please see what I mentioned above.  May be it can fix the degradation. 
Rematerialization is important for performance and switching it of 
completely is not wise.




I collected some performance numbers for EEMBC and SPEC2000 benchmarks.  Here 
are patch results for -Ofast optlevel with LTO collectd on Avoton server:
AUTOmark +1,9%
TELECOMmark +4,0%
DENmark +10,0%
SPEC2000 -0,5%

There are few degradations on EEMBC benchmarks but on SPEC2000 situation is 
different and we see more performance losses.  Some of them are caused by 
disabled rematerialization of address constants.  In some cases relaxed ebx 
causes more spills/fills in plaecs where GOT is frequently used.  There are 
also some minor fixes required in the patch to allow more efficient function 
prolog (avoid unnecessary GOT register initialization and allow its 
initialization without ebx usage).  Suppose some performance problems may be 
resolved but a good fix for reload should go first.




Ilya, the optimization you are trying to implement is important in many 
cases and should be in some way included in gcc.  If the degradations 
can be solved in a way i mentioned above we could introduce a 
machine-dependent flag.




Re: [PATCH 225/236] Work towards NEXT_INSN/PREV_INSN requiring insns as their params

2014-08-25 Thread Jeff Law

On 08/19/14 15:35, David Malcolm wrote:

On Tue, 2014-08-19 at 13:57 -0700, Richard Henderson wrote:

On 08/06/2014 10:23 AM, David Malcolm wrote:

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 59d633d..5e42a97 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1604,6 +1604,7 @@ force_nonfallthru_and_redirect (edge e, basic_block 
target, rtx jump_label)

if (EDGE_COUNT (e->src->succs) >= 2 || abnormal_edge_flags || asm_goto_edge)
  {
+  rtx_insn *note;
gcov_type count = e->count;
int probability = e->probability;
/* Create the new structures.  */


A new variable with no uses?


This one is quite ugly: the pre-existing code has two locals named
"note", both of type rtx, with one shadowing the other.  This patch
introduces a third, within the scope where the name "note" is used for
insns.  In the other scopes the two other "note" variables are used for
find_reg_note.  In each case, the name "note" is written to before use.

So in my defense, the existing code already had shadowing of locals...
but I guess that's not much of a defense, and it would be better to
introduce a different name, and rename the uses in the appropriate
scope.
If it's reasonable to do this now, then please do so.  Else make it a 
follow-up item.  I guess we should have had a list of follow-up items :-)


jeff



Re: [PATCH] Fix libbacktrace and libiberty tests fail on sanitized GCC due to wrong link options.

2014-08-25 Thread Yury Gribov

On 08/25/2014 11:04 AM, Maxim Ostapenko wrote:
> This patch adds necessary flags to provide a linkage of these tests in
> bootstrap-asan case.

I think you'll want to modify Makefile.def and Makefile.tpl because 
Makefile is generated from them.


-Y



Re: [PATCH 221/236] Add insn method to rtx_expr_list

2014-08-25 Thread Jeff Law

On 08/19/14 14:41, Richard Henderson wrote:

On 08/06/2014 10:23 AM, David Malcolm wrote:

gcc/
* rtl.h (rtx_expr_list::insn): New method.
---
  gcc/rtl.h | 9 +
  1 file changed, 9 insertions(+)

diff --git a/gcc/rtl.h b/gcc/rtl.h
index d028be1..d5811c2 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -414,6 +414,10 @@ public:

/* Get at the underlying rtx.  */
rtx element () const;
+
+  /* Get at the rtx, casting to rtx_insn *.  */
+  rtx_insn *insn () const;
+
  };

  template <>
@@ -1287,6 +1291,11 @@ inline rtx rtx_expr_list::element () const
return XEXP (this, 0);
  }

+inline rtx_insn *rtx_expr_list::insn () const
+{
+  return as_a  (XEXP (this, 0));
+}
+


Even with the current code base we aren't *supposed* to be putting insns into
an EXPR_LIST -- that's what INSN_LIST is for.  Note the horribleness with which
anything doing this will have in the rtl dumps.

Can we please fix these uses instead of adding this accessor?

I'd be OK with that as a follow-up.

jeff


Re: C++ PATCH to support non-constexpr variable templates

2014-08-25 Thread ville . voutilainen


On Mon Aug 25 2014 15:47:26 GMT+0300 (EEST), Jason Merrill wrote:
> On 08/25/2014 05:24 AM, Ville Voutilainen wrote:
> > Well, it's a bit premature to add tests when the implementation itself is 
> > not
> > quite complete, I guess. :) Having ICEs makes it hard to add tests, too. :P
> 
> But tests are how you verify that the implementation is complete.
> 
> Anyway, here's a fix for your recent test.
 
Thanks, I'll take a look at the tests and will send a patch if something seems 
missing; static member variable templates of a class template and explicit 
specializations thereof are the likely starting point.

Re: [BUILDROBOT][PATCH] frv-linux fallout (was: [PATCH 009/236] Replace BB_HEAD et al macros with functions)

2014-08-25 Thread David Malcolm
On Sat, 2014-08-23 at 20:49 +0200, Jan-Benedict Glaw wrote:
> On Wed, 2014-08-06 13:19:48 -0400, David Malcolm  wrote:
> > This is further scaffolding; convert the BB_* and SET_BB_* macros
> > into functions.  Convert the BB_* rvalue-style functions into returning
> > rtx_insn * rather than plain rtx.
> [...]
> 
> This gave some fallout for frv-linux (see eg. build
> http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=345281): 
> 
> g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions 
> -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing 
> -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual 
> -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings 
> -fno-common  -DHAVE_CONFIG_H -I. -I. -I/home/vaxbuild/repos/gcc/gcc 
> -I/home/vaxbuild/repos/gcc/gcc/. -I/home/vaxbuild/repos/gcc/gcc/../include 
> -I/home/vaxbuild/repos/gcc/gcc/../libcpp/include  
> -I/home/vaxbuild/repos/gcc/gcc/../libdecnumber 
> -I/home/vaxbuild/repos/gcc/gcc/../libdecnumber/dpd -I../libdecnumber 
> -I/home/vaxbuild/repos/gcc/gcc/../libbacktrace-o ifcvt.o -MT ifcvt.o -MMD 
> -MP -MF ./.deps/ifcvt.TPo /home/vaxbuild/repos/gcc/gcc/ifcvt.c
> In file included from ./tm.h:23:0,
>  from /home/vaxbuild/repos/gcc/gcc/ifcvt.c:23:
> /home/vaxbuild/repos/gcc/gcc/ifcvt.c: In function ‘int 
> cond_exec_process_insns(ce_if_block*, rtx, rtx, rtx, int, int)’:
> /home/vaxbuild/repos/gcc/gcc/config/frv/frv.h:1964:58: error: 
> ‘frv_ifcvt_modify_insn’ was not declared in this scope
>  (PATTERN) = frv_ifcvt_modify_insn (CE_INFO, PATTERN, INSN)
>   ^
> /home/vaxbuild/repos/gcc/gcc/ifcvt.c:408:7: note: in expansion of macro 
> ‘IFCVT_MODIFY_INSN’
>IFCVT_MODIFY_INSN (ce_info, pattern, insn);
>^
> /home/vaxbuild/repos/gcc/gcc/ifcvt.c: In function ‘int 
> cond_exec_process_if_block(ce_if_block*, int)’:
> /home/vaxbuild/repos/gcc/gcc/config/frv/frv.h:1948:57: error: 
> ‘frv_ifcvt_modify_tests’ was not declared in this scope
>  frv_ifcvt_modify_tests (CE_INFO, &TRUE_EXPR, &FALSE_EXPR)
>  ^
> /home/vaxbuild/repos/gcc/gcc/ifcvt.c:613:3: note: in expansion of macro 
> ‘IFCVT_MODIFY_TESTS’
>IFCVT_MODIFY_TESTS (ce_info, true_expr, false_expr);
>^
> /home/vaxbuild/repos/gcc/gcc/config/frv/frv.h:1957:70: error: 
> ‘frv_ifcvt_modify_multiple_tests’ was not declared in this scope
>  frv_ifcvt_modify_multiple_tests (CE_INFO, BB, &TRUE_EXPR, &FALSE_EXPR)
>   ^
> /home/vaxbuild/repos/gcc/gcc/ifcvt.c:686:4: note: in expansion of macro 
> ‘IFCVT_MODIFY_MULTIPLE_TESTS’
> IFCVT_MODIFY_MULTIPLE_TESTS (ce_info, bb, t, f);
> ^
> /home/vaxbuild/repos/gcc/gcc/config/frv/frv.h:1974:70: error: 
> ‘frv_ifcvt_modify_cancel’ was not declared in this scope
>  #define IFCVT_MODIFY_CANCEL(CE_INFO) frv_ifcvt_modify_cancel (CE_INFO)
>   ^
> /home/vaxbuild/repos/gcc/gcc/ifcvt.c:724:7: note: in expansion of macro 
> ‘IFCVT_MODIFY_CANCEL’
>IFCVT_MODIFY_CANCEL (ce_info);
>^
> /home/vaxbuild/repos/gcc/gcc/config/frv/frv.h:1969:68: error: 
> ‘frv_ifcvt_modify_final’ was not declared in this scope
>  #define IFCVT_MODIFY_FINAL(CE_INFO) frv_ifcvt_modify_final (CE_INFO)
> ^
> /home/vaxbuild/repos/gcc/gcc/ifcvt.c:731:3: note: in expansion of macro 
> ‘IFCVT_MODIFY_FINAL’
>IFCVT_MODIFY_FINAL (ce_info);
>^
> /home/vaxbuild/repos/gcc/gcc/config/frv/frv.h:1974:70: error: 
> ‘frv_ifcvt_modify_cancel’ was not declared in this scope
>  #define IFCVT_MODIFY_CANCEL(CE_INFO) frv_ifcvt_modify_cancel (CE_INFO)
>   ^
> /home/vaxbuild/repos/gcc/gcc/ifcvt.c:761:3: note: in expansion of macro 
> ‘IFCVT_MODIFY_CANCEL’
>IFCVT_MODIFY_CANCEL (ce_info);
>^
> Makefile:1064: recipe for target 'ifcvt.o' failed
> 
> 
> 
> 
> 
> This is because the macro-implementing functions are declared in
> frv-protos.h iff BB_HEAD is define'd.  Is this okay to apply?


Bother.   Sorry about this.

FWIW, BB_HEAD becomes a macro again at patch #178 of the series.

In hindsight, how I've been committing the rtx-classes work is, ahem,
suboptimal.  I'm testing and committing individual patches, but this
could have gone into trunk in one go.

I got it into my head that this could either be an svn branch, *or* be
rebased repeatedly in git until it's ready to go in... but I now think
this is a false dichotomy: what I realize now is that I should have
continued rebasing my patches in git until they were ready to go... but
then committed them to a svn branch, with a ChangeLog.rtx-classes, and
*immediately* merged that branch to trunk.  This would have given the
best of both approaches: the flexibility and resilie

[PATCH] Fix LOOP_REQUIRES_VERSIONING_* macros (PR c/61271)

2014-08-25 Thread Marek Polacek
Another issue found by -Wlogical-not-parentheses.
tree-vect-data-refs.c contains
if (!LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo))
but since the definition of LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT
is lacking parens, this expands to !X > 0 and we warn.
Similarly for LOOP_REQUIRES_VERSIONING_FOR_ALIAS.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2014-08-25  Marek Polacek  

PR c/61271
* tree-vectorizer.h (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT,
LOOP_REQUIRES_VERSIONING_FOR_ALIAS): Wrap in parens.

diff --git gcc/tree-vectorizer.h gcc/tree-vectorizer.h
index a38443e..95209bc 100644
--- gcc/tree-vectorizer.h
+++ gcc/tree-vectorizer.h
@@ -414,9 +414,9 @@ typedef struct _loop_vec_info {
 #define LOOP_VINFO_SCALAR_LOOP(L) (L)->scalar_loop
 
 #define LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT(L) \
-  (L)->may_misalign_stmts.length () > 0
+  ((L)->may_misalign_stmts.length () > 0)
 #define LOOP_REQUIRES_VERSIONING_FOR_ALIAS(L) \
-  (L)->may_alias_ddrs.length () > 0
+  ((L)->may_alias_ddrs.length () > 0)
 
 #define LOOP_VINFO_NITERS_KNOWN_P(L)  \
   (tree_fits_shwi_p ((L)->num_iters) && tree_to_shwi ((L)->num_iters) > 0)

Marek


Re: C++ PATCH to support non-constexpr variable templates

2014-08-25 Thread Jason Merrill

On 08/25/2014 05:24 AM, Ville Voutilainen wrote:

Well, it's a bit premature to add tests when the implementation itself is not
quite complete, I guess. :) Having ICEs makes it hard to add tests, too. :P


But tests are how you verify that the implementation is complete.

Anyway, here's a fix for your recent test.

commit e79c51a68ae5ace45a191bf95350a68c7ce386d3
Author: Jason Merrill 
Date:   Mon Aug 25 00:17:55 2014 -0400

	* decl.c (start_decl): Look through member variable template.
	* pt.c (tsubst_decl) [VAR_DECL]: Handle member variable templates.
	* decl2.c (grokfield): Set DECL_CONTEXT earlier on
	variables.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index e83192a..80696dd 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4650,13 +4650,37 @@ start_decl (const cp_declarator *declarator,
 
   if (TYPE_P (context) && COMPLETE_TYPE_P (complete_type (context)))
 {
+  bool this_tmpl = (processing_template_decl
+			> template_class_depth (context));
   if (VAR_P (decl))
 	{
 	  tree field = lookup_field (context, DECL_NAME (decl), 0, false);
-	  if (field == NULL_TREE || !VAR_P (field))
-	error ("%q#D is not a static member of %q#T", decl, context);
+	  if (field == NULL_TREE
+	  || !(VAR_P (field) || variable_template_p (field)))
+	error ("%q+#D is not a static data member of %q#T", decl, context);
 	  else
 	{
+	  if (variable_template_p (field))
+		{
+		  if (!this_tmpl)
+		{
+		  error_at (DECL_SOURCE_LOCATION (decl),
+"non-member-template declaration of %qD", decl);
+		  inform (DECL_SOURCE_LOCATION (field), "does not match "
+			  "member template declaration here");
+		  return error_mark_node;
+		}
+		  field = DECL_TEMPLATE_RESULT (field);
+		}
+	  else if (this_tmpl)
+		{
+		  error_at (DECL_SOURCE_LOCATION (decl),
+			"member template declaration of %qD", decl);
+		  inform (DECL_SOURCE_LOCATION (field), "does not match "
+			  "non-member-template declaration here");
+		  return error_mark_node;
+		}
+
 	  if (DECL_CONTEXT (field) != context)
 		{
 		  if (!same_type_p (DECL_CONTEXT (field), context))
@@ -4683,8 +4707,7 @@ start_decl (const cp_declarator *declarator,
   else
 	{
 	  tree field = check_classfn (context, decl,
-  (processing_template_decl
-   > template_class_depth (context))
+  this_tmpl
   ? current_template_parms
   : NULL_TREE);
 	  if (field && field != error_mark_node
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 74a10fb..5b1313e 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -994,6 +994,10 @@ grokfield (const cp_declarator *declarator,
   && DECL_CONTEXT (value) != current_class_type)
 return value;
 
+  /* Need to set this before push_template_decl.  */
+  if (TREE_CODE (value) == VAR_DECL)
+DECL_CONTEXT (value) = current_class_type;
+
   if (processing_template_decl && VAR_OR_FUNCTION_DECL_P (value))
 {
   value = push_template_decl (value);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a40f9d2..3e6d777 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11127,13 +11127,12 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
 		   same_type_p, because DECL_CONTEXT is always
 		   canonical...  */
 		if (ctx == DECL_CONTEXT (t)
-		&& (TREE_CODE (t) != TYPE_DECL
-			/* ... unless T is a member template; in which
-			   case our caller can be willing to create a
-			   specialization of that template represented
-			   by T.  */
-			|| !(DECL_TI_TEMPLATE (t)
-			 && DECL_MEMBER_TEMPLATE_P (DECL_TI_TEMPLATE (t)
+		/* ... unless T is a member template; in which
+		   case our caller can be willing to create a
+		   specialization of that template represented
+		   by T.  */
+		&& !(DECL_TI_TEMPLATE (t)
+			 && DECL_MEMBER_TEMPLATE_P (DECL_TI_TEMPLATE (t
 		  spec = t;
 	  }
 
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60626.C b/gcc/testsuite/g++.dg/cpp1y/pr60626.C
index 686db73..3114644 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr60626.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr60626.C
@@ -4,4 +4,4 @@
 
 struct A {};
 
-void (*A::p)(auto) = 0;  // { dg-error "static member|template" }
+void (*A::p)(auto) = 0;  // { dg-error "static data member|template" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ8.C b/gcc/testsuite/g++.dg/cpp1y/var-templ8.C
new file mode 100644
index 000..8e3d34a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ8.C
@@ -0,0 +1,15 @@
+// { dg-do compile { target c++14 } }
+// { dg-final { scan-assembler "_ZN1X1xIiEE" } }
+
+struct X
+{
+  template  static T x;
+};
+
+template 
+T X::x = T();
+
+int main()
+{
+  int x = X::x;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ9.C b/gcc/testsuite/g++.dg/cpp1y/var-templ9.C
new file mode 100644
index 000..2ffb007
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ9.C
@@ -0,0 +1,15 @@
+// { dg-do compile { target c++14 } }
+
+struct X
+{
+  template  static int x;
+};
+
+int X::x = 42;			// { d

Re: [patch] Macroize logic patterns

2014-08-25 Thread Uros Bizjak
On Mon, Aug 25, 2014 at 2:24 PM, Marek Polacek  wrote:

>> Done.
>>
>> 2014-08-25  Petr Murzin  
>>
>> * config/i386/i386.md (SWI1248_AVX512BW): New mode iterator.
>> (*k): Add *kqi and *khi and use
>> SWI1248_AVX512BW mode iterator.
>
> This broke gcc build:
> i386.md:894: unterminated construct
>
> Uros, ok to fix with the following?  (Though it looks obvious enough...)
>
> 2014-08-25  Marek Polacek  
>
> * config/i386/i386.md (SWI1248_AVX512BW): Add missing paren.

Yes, please go ahed with the fix.

Thanks,
Uros.


Re: [patch] Macroize logic patterns

2014-08-25 Thread Marek Polacek
On Mon, Aug 25, 2014 at 02:52:16PM +0400, Petr Murzin wrote:
> Done.
> 
> 2014-08-25  Petr Murzin  
> 
> * config/i386/i386.md (SWI1248_AVX512BW): New mode iterator.
> (*k): Add *kqi and *khi and use
> SWI1248_AVX512BW mode iterator.

This broke gcc build:
i386.md:894: unterminated construct

Uros, ok to fix with the following?  (Though it looks obvious enough...)

2014-08-25  Marek Polacek  

* config/i386/i386.md (SWI1248_AVX512BW): Add missing paren.

diff --git gcc/config/i386/i386.md gcc/config/i386/i386.md
index f56ad07..723f42f 100644
--- gcc/config/i386/i386.md
+++ gcc/config/i386/i386.md
@@ -892,7 +892,7 @@
 
 ;; All integer modes with AVX512BW.
 (define_mode_iterator SWI1248_AVX512BW
-  [QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")]
+  [QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
 
 ;; All integer modes without QImode.
 (define_mode_iterator SWI248x [HI SI DI])

Marek


Re: [PATCH] Fix wrong refactoring in cgraph_node::function_symbol

2014-08-25 Thread Ilya Enkovich
2014-08-22 16:36 GMT+04:00 Martin Liška :
> On 08/13/2014 02:25 PM, Ilya Enkovich wrote:
>> Hi,
>>
>> This patch is to fix wrong refactoring for cgraph_node::function_symbol 
>> introduced by this patch: 
>> https://gcc.gnu.org/ml/gcc-cvs/2014-07/msg00805.html.  Here is how function 
>> was refactored:
>>
>> -cgraph_function_node (struct cgraph_node *node, enum availability 
>> *availability)
>> +cgraph_node *
>> +cgraph_node::function_symbol (enum availability *availability)
>>  {
>> +  cgraph_node *node = NULL;
>> +
>>do
>>  {
>> -  node = cgraph_function_or_thunk_node (node, availability);
>> +  node = ultimate_alias_target (availability);
>>if (node->thunk.thunk_p)
>> {
>>   node = node->callees->callee;
>>   if (availability)
>> {
>>   enum availability a;
>> - a = cgraph_function_body_availability (node);
>> + a = node->get_availability ();
>>   if (a < *availability)
>> *availability = a;
>> }
>> - node = cgraph_function_or_thunk_node (node, availability);
>> + node = node->ultimate_alias_target (availability);
>> }
>>  } while (node && node->thunk.thunk_p);
>>return node;
>>  }
>>
>> first ultimate_alias_target call always uses 'this' instead of 'node'.  This 
>> causes infinite loop.
>>
>> Patch was bootstrapped and regtested on linux-x86_64.  OK for trunk?
> Hello.
> Thank you for the fix. Unfortunately, there's no test case that would show me 
> the problem.

You should have have at least two thunks in a chain of aliases and
thunks to fall into an infinite loop here.  I do not know when such
chains exist in regular cases.  I hit this bug testing pointer bounds
checker which transforms functions to thunks and therefore get longer
chains of thunks.

Thanks,
Ilya

>
> Martin
>>
>> Thanks,
>> Ilya
>> --
>>
>> 2014-08-13  Ilya Enkovich  
>>
>>   * cgraph.c (cgraph_node::function_symbol): Fix wrong
>>   cgraph_function_node to cgraph_node::function_symbol
>>   refactoring.
>>
>> diff --git a/gcc/cgraph.c b/gcc/cgraph.c
>> index 5a0b903..370a96a 100644
>> --- a/gcc/cgraph.c
>> +++ b/gcc/cgraph.c
>> @@ -3000,11 +3000,11 @@ cgraph_node::verify_cgraph_nodes (void)
>>  cgraph_node *
>>  cgraph_node::function_symbol (enum availability *availability)
>>  {
>> -  cgraph_node *node = NULL;
>> +  cgraph_node *node = this;
>>
>>do
>>  {
>> -  node = ultimate_alias_target (availability);
>> +  node = node->ultimate_alias_target (availability);
>>if (node->thunk.thunk_p)
>>   {
>> node = node->callees->callee;
>


Re: Enable EBX for x86 in 32bits PIC code

2014-08-25 Thread Ilya Enkovich
2014-08-25 15:24 GMT+04:00 Hans-Peter Nilsson :
> On Mon, 25 Aug 2014, Ilya Enkovich wrote:
>> 2014-08-23 5:47 GMT+04:00 Hans-Peter Nilsson :
>> > ...did you send the right version of the patch?
>> > This one uses the RTX-returning hook only in boolean tests,
>> > unless I misread.
>
> (I did, but not by much.)
>
>> NULL returned by hook means we do not have implicit pic arg to
>> pass/receive and there are pieces of code which should be executed
>> only when implicit pic arg exists.  This causes these boolean tests.
>
> Well, obviously, but...
>
>> There are also non boolean usages. E.g.:
>
> I thing singular ("usage") is more correct?
> I saw only one such use. :)

There is another one in i386.c :)

>
>> +  rtx old_reg = targetm.calls.implicit_pic_arg (fndecl);
>> +  rtx new_reg = gen_reg_rtx (GET_MODE (old_reg));
>> +  emit_move_insn (new_reg, old_reg);
>> +  pic_offset_table_rtx = new_reg;
>
> And before that, it's called as a boolean test, throwing away
> the result!
>
> I suggest you change the hook to return a boolean, with a
> pointer argument to a variable to set, passed as NULL from
> callers not interested in the actual value.
>
> I.e. instead of:
>
>> >> +@deftypefn {Target Hook} rtx TARGET_IMPLICIT_PIC_ARG (const_tree 
>> >> @var{fntype_or_decl})
>
> make it a:
>
> @deftypefn {Target Hook} bool TARGET_IMPLICIT_PIC_ARG
>  (const_tree @var{fntype_or_decl}, rtx *@var{addr})

OK.  I'll change this hook if it goes to a product quality patch.
Current patch is posted to demonstrate an approach and show narrow
points I have to deal with in reload.  There is no reason in cleaning
it until a decision about next steps is made.

Thanks,
Ilya

>
> brgds, H-P


[C/C++ PATCH] Allow __atomic_always_lock_free in a static assert (PR c/62024)

2014-08-25 Thread Marek Polacek
PR62024 reports that we can't use __atomic_always_lock_free in
a static assert, as the FEs say it's not a constant expression.  Yet the
docs say that the result of __atomic_always_lock_free is a compile time
constant.
We can fix this pretty easily.  While fold folds __atomic_always_lock_free
to a constant, that constant is wrapped in NOP_EXPR - and static assert
code is unhappy.
I think we can just STRIP_TYPE_NOPS - we don't expect an lvalue in the
static assert code.  This is done in both C and C++ FEs.  What do you think?
In C, we'd still pedwarn on such code, and in C++ we'd still reject
non-constexpr functions that are not builtin functions.

The tests require sync_char_short target in a hope they aren't run
on targets where the static assert would actually trigger.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2014-08-25  Marek Polacek  

PR c/62024
c/
* c-parser.c (c_parser_static_assert_declaration_no_semi): Strip no-op
conversions.
cp/
* semantics.c (finish_static_assert): Strip no-op conversions.
testsuite/
* g++.dg/cpp0x/pr62024.C: New test.
* gcc.dg/pr62024.c: New test.

diff --git gcc/c/c-parser.c gcc/c/c-parser.c
index d634bb1..fc7bbaf 100644
--- gcc/c/c-parser.c
+++ gcc/c/c-parser.c
@@ -2058,6 +2058,8 @@ c_parser_static_assert_declaration_no_semi (c_parser 
*parser)
   if (TREE_CODE (value) != INTEGER_CST)
 {
   value = c_fully_fold (value, false, NULL);
+  /* Strip no-op conversions.  */
+  STRIP_TYPE_NOPS (value);
   if (TREE_CODE (value) == INTEGER_CST)
pedwarn (value_loc, OPT_Wpedantic, "expression in static assertion "
 "is not an integer constant expression");
diff --git gcc/cp/semantics.c gcc/cp/semantics.c
index a54011f..b87d3ba 100644
--- gcc/cp/semantics.c
+++ gcc/cp/semantics.c
@@ -6870,6 +6870,9 @@ finish_static_assert (tree condition, tree message, 
location_t location,
   condition = cp_convert (boolean_type_node, condition, tf_warning_or_error);
   condition = maybe_constant_value (condition);
 
+  /* Strip no-op conversions.  */
+  STRIP_TYPE_NOPS (condition);
+
   if (TREE_CODE (condition) == INTEGER_CST && !integer_zerop (condition))
 /* Do nothing; the condition is satisfied. */
 ;
diff --git gcc/testsuite/g++.dg/cpp0x/pr62024.C 
gcc/testsuite/g++.dg/cpp0x/pr62024.C
index e69de29..5f0640a 100644
--- gcc/testsuite/g++.dg/cpp0x/pr62024.C
+++ gcc/testsuite/g++.dg/cpp0x/pr62024.C
@@ -0,0 +1,7 @@
+// PR c/62024
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target sync_char_short }
+
+int *p;
+static_assert (__atomic_always_lock_free (1, p), "");
+static_assert (__atomic_always_lock_free (1, 0), "");
diff --git gcc/testsuite/gcc.dg/pr62024.c gcc/testsuite/gcc.dg/pr62024.c
index e69de29..79a0b79 100644
--- gcc/testsuite/gcc.dg/pr62024.c
+++ gcc/testsuite/gcc.dg/pr62024.c
@@ -0,0 +1,8 @@
+/* PR c/62024 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu11 -Wpedantic" } */
+/* { dg-require-effective-target sync_char_short } */
+
+int *p;
+_Static_assert (__atomic_always_lock_free (1, p), ""); /* { dg-warning "is not 
an integer constant" } */
+_Static_assert (__atomic_always_lock_free (1, 0), ""); /* { dg-warning "is not 
an integer constant" } */

Marek


Re: Enable EBX for x86 in 32bits PIC code

2014-08-25 Thread Hans-Peter Nilsson
On Mon, 25 Aug 2014, Ilya Enkovich wrote:
> 2014-08-23 5:47 GMT+04:00 Hans-Peter Nilsson :
> > ...did you send the right version of the patch?
> > This one uses the RTX-returning hook only in boolean tests,
> > unless I misread.

(I did, but not by much.)

> NULL returned by hook means we do not have implicit pic arg to
> pass/receive and there are pieces of code which should be executed
> only when implicit pic arg exists.  This causes these boolean tests.

Well, obviously, but...

> There are also non boolean usages. E.g.:

I thing singular ("usage") is more correct?
I saw only one such use. :)

> +  rtx old_reg = targetm.calls.implicit_pic_arg (fndecl);
> +  rtx new_reg = gen_reg_rtx (GET_MODE (old_reg));
> +  emit_move_insn (new_reg, old_reg);
> +  pic_offset_table_rtx = new_reg;

And before that, it's called as a boolean test, throwing away
the result!

I suggest you change the hook to return a boolean, with a
pointer argument to a variable to set, passed as NULL from
callers not interested in the actual value.

I.e. instead of:

> >> +@deftypefn {Target Hook} rtx TARGET_IMPLICIT_PIC_ARG (const_tree 
> >> @var{fntype_or_decl})

make it a:

@deftypefn {Target Hook} bool TARGET_IMPLICIT_PIC_ARG
 (const_tree @var{fntype_or_decl}, rtx *@var{addr})

brgds, H-P


Re: [patch] Macroize logic patterns

2014-08-25 Thread Petr Murzin
Done.

2014-08-25  Petr Murzin  

* config/i386/i386.md (SWI1248_AVX512BW): New mode iterator.
(*k): Add *kqi and *khi and use
SWI1248_AVX512BW mode iterator.

Best regards,
Petr Murzin

On Mon, Aug 25, 2014 at 1:42 PM, Uros Bizjak  wrote:
> On Mon, Aug 25, 2014 at 11:00 AM, Petr Murzin  wrote:
>
>> I've macroized logic patterns. Please have a look. Is it ok for trunk?
>>
>> 2014-08-25  Petr Murzin  
>>
>> * config/i386/i386.md: Macroize logic patterns.
>
> Please write ChangeLog entry like:
>
> *config/i386/i386.md (SWI1248_AVX512BW): New mode iterator.
> (*k): Add *kqi and *khi and use
> SWI1248_AVX512BW mode iterator.
>
> +;; All integer modes with avx512bw.
> +(define_mode_iterator SWI1248_avx512bw
> +  [QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
>
> Mode iterator should be named in all caps.
>
> OK with this change.
>
> Thanks,
> Uros.


macroize_logic_patterns_patch
Description: Binary data


[PATCH] PR61078 S/390: Fix negdi splitter

2014-08-25 Thread Andreas Krebbel
Hi,

the S/390 backend splits RTXs like (set (reg:DI 3) (neg:DI (reg:DI
2))) on 31bit ESA in a way which overwrites r3 before it is read as
source operand.

The attached patch adds a check to the insn condition and provides a
second splitter as plan B.

This fixes ESA mode bootstrap on s390. No regressions.

Bye,

-Andreas-


2014-08-25  Andreas Krebbel  

PR target/61078
* config/s390/s390.md ("*negdi2_31"): Add s390_split_ok_p check
and add a second splitter to handle the remaining cases.

2014-08-25  Andreas Krebbel  

PR target/61078
* gcc.target/s390/pr61078.c: New testcase.

diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index b17c1fa..7885ab5 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -7366,13 +7366,27 @@
   [(set_attr "op_type"  "RR")
(set_attr "z10prop" "z10_super_c_E1")])
 
-(define_insn_and_split "*negdi2_31"
+(define_insn "*negdi2_31"
   [(set (match_operand:DI 0 "register_operand" "=d")
 (neg:DI (match_operand:DI 1 "register_operand" "d")))
(clobber (reg:CC CC_REGNUM))]
   "!TARGET_ZARCH"
-  "#"
-  "&& reload_completed"
+  "#")
+
+; Split a DImode NEG on 31bit into 2 SImode NEGs
+
+; Doing the twos complement separately on the SImode parts does an
+; unwanted +1 on the high part which needs to be subtracted afterwards
+; ... unless the +1 on the low part created an overflow.
+
+(define_split
+  [(set (match_operand:DI 0 "register_operand" "")
+(neg:DI (match_operand:DI 1 "register_operand" "")))
+   (clobber (reg:CC CC_REGNUM))]
+  "!TARGET_ZARCH
+   && (REGNO (operands[0]) == REGNO (operands[1])
+  || s390_split_ok_p (operands[0], operands[1], DImode, 0))
+   && reload_completed"
   [(parallel
 [(set (match_dup 2) (neg:SI (match_dup 3)))
  (clobber (reg:CC CC_REGNUM))])
@@ -7394,6 +7408,40 @@
operands[5] = operand_subword (operands[1], 1, 0, DImode);
operands[6] = gen_label_rtx ();")
 
+; Like above but first make a copy of the low part of the src operand
+; since it might overlap with the high part of the destination.
+
+(define_split
+  [(set (match_operand:DI 0 "register_operand" "")
+(neg:DI (match_operand:DI 1 "register_operand" "")))
+   (clobber (reg:CC CC_REGNUM))]
+  "!TARGET_ZARCH
+   && s390_split_ok_p (operands[0], operands[1], DImode, 1)
+   && reload_completed"
+  [; Make a backup of op5 first
+   (set (match_dup 4) (match_dup 5))
+   ; Setting op2 here might clobber op5
+   (parallel
+[(set (match_dup 2) (neg:SI (match_dup 3)))
+ (clobber (reg:CC CC_REGNUM))])
+   (parallel
+[(set (reg:CCAP CC_REGNUM)
+  (compare:CCAP (neg:SI (match_dup 4)) (const_int 0)))
+ (set (match_dup 4) (neg:SI (match_dup 4)))])
+   (set (pc)
+(if_then_else (ne (reg:CCAP CC_REGNUM) (const_int 0))
+  (pc)
+  (label_ref (match_dup 6
+   (parallel
+[(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
+ (clobber (reg:CC CC_REGNUM))])
+   (match_dup 6)]
+  "operands[2] = operand_subword (operands[0], 0, 0, DImode);
+   operands[3] = operand_subword (operands[1], 0, 0, DImode);
+   operands[4] = operand_subword (operands[0], 1, 0, DImode);
+   operands[5] = operand_subword (operands[1], 1, 0, DImode);
+   operands[6] = gen_label_rtx ();")
+
 ;
 ; neg(df|sf)2 instruction pattern(s).
 ;
diff --git a/gcc/testsuite/gcc.target/s390/pr61078.c 
b/gcc/testsuite/gcc.target/s390/pr61078.c
new file mode 100644
index 000..2f95eba
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/pr61078.c
@@ -0,0 +1,26 @@
+/* This testcase is extracted from s390_emit_prologue.  The negation
+   of a 64bit value got split incorrectly on 31 bit.  */
+
+/* { dg-do run } */
+/* { dg-options "-O2 -mesa -m31" } */
+
+extern void abort (void);
+
+long long frame_size = 42;
+
+int __attribute__((noinline))
+foo  (int a __attribute__((unused)), long long b)
+{
+  return (int)b;
+}
+
+int
+main ()
+{
+if (frame_size > 0)
+{
+  if (foo (0, -frame_size) != -42)
+   abort ();
+}
+return 0;
+}



[Patch ARM] Fix PR target/56846

2014-08-25 Thread Tony Wang
Hi all,

The bug is reported at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56846, and 
it’s about the problem that
when exception handler is involved in the function, then _Unwind_Backtrace 
function will run into deadloop on
arm target. 

Cmd line: arm-none-eabi-g++ -mthumb -mcpu=cortex-m3 -O0 -g -std=c++11 
-specs=rdimon.specs main.c -o main.exe
#include 
#include 
_Unwind_Reason_Code trace_func(struct _Unwind_Context * context, void* arg)
{
  void *ip = (void *)_Unwind_GetIP(context);
  printf("Address: %p\n", ip);
  return _URC_NO_REASON;
}
void bar()
{
  puts("This is in bar");
  _Unwind_Backtrace((_Unwind_Trace_Fn)&trace_func, 0);
}
void foo()
{
  try
  {
    bar();
  }
  catch (...)
  {
    puts("Exception");
  }
}

The potential of such a bug is discussed long time ago in mail:
https://gcc.gnu.org/ml/gcc/2007-08/msg00235.html. Basically, as the ARM EHABI 
does not define how to implement
the Unwind_Backtrace, Andrew give control to the personality routine to unwind 
the stack, and use the unwind
state combination of “_US_VIRTUAL_UNWIND_FRAME | _US_FORCE_UNWIND” to represent 
that the caller is asking the
personality routine to only unwind the stack for it. 

However, the pr in the libstdc++-v3 doesn’t handle such a unwind state pattern 
correctly. When the backtrace
function passes such a pattern to it, it will still return _URC_HANDLER_FOUND 
to the caller in some cases.
It’s because the pr will think that the _Unwind_Backtrace is raising a none 
type exception to it, so if the
exception handler in current stack frame can catch anything(like catch(…)), the 
pr will return
_URC_HANDLER_FOUND to the caller and ask for next step. But definitely, the 
unwind backtrace function don’t
know what to do when pr return an exception handler to it.

So this patch just evaluate such a unwind state pattern at the beginning of the 
personality routine in
libstdc++-v3, if we meet with “_US_VIRTUAL_UNWIND_FRAME | _US_FORCE_UNWIND”, 
then we directly call macro
CONTINUE_UNWINDING to unwind the stack and return.

Is this a reasonable fix?

gcc/libstdc++-v3/ChangeLog:
2014-8-25   Tony Wang 

     PR target/56846
     * libsupc++/eh_personality.cc: Return with CONTINUE_UNWINDING
     when meet with the unwind state pattern: 
_US_VIRTUAL_UNWIND_FRAME |
     _US_FORCE_UNWIND

diff --git a/libstdc++-v3/libsupc++/eh_personality.cc 
b/libstdc++-v3/libsupc++/eh_personality.cc
index f315a83..c2b30e9 100644
--- a/libstdc++-v3/libsupc++/eh_personality.cc
+++ b/libstdc++-v3/libsupc++/eh_personality.cc
@@ -378,6 +378,11 @@ PERSONALITY_FUNCTION (int version,
   switch (state & _US_ACTION_MASK)
 {
 case _US_VIRTUAL_UNWIND_FRAME:
+  // If the unwind state pattern is _US_VIRTUAL_UNWIND_FRAME |
+  // _US_FORCE_UNWIND, we don't need to search for any handler
+  // as it is not a real exception. Just unwind the stack.
+  if (state & _US_FORCE_UNWIND)
+    CONTINUE_UNWINDING;
   actions = _UA_SEARCH_PHASE;
   break;




[PATCH]gfortran.dg/bessel_7.f90: Bump allowed precision to avoid failure on s390.

2014-08-25 Thread Dominik Vogt
The attached patch fixes a bessel_7 fortran test failure that appeared during
SLES 12 distro tests for s390x - by bumping the error tolerance.

The same patch should apply to gcc-4.9 and gcc-4.8.

ChangeLog:
--
2014-08-25  Dominik Vogt  

* gfortran.dg/bessel_7.f90: Bump allowed precision to avoid
failure on s390*-*-linux-gnu.
--

P.S.: Please do not commit this patch; one of my colleagues with
the proper clearances needs to do that.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany
>From 217f52fd87cb817fec9f8802e70bfec3454a9409 Mon Sep 17 00:00:00 2001
From: Dominik Vogt 
Date: Mon, 25 Aug 2014 10:47:49 +0100
Subject: [PATCH 1/2] gfortran.dg/bessel_7.f90: Bump allowed precision to avoid
 failure on s390.

Problem reappeared during SLES 12 testing for s390.
---
 gcc/testsuite/gfortran.dg/bessel_7.f90 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gfortran.dg/bessel_7.f90 b/gcc/testsuite/gfortran.dg/bessel_7.f90
index 7e63ed1..c6b5f74 100644
--- a/gcc/testsuite/gfortran.dg/bessel_7.f90
+++ b/gcc/testsuite/gfortran.dg/bessel_7.f90
@@ -16,7 +16,7 @@
 implicit none
 real,parameter :: values(*) = [0.0, 0.5, 1.0, 0.9, 1.8,2.0,3.0,4.0,4.25,8.0,34.53, 475.78] 
 real,parameter :: myeps(size(values)) = epsilon(0.0) &
-  * [2, 3, 4, 5, 8, 2, 12, 6, 7, 6, 36, 168 ]
+  * [2, 3, 4, 5, 8, 2, 13, 6, 7, 6, 36, 168 ]
 ! The following is sufficient for me - the values above are a bit
 ! more tolerant
 !  * [0, 0, 0, 3, 3, 0, 9, 0, 2, 1, 22, 130 ]
-- 
1.8.4.2



Re: [PATCH 2/5] Existing call graph infrastructure enhancement

2014-08-25 Thread Martin Liška

Hello,
   after fixing an issue with callgraph thunk creation, I would like to enhance 
callgraph API a bit. My problem was that I was trying to expand_thunk after a 
body of the original function was removed. As a result, I created a call 
without arguments. The change was suggested by Honza.

Thank you,
Martin

On 07/17/2014 03:49 PM, Martin Liška wrote:


On 06/30/2014 08:54 PM, Jeff Law wrote:

On 06/30/14 05:49, Martin Liška wrote:


On 06/17/2014 10:00 PM, Jeff Law wrote:

On 06/13/14 04:26, mliska wrote:

Hi,
 this small patch prepares remaining needed infrastructure for
the new pass.

Changelog:

2014-06-13  Martin Liska  
Honza Hubicka  

* ipa-utils.h (polymorphic_type_binfo_p): Function marked external
instead of static.
* ipa-devirt.c (polymorphic_type_binfo_p): Likewise.
* ipa-prop.h (count_formal_params): Likewise.
* ipa-prop.c (count_formal_params): Likewise.
* ipa-utils.c (ipa_merge_profiles): Be more tolerant if we merge
profiles for semantically equivalent functions.
* passes.c (do_per_function): If we load body of a function
during WPA,
this condition should behave same.
* varpool.c (ctor_for_folding): More tolerant assert for variable
aliases created during WPA.

Presumably we don't have any useful way to merge the cases where we
have provides for SRC & DST in ipa_merge_profiles or even to guess
which is more useful when presented with both?  Does it make sense to
log this into a debugging file when we drop one?

Hello,
this merge function was written by Honza, what do you think Honza
about this note?


I think this patch is fine.  If adding logging makes sense, then feel
free to do so and consider that trivial change pre-approved.

I made a small change to this patch, where I moved
'gsi_next_nonvirtual_phi' from the pass to gimple-iterator.h.

Ready for trunk with this change?

Yes.  I think with the exception of patch #3/5 everything looks good. I'll try 
to get another pass over #3 this week.  What I looked at last week was pretty 
good; I'm pretty confident this will be wrapped up shortly.

If #1/#2 make sense to install independent of #3, go ahead. #4/#5 are obviously 
dependent on #3.

Jeff


Hello,
   thank you for approval, this final version removes few hunks that are not 
needed any more. Changes are just cosmetic and I will commit the patch at the 
beginning of next week.

Thanks,
Martin



2014-08-25  Martin Liska  

* cgraph.h (release_body):  new argument keep_arguments added.
* cgraph.c (release_body): Likewise.
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index cb49cdc..ad32fb8 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1716,13 +1716,15 @@ release_function_body (tree decl)
are free'd in final.c via free_after_compilation().  */
 
 void
-cgraph_node::release_body (void)
+cgraph_node::release_body (bool keep_arguments)
 {
   ipa_transforms_to_apply.release ();
   if (!used_as_abstract_origin && cgraph_state != CGRAPH_STATE_PARSING)
 {
   DECL_RESULT (decl) = NULL;
-  DECL_ARGUMENTS (decl) = NULL;
+
+  if (!keep_arguments)
+   DECL_ARGUMENTS (decl) = NULL;
 }
   /* If the node is abstract and needed, then do not clear DECL_INITIAL
  of its associated function function declaration because it's
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 2594ae5..5edcf74 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -890,7 +890,7 @@ public:
  Use this only for functions that are released before being translated to
  target code (i.e. RTL).  Functions that are compiled to RTL and beyond
  are free'd in final.c via free_after_compilation().  */
-  void release_body (void);
+  void release_body (bool keep_arguments = false);
 
   /* cgraph_node is no longer nested function; update cgraph accordingly.  */
   void unnest (void);


Re: [patch] Macroize logic patterns

2014-08-25 Thread Uros Bizjak
On Mon, Aug 25, 2014 at 11:00 AM, Petr Murzin  wrote:

> I've macroized logic patterns. Please have a look. Is it ok for trunk?
>
> 2014-08-25  Petr Murzin  
>
> * config/i386/i386.md: Macroize logic patterns.

Please write ChangeLog entry like:

*config/i386/i386.md (SWI1248_AVX512BW): New mode iterator.
(*k): Add *kqi and *khi and use
SWI1248_AVX512BW mode iterator.

+;; All integer modes with avx512bw.
+(define_mode_iterator SWI1248_avx512bw
+  [QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])

Mode iterator should be named in all caps.

OK with this change.

Thanks,
Uros.


[C++ testcase, obvious] Adjust g++.old-deja/g++.pt/var1.C vs c++14

2014-08-25 Thread Paolo Carlini

Hi,

I'm going to commit as obvious the below when testing finishes.

Thanks,
Paolo.

///
2014-08-25  Paolo Carlini  

* g++.old-deja/g++.pt/var1.C: Use c++14, not c++1y, in dg-error.
Index: g++.old-deja/g++.pt/var1.C
===
--- g++.old-deja/g++.pt/var1.C  (revision 214415)
+++ g++.old-deja/g++.pt/var1.C  (working copy)
@@ -1,4 +1,4 @@
 // { dg-do assemble  }
 // Origin: Jason Merrill 
 
-template  T t; // { dg-error "" "" { target { ! c++1y } } } template 
declaration of t
+template  T t; // { dg-error "" "" { target { ! c++14 } } } template 
declaration of t


Re: Enable EBX for x86 in 32bits PIC code

2014-08-25 Thread Ilya Enkovich
2014-08-23 5:47 GMT+04:00 Hans-Peter Nilsson :
> (Dropping gcc@ and people known to subscribe to gcc-patches
> from the CC.)
>
> Sorry for the drive-by review, but...
>
> On Fri, 22 Aug 2014, Ilya Enkovich wrote:
>> Hi,
>>
>> On Cauldron 2014 we had a couple of talks about relaxation of
>> ebx usage in 32bit PIC mode.  It was decided that the best
>> approach would be to not fix ebx register, use speudo register
>> for GOT base address and let allocator do the rest.  This should
>> be similar to how clang and icc work with GOT base address.
>> I've been working for some time on such patch and now want to
>> share my results.
>
> ...did you send the right version of the patch?
> This one uses the RTX-returning hook only in boolean tests,
> unless I misread.
>
> Using the return value in boolean tests (non/NULL) here:

NULL returned by hook means we do not have implicit pic arg to
pass/receive and there are pieces of code which should be executed
only when implicit pic arg exists.  This causes these boolean tests.
There are also non boolean usages. E.g.:

+  rtx old_reg = targetm.calls.implicit_pic_arg (fndecl);
+  rtx new_reg = gen_reg_rtx (GET_MODE (old_reg));
+  emit_move_insn (new_reg, old_reg);
+  pic_offset_table_rtx = new_reg;

>
>> diff --git a/gcc/calls.c b/gcc/calls.c
>> index 4285ec1..85dae6b 100644
>> --- a/gcc/calls.c
>> +++ b/gcc/calls.c
>> @@ -1122,6 +1122,14 @@ initialize_argument_information (int num_actuals 
>> ATTRIBUTE_UNUSED,
>>  call_expr_arg_iterator iter;
>>  tree arg;
>>
>> +if (targetm.calls.implicit_pic_arg (fndecl ? fndecl : fntype))
> ...
>> +  /* Add implicit PIC arg.  */
>> +  if (targetm.calls.implicit_pic_arg (fndecl ? fndecl : fntype))
>> +num_actuals++;
> ...
>> +  if (targetm.calls.implicit_pic_arg (fndecl ? fndecl : fntype))
>
> but:
>
>> +/* Return reg in which implicit PIC base address
>> +   arg is passed.  */
>> +static rtx
>> +ix86_implicit_pic_arg (const_tree fntype_or_decl ATTRIBUTE_UNUSED)
> ...
>> +#undef TARGET_IMPLICIT_PIC_ARG
>> +#define TARGET_IMPLICIT_PIC_ARG ix86_implicit_pic_arg
>>  #undef TARGET_FUNCTION_ARG_BOUNDARY
>
> and:
>
>> --- a/gcc/doc/tm.texi
>> +++ b/gcc/doc/tm.texi
>> @@ -3967,6 +3967,12 @@ If @code{TARGET_FUNCTION_INCOMING_ARG} is not defined,
>>  @code{TARGET_FUNCTION_ARG} serves both purposes.
>>  @end deftypefn
>>
>> +@deftypefn {Target Hook} rtx TARGET_IMPLICIT_PIC_ARG (const_tree 
>> @var{fntype_or_decl})
>> +This hook returns register holding PIC base address for functions
>> +which do not fix hard register but handle it similar to function arg
>> +assigning a virtual reg for it.
>> +@end deftypefn
>
> Also, the contains_symbol_ref removal seems like an independent
> cleanup-patch.

It was not removed, it was just moved into rtlanal.c for shared usage
(I used it in ira.c).

Thanks,
Ilya

>
>> index a458380..63d2be5 100644
>> --- a/gcc/var-tracking.c
>> +++ b/gcc/var-tracking.c
>> @@ -661,7 +661,6 @@ static bool variable_different_p (variable, variable);
>>  static bool dataflow_set_different (dataflow_set *, dataflow_set *);
>>  static void dataflow_set_destroy (dataflow_set *);
>>
>> -static bool contains_symbol_ref (rtx);
>
> brgds, H-P


Re: C++ PATCH to support non-constexpr variable templates

2014-08-25 Thread Ville Voutilainen
On 25 August 2014 05:54, Jason Merrill  wrote:
> On 08/23/2014 06:29 PM, Ville Voutilainen wrote:
>>
>> Based on my quick tests with it, it seems to me that we need more
>> tests for static member variable templates. My first attempt at something
>> like that gave an ICE...
>
>
> Yeah, I figured there would be more to do.  More tests are welcome.  :)


Well, it's a bit premature to add tests when the implementation itself is not
quite complete, I guess. :) Having ICEs makes it hard to add tests, too. :P


Re: [wwwdocs] Update GCC5 changes.html

2014-08-25 Thread Marek Polacek
On Mon, Aug 25, 2014 at 09:19:08AM +0200, Gerald Pfeifer wrote:
> On Fri, 22 Aug 2014, Marek Polacek wrote:
> Nice!  Thanks you.  

Thanks for review.

> Oh, yes, okay.  Can you just check that lines are <80 columns?

Sure.  (I actually had to re-indent a few of them.)
Committed.

Marek


[patch] Macroize logic patterns

2014-08-25 Thread Petr Murzin
Hi,
I've macroized logic patterns. Please have a look. Is it ok for trunk?

2014-08-25  Petr Murzin  

* config/i386/i386.md: Macroize logic patterns.


logic_patterns_patch
Description: Binary data


Re: [wwwdocs] Buildstat update for 4.8

2014-08-25 Thread Gerald Pfeifer
On Sat, 23 Aug 2014, Raghunath Lolur wrote:
> Please find an update of test results for 4.8.x
> 
> Test Results for 4.8.3:
>   aarch64-unknown-linux-gnu

Applied, thanks.

Gerald


Re: [wwwdocs] Update GCC5 changes.html

2014-08-25 Thread Gerald Pfeifer
On Fri, 22 Aug 2014, Marek Polacek wrote:
> Elsewhere in the code base I see mainly "pointer to integer" so I
> haven't changed this.

Sounds good.

> The following patch contains two more options: -Wc99-c11-compat and
> -Wbool-compare.
> 
> Ok?

Nice!  Thanks you.  

Oh, yes, okay.  Can you just check that lines are <80 columns?

Gerald


[PATCH] Fix libbacktrace and libiberty tests fail on sanitized GCC due to wrong link options.

2014-08-25 Thread Maxim Ostapenko

Hi,

When I ran Asan tests under Asan-bootstrapped GCC 5.0, I've noted, that 
tests for libiberty and libbacktrace fail to link with sanitized 
libbacktrace.a and libiberty.a because of missing -static-libasan 
-fsanitize=address linker flags.


This patch adds necessary flags to provide a linkage of these tests in 
bootstrap-asan case.


I've checked that regression tests pass with disabled bootstrap, normal 
bootstrap (stage1, stage3) and Asan-bootstrap (stage 1, stage3) on 
x86_64-pc-linux-gnu.


Does the patch look sane?

-Maxim
libiberty/ChangeLog:

2014-08-25  Max Ostapenko  

	* testsuite/Makefile.in(LIBCFLAGS): Add LDFLAGS.

ChangeLog:

2014-08-25  Max Ostapenko  

	* Makefile.in (EXTRA_HOST_EXPORTS): New variables.
	(EXTRA_BOOTSTRAP_FLAGS): Likewise.
	(check-libiberty): Add EXTRA_HOST_EXPORTS and EXTRA_BOOTSTRAP_FLAGS.
	(check-libbacktrace): Likewise.

diff --git a/Makefile.in b/Makefile.in
index add8cf6..93d48b8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -20541,8 +20541,9 @@ check-libbacktrace:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
+	$(EXTRA_HOST_EXPORTS) \
 	(cd $(HOST_SUBDIR)/libbacktrace && \
-	  $(MAKE) $(FLAGS_TO_PASS)  check)
+	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS)  check)
 
 @endif libbacktrace
 
@@ -23597,6 +23598,13 @@ clean-stagefeedback-libiberty:
 @endif libiberty-bootstrap
 
 
+@if gcc-bootstrap
+EXTRA_HOST_EXPORTS = if [ $(current_stage) != stage1 ]; then \
+	  $(POSTSTAGE1_HOST_EXPORTS) \
+	 fi ;
+
+EXTRA_BOOTSTRAP_FLAGS = CC="$$CC" CXX="$$CXX" LDFLAGS="$$LDFLAGS"
+@endif gcc-bootstrap
 
 
 
@@ -23610,8 +23618,9 @@ check-libiberty:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
+	$(EXTRA_HOST_EXPORTS) \
 	(cd $(HOST_SUBDIR)/libiberty && \
-	  $(MAKE) $(FLAGS_TO_PASS)  check)
+	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS)  check)
 
 @endif libiberty
 
diff --git a/libiberty/testsuite/Makefile.in b/libiberty/testsuite/Makefile.in
index d23c09c..ef693c2 100644
--- a/libiberty/testsuite/Makefile.in
+++ b/libiberty/testsuite/Makefile.in
@@ -33,7 +33,7 @@ SHELL = @SHELL@
 
 CC = @CC@
 CFLAGS = @CFLAGS@
-LIBCFLAGS = $(CFLAGS)
+LIBCFLAGS = $(CFLAGS) $(LDFLAGS)
 
 # Multilib support variables.
 MULTISRCTOP =