Re: [patch] libstdc++/61390 don't redeclare template-parameters

2014-08-04 Thread Jonathan Wakely

On 10/06/14 19:09 +0100, Jonathan Wakely wrote:

Yo dawg, I heard you like templates, so I renamed the
template-parameters of your template template-parameters so they are
not the same as the template-parameters of your templates.

G++ fails to diagnose this (PR17267) but Clang gives an error and EDG
gives a warning.

Tested x86_64-linux, committed to trunk.




PR libstdc++/61390
* include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
(bin_search_tree_traits): Do not redeclare template-parameters.
* testsuite/util/testsuite_iterators.h (test_container): Likewise.


Committed to the 4.9 branch too.


[PATCH] gcc/testsuite: Disable pr44194-1.c for BE Power64/Linux

2014-08-04 Thread Maciej W. Rozycki
Hi,

 The pr44194-1.c test case scores a failure invariably for big-endian 
Power64/Linux targets:

PASS: gcc.dg/pr44194-1.c (test for excess errors)
FAIL: gcc.dg/pr44194-1.c scan-rtl-dump dse1 global deletions = (2|3)
PASS: gcc.dg/pr44194-1.c scan-rtl-dump-not final insn[: ][^\n]*set 
\\(mem(?![^\n]*scratch)

because IIUC the case only makes sense for targets where functions return 
small structures in registers.

 For historical reasons this is not the case for Power/Linux targets, 
except from the newly-added 64-bit little-endian one (according to 
LINUX64_DEFAULT_ABI_ELFv2 defined in rs6000/sysv4le.h and then 
rs6000_return_in_memory) or where the `-mabi=elfv2' option has been used 
(that, regrettably, looks undetectable to me; there's no preprocessor 
macro defined one could use to tell the ABIs apart).  The test case 
already excludes 32-bit targets based on the implication none uses 
registers for struct returns (that is not entirely correct, though fixing 
it is beyond the scope of this change).

 These observations are reflected in the change below, that disables the 
test case for big-endian Power64/Linux targets while retaining it for 
little-endian ones.  As noted above there's no way to detect `-mabi=elfv2' 
being in effect, so the check for relevance is hardwired to the target 
triplet instead.  This makes the failure go away in my power-linux-gnu 
testing that includes a 64-bit big-endian multilib.  I have no way to test 
a 64-bit little-endian multilib, however I believe the change is obviously 
correct in this respect.

 This could get extended to cover other Power targets, as it seems to me 
there are more that should be excluded, however I don't feel comfortable 
enough with the intricacies of the Power configuration to dare changing 
anything for targets I have no way to test.

 OK to apply?

2014-08-04  Maciej W. Rozycki  ma...@codesourcery.com

gcc/testsuite/
* gcc.dg/pr44194-1.c: Also exclude powerpc*-*-linux*, but not
powerpc*le-*-linux*.

  Maciej

gcc-test-ppc-pr44194.diff
Index: gcc-fsf-trunk-quilt/gcc/testsuite/gcc.dg/pr44194-1.c
===
--- gcc-fsf-trunk-quilt.orig/gcc/testsuite/gcc.dg/pr44194-1.c   2014-05-16 
16:00:05.0 +0100
+++ gcc-fsf-trunk-quilt/gcc/testsuite/gcc.dg/pr44194-1.c2014-08-04 
17:54:23.648935358 +0100
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { { { { { { i?86-*-* x86_64-*-* }  x32 } || lp64 
}  { ! s390*-*-* } }  { ! hppa*64*-*-* } }  { ! alpha*-*-* } } } } */
+/* { dg-do compile { target { { { { { { { i?86-*-* x86_64-*-* }  x32 } || 
lp64 }  { ! s390*-*-* } }  { ! hppa*64*-*-* } }  { ! alpha*-*-* } }  { 
{ ! powerpc*-*-linux* } || { powerpc*le-*-linux* } } } } } */
 /* { dg-options -O2 -fdump-rtl-dse1 -fdump-rtl-final } */
 
 /* Restrict to 64-bit targets since 32-bit targets usually return small


Re: [patch] Add const to constexpr member functions

2014-08-04 Thread Jonathan Wakely

On 15/04/14 19:29 +0100, Jonathan Wakely wrote:

Add const to functions that would change meaning in C++14.

Tested x86_64-linux, committed to trunk.


Also committed to the 4.9 branch


* include/bits/atomic_base.h (__atomic_base_PTp*::_M_type_size): Add
const to constexpr member functions.


Re: [patch cp]: Check for keep-inline-dllexport that we are operating on true inlines

2014-08-04 Thread Jason Merrill

OK.

Jason


Re: {patch cp]: Disable hidden-inlines for pe-coff targets

2014-08-04 Thread Jason Merrill

On 08/04/2014 07:03 AM, Kai Tietz wrote:

 * decl2.c (determine_hidden_inline): Always fail for PE-COFF as
 there is no hidden visibility available.


I'd think we should give a warning about -fvisibility-inlines-hidden on 
windows and turn off the flag rather than silently ignore it here.


Jason



Invalid gimple for nested functions

2014-08-04 Thread Bernd Schmidt
Some code I added for the ptx backend triggered tree-checking failures 
for gimple created in tree-nested: we can end up taking the address of 
an SSA_NAME, which seems invalid. The problem is that code in 
tree-nested wants to change the rhs of an existing assignment, but just 
using gimple_assign_set_rhs1 is insufficient: the previous rhs was an 
ADDR_EXPR, and that code remains afterwards.


Fixed with the following patch, tested (including Ada) on x86_64-linux. Ok?


Bernd
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 5408fba..1afcf09 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -2738,6 +2738,7 @@ 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);
+	  gimple_assign_set_rhs_code (stmt, TREE_CODE (x));
 	}
 	}
 }


Re: [C++ Patch/RFC] PR 43906

2014-08-04 Thread Jason Merrill

On 08/04/2014 12:24 PM, Paolo Carlini wrote:

+  || (TYPE_PTR_P (type1)  VOID_TYPE_P (TREE_TYPE (type1))


Why check for VOID_TYPE_P?  I'd think we would want to warn about 
comparing to other null pointer values as well.


Jason



Re: Remove unnecessary and harmful fixincludes for Android

2014-08-04 Thread Joseph S. Myers
On Mon, 4 Aug 2014, Alexander Ivchenko wrote:

 +2014-08-04  Alexander Ivchenko  alexander.ivche...@intel.com
 +
 + * inclhack.def (stdio_va_list): Disable fix for *android*.

Testing for *android* is less than ideal, because of the possibility of 
configuring a *-linux* toolchain to have multilibs using various different 
C libraries (with -mandroid being used to select the Android multilib).  
So, specifying a bypass based on some relevant text that appears in the 
header would be better.

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


Re: Remove unnecessary and harmful fixincludes for Android

2014-08-04 Thread Andrew Pinski
On Mon, Aug 4, 2014 at 8:29 AM, Alexander Ivchenko aivch...@gmail.com wrote:
 Hi,

 The following patch disables stdio_va_list fix: stdio.h is already
 good in Android and, since ndk gcc is indented to be used with
 different Android sysroots, it is actually harmful, because without
 this fix only the version of stdio.h from the sysroot the compiler was
 built with will be used.

Isn't that why fixincludes is installed to run after the fact on sysroot?

Thanks,
Andrew Pinski



 complier_h_tradcpp fix is removed with this patch. This fix was made
 for Android, but it is outdated now. linux/compiler.h has been
 changed and the fix is not being applied anymore.


 diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
 index f7effee..19d70be 100644
 --- a/fixincludes/ChangeLog
 +++ b/fixincludes/ChangeLog
 @@ -1,3 +1,10 @@
 +2014-08-04  Alexander Ivchenko  alexander.ivche...@intel.com
 +
 + * inclhack.def (stdio_va_list): Disable fix for *android*.
 + (complier_h_tradcpp): Remove.
 + * fixincl.x: Regenerate.
 + * tests/base/linux/compiler.h: Remove.
 +
  2014-04-22  Rainer Orth  r...@cebitec.uni-bielefeld.de

   * inclhack.def (math_exception): Bypass on *-*-solaris2.1[0-9]*.
 diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
 index dd45802..8d6f1f2 100644
 --- a/fixincludes/fixincl.x
 +++ b/fixincludes/fixincl.x
 @@ -2,11 +2,11 @@
   *
   * DO NOT EDIT THIS FILE   (fixincl.x)
   *
 - * It has been AutoGen-ed  Tuesday January  7, 2014 at 12:02:54 PM MET
 + * It has been AutoGen-ed  August  4, 2014 at 07:07:22 PM by AutoGen 5.12
   * From the definitionsinclhack.def
   * and the template file   fixincl
   */
 -/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Jan  7 12:02:54 MET 2014
 +/* DO NOT SVN-MERGE THIS FILE, EITHER Mon Aug  4 19:07:23 MSK 2014
   *
   * You must regenerate it.  Use the ./genfixes script.
   *
 @@ -15,7 +15,7 @@
   * certain ANSI-incompatible system header files which are fixed to work
   * correctly with ANSI C and placed in a directory that GNU C will search.
   *
 - * This file contains 224 fixup descriptions.
 + * This file contains 223 fixup descriptions.
   *
   * See README for more information.
   *
 @@ -2111,41 +2111,6 @@ int vfscanf(FILE *, const char *,
 __builtin_va_list) __asm__ (_BSD_STRING(__USER

  /* * * * * * * * * * * * * * * * * * * * * * * * * *
   *
 - *  Description of Complier_H_Tradcpp fix
 - */
 -tSCC zComplier_H_TradcppName[] =
 - complier_h_tradcpp;
 -
 -/*
 - *  File name selection pattern
 - */
 -tSCC zComplier_H_TradcppList[] =
 -  linux/compiler.h\0;
 -/*
 - *  Machine/OS name selection pattern
 - */
 -#define apzComplier_H_TradcppMachs (const char**)NULL
 -
 -/*
 - *  content selection pattern - do fix if pattern found
 - */
 -tSCC zComplier_H_TradcppSelect0[] =
 -   #define __builtin_warning\\(x, y\\.\\.\\.\\) \\(1\\);
 -
 -#defineCOMPLIER_H_TRADCPP_TEST_CT  1
 -static tTestDesc aComplier_H_TradcppTests[] = {
 -  { TT_EGREP,zComplier_H_TradcppSelect0, (regex_t*)NULL }, };
 -
 -/*
 - *  Fix Command Arguments for Complier_H_Tradcpp
 - */
 -static const char* apzComplier_H_TradcppPatch[] = {
 -format,
 -/* __builtin_warning(x, y...) is obsolete */,
 -(char*)NULL };
 -
 -/* * * * * * * * * * * * * * * * * * * * * * * * * *
 - *
   *  Description of Ctrl_Quotes_Def fix
   */
  tSCC zCtrl_Quotes_DefName[] =
 @@ -7228,6 +7193,7 @@ tSCC zStdio_Va_ListList[] =
   */
  tSCC* apzStdio_Va_ListMachs[] = {
  *-*-solaris2.1[0-9]*,
 +*android*,
  (const char*)NULL };

  /*
 @@ -9187,9 +9153,9 @@ static const char* apzX11_SprintfPatch[] = {
   *
   *  List of all fixes
   */
 -#define REGEX_COUNT  261
 +#define REGEX_COUNT  260
  #define MACH_LIST_SIZE_LIMIT 187
 -#define FIX_COUNT224
 +#define FIX_COUNT223

  /*
   *  Enumerate the fixes
 @@ -9242,7 +9208,6 @@ typedef enum {
  BROKEN_CABS_FIXIDX,
  BROKEN_NAN_FIXIDX,
  BSD_STDIO_ATTRS_CONFLICT_FIXIDX,
 -COMPLIER_H_TRADCPP_FIXIDX,
  CTRL_QUOTES_DEF_FIXIDX,
  CTRL_QUOTES_USE_FIXIDX,
  CXX_UNREADY_FIXIDX,
 @@ -9657,11 +9622,6 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
   BSD_STDIO_ATTRS_CONFLICT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
   aBsd_Stdio_Attrs_ConflictTests,   apzBsd_Stdio_Attrs_ConflictPatch, 0 },

 -  {  zComplier_H_TradcppName,zComplier_H_TradcppList,
 - apzComplier_H_TradcppMachs,
 - COMPLIER_H_TRADCPP_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
 - aComplier_H_TradcppTests,   apzComplier_H_TradcppPatch, 0 },
 -
{  zCtrl_Quotes_DefName,zCtrl_Quotes_DefList,
   apzCtrl_Quotes_DefMachs,
   CTRL_QUOTES_DEF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
 diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
 index 6a1136c..cd3ad2d 100644
 --- a/fixincludes/inclhack.def
 +++ b/fixincludes/inclhack.def
 @@ -1140,20 +1140,6 @@ fix = {
  };

  /*
 - *  Old Linux kernel's compiler.h header breaks Traditional CPP
 - */
 -fix = {
 -hackname  = 

Re: [PATCH] gcc/testsuite: Disable pr44194-1.c for BE Power64/Linux

2014-08-04 Thread Joseph S. Myers
On Mon, 4 Aug 2014, Maciej W. Rozycki wrote:

 except from the newly-added 64-bit little-endian one (according to 
 LINUX64_DEFAULT_ABI_ELFv2 defined in rs6000/sysv4le.h and then 
 rs6000_return_in_memory) or where the `-mabi=elfv2' option has been used 
 (that, regrettably, looks undetectable to me; there's no preprocessor 
 macro defined one could use to tell the ABIs apart).  The test case 

The preprocessor macro is _CALL_ELF (defined to 1 or 2 depending on the 
64-bit ABI variant in use, or not defined at all for other ABIs).

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


Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation

2014-08-04 Thread Bernd Schmidt

On 07/23/2014 04:37 PM, Ilya Verbin wrote:

On 23 Jul 16:16, Bernd Schmidt wrote:

Here's the latest version, which fixes some more issues and removes
things that are now unnecessary. Configure scripts and toplevel
autogenned stuff is left out and must be regenerated.

Are you OK with me installing this on gomp-4_0-branch? If there's
any other changes related to the build system that you require,
could you send me a patch on top of this so that we can converge on
the final shape?


OK.
Looks like we do not need anything more for the build system.


I've committed this version to gomp-4_0-branch. This also includes the 
additional 'g' for the sed command you noticed.



Bernd


Index: ChangeLog.gomp
===
--- ChangeLog.gomp	(revision 213606)
+++ ChangeLog.gomp	(working copy)
@@ -1,3 +1,14 @@
+2014-08-04  Bernd Schmidt  ber...@codesourcery.com
+
+	* Makefile.def (accel-gcc host module): Remove, and all of its
+	dependencies too.
+	* Makefile.in: Regenerate.
+	* configure.ac (host_tools): Remove accel-gcc.
+	(enable-accelerator): Remove handling for this option.
+	(enable-offload-targets): Handle this instead.
+	(configdirs): Revert previous changes.
+	* configure: Regenerate.
+
 2014-06-12  Thomas Schwinge  tho...@codesourcery.com
 
 	* configure.ac (--enable-target-gcc-configure-flags)
Index: Makefile.def
===
--- Makefile.def	(revision 213606)
+++ Makefile.def	(working copy)
@@ -46,10 +46,6 @@ host_modules= { module= gas; bootstrap=t
 host_modules= { module= gcc; bootstrap=true; 
 		extra_configure_flags='@extra_target_gcc_configure_flags@';
 		extra_make_flags=$(EXTRA_GCC_FLAGS) $(EXTRA_TARGET_GCC_FLAGS); };
-host_modules= { module= accel-gcc;
-	module_srcdir=gcc;
-		extra_configure_flags='--enable-as-accelerator-for=$(target_alias) @extra_accelerator_gcc_configure_flags@';
-		extra_make_flags=$(EXTRA_ACCELERATOR_GCC_FLAGS); };
 host_modules= { module= gmp; lib_path=.libs; bootstrap=true;
 		extra_configure_flags='--disable-shared';
 		no_install= true;
@@ -322,7 +318,6 @@ dependencies = { module=all-gcc; on=all-
 dependencies = { module=all-gcc; on=all-mpfr; };
 dependencies = { module=all-gcc; on=all-mpc; };
 dependencies = { module=all-gcc; on=all-cloog; };
-dependencies = { module=all-gcc; on=all-accel-gcc; };
 dependencies = { module=all-gcc; on=all-build-texinfo; };
 dependencies = { module=all-gcc; on=all-build-bison; };
 dependencies = { module=all-gcc; on=all-build-flex; };
@@ -335,24 +330,6 @@ dependencies = { module=all-gcc; on=all-
 dependencies = { module=all-gcc; on=all-libiberty; };
 dependencies = { module=all-gcc; on=all-fixincludes; };
 dependencies = { module=all-gcc; on=all-lto-plugin; };
-dependencies = { module=all-accel-gcc; on=all-libiberty; hard=true; };
-dependencies = { module=all-accel-gcc; on=all-intl; };
-dependencies = { module=all-accel-gcc; on=all-mpfr; };
-dependencies = { module=all-accel-gcc; on=all-mpc; };
-dependencies = { module=all-accel-gcc; on=all-cloog; };
-dependencies = { module=all-accel-gcc; on=all-accel-gcc; };
-dependencies = { module=all-accel-gcc; on=all-build-texinfo; };
-dependencies = { module=all-accel-gcc; on=all-build-bison; };
-dependencies = { module=all-accel-gcc; on=all-build-flex; };
-dependencies = { module=all-accel-gcc; on=all-build-libiberty; };
-dependencies = { module=all-accel-gcc; on=all-build-fixincludes; };
-dependencies = { module=all-accel-gcc; on=all-zlib; };
-dependencies = { module=all-accel-gcc; on=all-libbacktrace; hard=true; };
-dependencies = { module=all-accel-gcc; on=all-libcpp; hard=true; };
-dependencies = { module=all-accel-gcc; on=all-libdecnumber; hard=true; };
-dependencies = { module=all-accel-gcc; on=all-libiberty; };
-dependencies = { module=all-accel-gcc; on=all-fixincludes; };
-dependencies = { module=all-accel-gcc; on=all-lto-plugin; };
 dependencies = { module=info-gcc; on=all-build-libiberty; };
 dependencies = { module=dvi-gcc; on=all-build-libiberty; };
 dependencies = { module=pdf-gcc; on=all-build-libiberty; };
Index: Makefile.in
===
--- Makefile.in	(revision 213606)
+++ Makefile.in	(working copy)
@@ -899,7 +899,6 @@ configure-host:  \
 maybe-configure-flex \
 maybe-configure-gas \
 maybe-configure-gcc \
-maybe-configure-accel-gcc \
 maybe-configure-gmp \
 maybe-configure-mpfr \
 maybe-configure-mpc \
@@ -1020,7 +1019,6 @@ all-host: maybe-all-gas
 @if gcc-no-bootstrap
 all-host: maybe-all-gcc
 @endif gcc-no-bootstrap
-all-host: maybe-all-accel-gcc
 @if gmp-no-bootstrap
 all-host: maybe-all-gmp
 @endif gmp-no-bootstrap
@@ -1152,7 +1150,6 @@ info-host: maybe-info-fixincludes
 info-host: maybe-info-flex
 info-host: maybe-info-gas
 info-host: maybe-info-gcc
-info-host: maybe-info-accel-gcc
 info-host: maybe-info-gmp
 info-host: maybe-info-mpfr
 info-host: maybe-info-mpc
@@ -1237,7 

Re: [C++ Patch/RFC] PR 43906

2014-08-04 Thread Paolo Carlini

Hi,

On 08/04/2014 10:45 PM, Jason Merrill wrote:

On 08/04/2014 12:24 PM, Paolo Carlini wrote:

+   || (TYPE_PTR_P (type1)  VOID_TYPE_P (TREE_TYPE (type1))


Why check for VOID_TYPE_P?  I'd think we would want to warn about 
comparing to other null pointer values as well.
In fact I wondered about that a few minutes after sending my message... 
And this is what I figured out: normally we have hard errors from 
composite_pointer_type (eg, try scalar types, class types), even for 
null values. The only exception I have been able to find earlier today 
is that of pointer to the same function type, eg:


extern void z();
typedef void (*ptr)();
void i() { if ( z != (ptr)0 ); }

but in this case the C front-end too doesn't warn. In short, the case of 
(void*)0 seems very special.


However, something I did *not* notice earlier today, is that comparing a 
pointer to function to a generic void* leads to a pedwarn at the 
beginning of composite_pointer_type about the comparison itself. Thus 
it's debatable whether we also want the -Waddress warning... If you ask 
me, closing the bug with a testcase which checks that we warn for 
-pedantic about the comparison (if we don't have one already) would be 
Ok (vs EDG 4.9 too) What do you think?


Paolo.



[PING][Patch]Fix ICE for gcc.dg/noncompile/920507-1.c

2014-08-04 Thread Tony Wang
Ping, any comment and suggestion on this bug fix?

 -Original Message-
 From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches-
 ow...@gcc.gnu.org] On Behalf Of Tony Wang
 Sent: Tuesday, July 29, 2014 10:31 AM
 To: gcc-patches@gcc.gnu.org; 'Richard Biener'; 'Jakub Jelinek'
 Subject: [Patch]Fix ICE for gcc.dg/noncompile/920507-1.c
 
 Hi there,
 
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61330.
 There will be an ICE in gcc trunk for targets support section anchor
 optimization when compiling this case(like arm and mips). This looks like
an

The target should be aarch64, arm, powerpc, alpha

 old bug which is exposed by recent patch.
 
 In make_decl_rtl, when you declare register type incorrectly like
register int
 *a asm(unknown register);, the compiler will raise an error messge but
 doesn't return directly. It will continue to run into the rtx generation
code for
 general variable declaration and generate a wrong rtx:(symbol_ref:SI...).
So I
 just remove the else condition which used to be the rtx generation part
for
 correctly declared register type, and let all the register type
declaration(no
 matter it declared correct or not) go through it and generate the same
type
 of rtx:(reg:SI...).
 
 gcc/ChangeLog:
 
 2014-07-29  Tony Wang  tony.w...@arm.com
 
 * gcc/varasm.c (make_decl_rtl): Remove the else condition
   for properly declared static register variables.
 
 diff --git a/gcc/varasm.c b/gcc/varasm.c index 819ec26..a6fae0c 100644
 --- a/gcc/varasm.c
 +++ b/gcc/varasm.c
 @@ -1333,45 +1333,42 @@ make_decl_rtl (tree decl)
error (register specified for %q+D isn%'t suitable for
data type,
 decl);
/* Now handle properly declared static register variables.  */
 -  else
 -  {
 -int nregs;
 +  int nregs;
 
 -if (DECL_INITIAL (decl) != 0  TREE_STATIC (decl))
 -  {
 -DECL_INITIAL (decl) = 0;
 -error (global register variable has initial value);
 -  }
 -if (TREE_THIS_VOLATILE (decl))
 -  warning (OPT_Wvolatile_register_var,
 -   optimization may eliminate reads
and/or
 
 -   writes to register variables);
 +  if (DECL_INITIAL (decl) != 0  TREE_STATIC (decl))
 +{
 +   DECL_INITIAL (decl) = 0;
 +   error (global register variable has initial value);
 +}
 +  if (TREE_THIS_VOLATILE (decl))
 +warning (OPT_Wvolatile_register_var,
 + optimization may eliminate reads and/or 
 +  writes to register variables);
 
 -/* If the user specified one of the eliminables registers
 here,
 -   e.g., FRAME_POINTER_REGNUM, we don't want to get this
 variable
 -   confused with that register and be eliminated.  This
 usage is
 -   somewhat suspect...  */
 +  /* If the user specified one of the eliminables registers here,
 + e.g., FRAME_POINTER_REGNUM, we don't want to get this variable
 + confused with that register and be eliminated.  This usage is
 + somewhat suspect...  */
 
 -SET_DECL_RTL (decl, gen_rtx_raw_REG (mode, reg_number));
 -ORIGINAL_REGNO (DECL_RTL (decl)) = reg_number;
 -REG_USERVAR_P (DECL_RTL (decl)) = 1;
 +  SET_DECL_RTL (decl, gen_rtx_raw_REG (mode, reg_number));
 +  ORIGINAL_REGNO (DECL_RTL (decl)) = reg_number;
 +  REG_USERVAR_P (DECL_RTL (decl)) = 1;
 
 -if (TREE_STATIC (decl))
 -  {
 -/* Make this register global, so not usable for
 anything
 -  else.  */
 +  if (TREE_STATIC (decl))
 +{
 +  /* Make this register global, so not usable for anything
 + else.  */
 #ifdef ASM_DECLARE_REGISTER_GLOBAL
 -name = IDENTIFIER_POINTER (DECL_NAME (decl));
 -ASM_DECLARE_REGISTER_GLOBAL (asm_out_file, decl,
 reg_number, name);
 +  name = IDENTIFIER_POINTER (DECL_NAME (decl));
 +  ASM_DECLARE_REGISTER_GLOBAL (asm_out_file, decl, reg_number,
 + name);
 #endif
 -nregs = hard_regno_nregs[reg_number][mode];
 -while (nregs  0)
 -  globalize_reg (decl, reg_number + --nregs);
 -  }
 +  nregs = hard_regno_nregs[reg_number][mode];
 +  while (nregs  0)
 +globalize_reg (decl, reg_number + --nregs);
 +}
 
 -/* As a register variable, it has no section.  */
 -return;
 -  }
 +  /* As a register variable, it has no section.  */
 +  return;
  }
/* Now handle ordinary static variables and functions (in memory).
   Also handle vars declared register invalidly.  */
 
 BR,
 Tony




Re: [C++ Patch/RFC] PR 43906

2014-08-04 Thread Jason Merrill

On 08/04/2014 07:01 PM, Paolo Carlini wrote:

In fact I wondered about that a few minutes after sending my message...
And this is what I figured out: normally we have hard errors from
composite_pointer_type (eg, try scalar types, class types), even for
null values. The only exception I have been able to find earlier today
is that of pointer to the same function type, eg:

extern void z();
typedef void (*ptr)();
void i() { if ( z != (ptr)0 ); }

but in this case the C front-end too doesn't warn.


I don't see why we wouldn't want to warn in this case; it's still the 
case thet the comparison will always be false.


We can also see this situation for non-function pointers:

void f()
{
  int i;
  if (i != (int*)0);
}

Jason



Go patch committed: Fix test of 64-bit index on 32-bit system

2014-08-04 Thread Ian Lance Taylor
This patch to the Go frontend changes it to not cast an index expression
to int before checking whether the value is in bounds.  This fixes PR
61866: on a 32-bit system, casting an int64 index to int drops the upper
32 bits of the value, and thus can cause an out-of-range index to appear
to be in range.

This undoes part of change 1318:fa6e0c716dba
(https://codereview.appspot.com/104610044) and therefore breaks PR 61308
again.  I have a separate patch for that, coming soon
(http://codereview.appspot.com/122020043).  In addition to undoing part
of that change, this patch adds code to avoid a compiler crash.  This
changes PR 61308 from a compiler crash to an incorrect error message.

Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r 8263b1ea5ea9 go/expressions.cc
--- a/go/expressions.cc	Mon Aug 04 10:53:47 2014 -0700
+++ b/go/expressions.cc	Mon Aug 04 17:20:19 2014 -0700
@@ -3620,6 +3620,16 @@
   return Expression::make_error(this-location());
 }
 
+  // Check for an invalid pointer dereference.  We need to do this
+  // here because Unary_expression::do_type will return an error type
+  // in this case.  That can cause code to appear erroneous, and
+  // therefore disappear at lowering time, without any error message.
+  if (op == OPERATOR_MULT  expr-type()-points_to() == NULL)
+{
+  this-report_error(_(expected pointer));
+  return Expression::make_error(this-location());
+}
+
   if (op == OPERATOR_PLUS || op == OPERATOR_MINUS || op == OPERATOR_XOR)
 {
   Numeric_constant nc;
@@ -9811,7 +9821,10 @@
 
   Type* type = left-type();
   if (type-is_error())
-return Expression::make_error(location);
+{
+  go_assert(saw_errors());
+  return Expression::make_error(location);
+}
   else if (left-is_type_expression())
 {
   error_at(location, attempt to index type expression);
@@ -10298,9 +10311,9 @@
   go_assert(saw_errors());
   return context-backend()-error_expression();
 }
-  Expression* start_expr = Expression::make_cast(int_type, this-start_, loc);
+
   Bexpression* bad_index =
-Expression::check_bounds(start_expr, loc)-get_backend(context);
+Expression::check_bounds(this-start_, loc)-get_backend(context);
 
   Bexpression* start = this-start_-get_backend(context);
   start = gogo-backend()-convert_expression(int_btype, start, loc);


Go patch committed: Fix enclosing vars for func type in func lit

2014-08-04 Thread Ian Lance Taylor
This patch to the Go frontend fixes a dumb bug in which the enclosing
vars were incorrectly cleared when a function literal contains a
reference to a function type.  The test for this has been committed to
the master repository: http://codereview.appspot.com/121200043 .  This
fixes PR 61308.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline and 4.9 branch.

Ian

diff -r d7e00d7c498b go/parse.cc
--- a/go/parse.cc	Mon Aug 04 19:56:11 2014 -0700
+++ b/go/parse.cc	Mon Aug 04 19:58:30 2014 -0700
@@ -2870,7 +2870,10 @@
   // For a function literal, the next token must be a '{'.  If we
   // don't see that, then we may have a type expression.
   if (!this-peek_token()-is_op(OPERATOR_LCURLY))
-return Expression::make_type(type, location);
+{
+  hold_enclosing_vars.swap(this-enclosing_vars_);
+  return Expression::make_type(type, location);
+}
 
   bool hold_is_erroneous_function = this-is_erroneous_function_;
   if (fntype_is_error)


[GSoC] the separate option for all dimensions

2014-08-04 Thread Roman Gareev
I've attached the patch, which sets the separate option for all
dimensions. Is it fine for trunk?


-- 
Cheers, Roman Gareev.
2014-08-05  Roman Gareev  gareevro...@gmail.com

[gcc/]

* graphite-isl-ast-to-gimple.c:
(set_options): New function.
(scop_to_isl_ast): Add calling of set_options.
Index: gcc/graphite-isl-ast-to-gimple.c
===
--- gcc/graphite-isl-ast-to-gimple.c(revision 213619)
+++ gcc/graphite-isl-ast-to-gimple.c(working copy)
@@ -867,6 +867,25 @@
   return id;
 }
 
+/* Set the separate option for all dimensions.
+   This helps to reduce control overhead.  */
+
+static __isl_give isl_ast_build *
+set_options (__isl_take isl_ast_build *control,
+__isl_keep isl_union_map *schedule)
+{
+  isl_ctx *ctx = isl_union_map_get_ctx (schedule);
+  isl_space *range_space = isl_space_set_alloc (ctx, 0, 1);
+  range_space =
+isl_space_set_tuple_name (range_space, isl_dim_set, separate);
+  isl_union_set *range =
+isl_union_set_from_set (isl_set_universe (range_space));  
+  isl_union_set *domain = isl_union_map_range (isl_union_map_copy (schedule));
+  domain = isl_union_set_universe (domain);
+  isl_union_map *options = isl_union_map_from_domain_and_range (domain, range);
+  return isl_ast_build_set_options (control, options);
+}
+
 static __isl_give isl_ast_node *
 scop_to_isl_ast (scop_p scop, ivs_params ip)
 {
@@ -879,6 +898,7 @@
   add_parameters_to_ivs_params (scop, ip);
   isl_union_map *schedule_isl = generate_isl_schedule (scop);
   isl_ast_build *context_isl = generate_isl_context (scop);
+  context_isl = set_options (context_isl, schedule_isl);
   isl_union_map *dependences = NULL;
   if (flag_loop_parallelize_all)
   {


<    1   2