Re: [Patch, vrp] Allow VRP type conversion folding only for widenings upto word mode

2015-11-14 Thread Marc Glisse

On Sat, 14 Nov 2015, Senthil Kumar Selvaraj wrote:


This patch came out of a discussion held in the gcc mailing list
(https://gcc.gnu.org/ml/gcc/2015-11/msg00067.html).

The patch restricts folding of conditional exprs with lhs previously
set by a type conversion to occur only if the source of the type
conversion's mode is word mode or smaller.

Bootstrapped and reg tested on x86_64 (with --enable-languages=c,c++).

If ok, could you commit please? I don't have commit access.

Regards
Senthil

gcc/ChangeLog

2015-11-11  Senthil Kumar Selvaraj  

* tree-vrp.c (simplify_cond_using_ranges): Fold only
if innerop's mode is word_mode or smaller.


diff --git gcc/tree-vrp.c gcc/tree-vrp.c
index e2393e4..c139bc6 100644
--- gcc/tree-vrp.c
+++ gcc/tree-vrp.c
@@ -9467,6 +9467,8 @@ simplify_cond_using_ranges (gcond *stmt)
  innerop = gimple_assign_rhs1 (def_stmt);

  if (TREE_CODE (innerop) == SSA_NAME
+ && (GET_MODE_SIZE(TYPE_MODE(TREE_TYPE(innerop)))
+   <= GET_MODE_SIZE(word_mode))
  && !POINTER_TYPE_P (TREE_TYPE (innerop)))
{
  value_range *vr = get_value_range (innerop);


I thought the result of the discussion was that the transformation is ok 
if either it is narrowing or it widens but to something no bigger than 
word_mode. So you should have 2 comparisons, or 1 with a max.


--
Marc Glisse


Re: [PATCH] Fix PR ipa/68311

2015-11-14 Thread Christophe Lyon
On 13 November 2015 at 13:17, Richard Biener  wrote:
> On Fri, Nov 13, 2015 at 1:04 PM, Martin Liška  wrote:
>> Hello.
>>
>> Following patch fixes PR68311, can regbootstrap on x86_64-linux-gnu.
>>
>> Ready for trunk?
>
> Please use
>
>  auto_vec  newclasses;
>
> as it gets you a stack allocation.  Also use quick_push as you know the vector
> is large enough.
>
> Ok with that changes.
>
> Richard.
>
Hi,

This patch broke the GCC build for armeb in libgfortran:
/tmp/9046893_7.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgfortran/generated/matmul_i4.c:
In function 'matmul_i4':
/tmp/9046893_7.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgfortran/generated/matmul_i4.c:79:1:
internal compiler error: in vectorizable_load, at tree-vect-s
tmts.c:6711
 matmul_i4 (gfc_array_i4 * const restrict retarray,
 ^

0xcff5d2 vectorizable_load

/tmp/9046893_7.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-vect-stmts.c:6711
0xd06955 vect_transform_stmt(gimple*, gimple_stmt_iterator*, bool*,
_slp_tree*, _slp_instance*)

/tmp/9046893_7.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-vect-stmts.c:8002
0xd0ec21 vect_transform_loop(_loop_vec_info*)

/tmp/9046893_7.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-vect-loop.c:6793
0xd317c9 vectorize_loops()

/tmp/9046893_7.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-vectorizer.c:533
Please submit a full bug report,



>> Thanks,
>> Martin


[OpenACC] C, C++: bind and nohost clauses

2015-11-14 Thread Thomas Schwinge
Hi!

Initial support for the OpenACC bind and nohost clauses (routine
directive) for C, C++.  Fortran to follow.  Middle end handling and more
complete testsuite coverage also to follow once we got a few details
clarified.  OK for trunk?

commit 96ca3e7fd643a67282a05750799bb78d4c634a71
Author: Thomas Schwinge 
Date:   Fri Nov 13 14:36:57 2015 +0100

[OpenACC] C, C++: bind and nohost clauses

-MM-DD  Thomas Schwinge  
Joseph Myers  

gcc/
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_BIND and
OMP_CLAUSE_NOHOST.
* tree.c (omp_clause_num_ops, omp_clause_code_name): Add entries
for these.
(walk_tree_1): Handle these.
* gimplify.c (gimplify_scan_omp_clauses)
(gimplify_adjust_omp_clauses): Likewise.
* omp-low.c (scan_sharing_clauses): Likewise.
* tree-pretty-print.c (dump_omp_clause): Likewise.
* tree.h (OMP_CLAUSE_BIND_NAME): New macro.

-MM-DD  Thomas Schwinge  
Joseph Myers  

gcc/c-family/
* c-pragma.h (enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_BIND
and PRAGMA_OACC_CLAUSE_NOHOST.

-MM-DD  Thomas Schwinge  
Joseph Myers  

gcc/c/
* c-parser.c (c_parser_omp_clause_name): Handle "bind" and
"nohost".
(c_parser_oacc_clause_bind): New function.
(c_parser_oacc_all_clauses): Handle PRAGMA_OACC_CLAUSE_BIND and
PRAGMA_OACC_CLAUSE_NOHOST.
(OACC_ROUTINE_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_BIND and
PRAGMA_OACC_CLAUSE_NOHOST.
* c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE_BIND and
OMP_CLAUSE_NOHOST.

-MM-DD  Thomas Schwinge  
Cesar Philippidis  

gcc/cp/
* parser.c (cp_parser_omp_clause_name): Handle "bind" and
"nohost".
(cp_parser_oacc_clause_bind): New function.
(cp_parser_oacc_all_clauses): Handle PRAGMA_OACC_CLAUSE_BIND and
PRAGMA_OACC_CLAUSE_NOHOST.
(OACC_ROUTINE_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_BIND and
PRAGMA_OACC_CLAUSE_NOHOST.
* pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND and
OMP_CLAUSE_NOHOST.
* semantics.c (finish_omp_clauses): Likewise.

-MM-DD  Thomas Schwinge  
Joseph Myers  

gcc/testsuite/
* c-c++-common/goacc/routine-1.c: Extend.
---
 gcc/c-family/c-pragma.h  |  2 +
 gcc/c/c-parser.c | 55 --
 gcc/c/c-typeck.c |  2 +
 gcc/cp/parser.c  | 70 ++--
 gcc/cp/pt.c  |  2 +
 gcc/cp/semantics.c   |  2 +
 gcc/gimplify.c   |  4 ++
 gcc/omp-low.c|  4 ++
 gcc/testsuite/c-c++-common/goacc/routine-1.c | 40 +++-
 gcc/tree-core.h  |  6 +++
 gcc/tree-pretty-print.c  |  9 
 gcc/tree.c   |  6 +++
 gcc/tree.h   |  3 ++
 13 files changed, 198 insertions(+), 7 deletions(-)

diff --git gcc/c-family/c-pragma.h gcc/c-family/c-pragma.h
index afeceff..ccb8ddf 100644
--- gcc/c-family/c-pragma.h
+++ gcc/c-family/c-pragma.h
@@ -147,6 +147,7 @@ enum pragma_omp_clause {
   /* Clauses for OpenACC.  */
   PRAGMA_OACC_CLAUSE_ASYNC = PRAGMA_CILK_CLAUSE_VECTORLENGTH + 1,
   PRAGMA_OACC_CLAUSE_AUTO,
+  PRAGMA_OACC_CLAUSE_BIND,
   PRAGMA_OACC_CLAUSE_COPY,
   PRAGMA_OACC_CLAUSE_COPYOUT,
   PRAGMA_OACC_CLAUSE_CREATE,
@@ -155,6 +156,7 @@ enum pragma_omp_clause {
   PRAGMA_OACC_CLAUSE_GANG,
   PRAGMA_OACC_CLAUSE_HOST,
   PRAGMA_OACC_CLAUSE_INDEPENDENT,
+  PRAGMA_OACC_CLAUSE_NOHOST,
   PRAGMA_OACC_CLAUSE_NUM_GANGS,
   PRAGMA_OACC_CLAUSE_NUM_WORKERS,
   PRAGMA_OACC_CLAUSE_PRESENT,
diff --git gcc/c/c-parser.c gcc/c/c-parser.c
index 2484b92..384b395 100644
--- gcc/c/c-parser.c
+++ gcc/c/c-parser.c
@@ -9978,6 +9978,10 @@ c_parser_omp_clause_name (c_parser *parser)
  else if (!strcmp ("async", p))
result = PRAGMA_OACC_CLAUSE_ASYNC;
  break;
+   case 'b':
+ if (!strcmp ("bind", p))
+   result = PRAGMA_OACC_CLAUSE_BIND;
+ break;
case 'c':
  if (!strcmp ("collapse", p))
result = PRAGMA_OMP_CLAUSE_COLLAPSE;
@@ -10053,6 +10057,10 @@ c_parser_omp_clause_name (c_parser *parser)
case 'n':
  if (!strcmp ("nogroup", p))
result = PRAGMA_OMP_CLAUSE_NOGROUP;
+ else if (!strcmp ("nohost", p))
+   result = PRAGMA_OACC_CLAUSE_NOHOST;
+ else if (flag_cilkplus && !strcmp ("nomask", p))
+   result = PRAGMA_CILK_CLAUSE_NOMASK;
  else if (!strcmp ("notinbranch", p))
result = PRAGMA_OMP_CLAUSE_NOTINBRANCH;
  else if (!strcmp ("nowait", p))
@@ -10067,8 +10075,6 @

Re: [PATCH] Enable libstdc++ numeric conversions on Cygwin

2015-11-14 Thread Christophe Lyon
On 13 November 2015 at 15:52, Jonathan Wakely  wrote:
> On 12/11/15 13:39 +, Jonathan Wakely wrote:
>>
>> On 12/11/15 11:40 +, Jonathan Wakely wrote:
>>>
>>> On 18/09/15 12:01 -0400, Jennifer Yao wrote:

 Forgot to include the patch.

 On Fri, Sep 18, 2015 at 11:17 AM, Jennifer Yao
  wrote:
>
> A number of functions in libstdc++ are guarded by the _GLIBCXX_USE_C99
> preprocessor macro, which is only defined on systems that pass all of
> the checks for a large set of C99 functions. Consequently, on systems
> which lack any of the required C99 facilities (e.g. Cygwin, which
> lacks some C99 complex math functions), the numeric conversion
> functions (std::stoi(), std::stol(), std::to_string(), etc.) are not
> defined—a rather silly outcome, as none of the numeric conversion
> functions are implemented using C99 math functions.
>
> This patch enables numeric conversion functions on the aforementioned
> systems by splitting the checks for C99 support and defining several
> new macros (_GLIBCXX_USE_C99_STDIO, _GLIBCXX_USE_C99_STDLIB, and
> _GLIBCXX_USE_C99_WCHAR), which replace the use of _GLIBCXX_USE_C99 in
> #if conditionals where appropriate.
>>>
>>>
>>> (Coming back to this now that Jennifer's copyright assignment is
>>> complete...)
>>>
>>> Splitting the _GLIBCXX_USE_C99 macro into more fine-grained macros for
>>> separate features is definitely the right direction.
>>>
>>> However your patch also changes the configure tests to use -std=c++0x
>>> (which should be -std=c++11, but that's a minor point). On an OS that
>>> only makes the C99 library available conditionally that will mean that
>>> configure determines that C99 library features are supported, but we
>>> will get errors if we try to use those features in C++03 parts of the
>>> library.
>>>
>>> I think a more complete solution is to have two sets of configure
>>> tests and two sets of macros, so that we define _GLIBCXX_USE_C99_STDIO
>>> when C99 stdio is available unconditionally, and define
>>> _GLIBCXX11_USE_C99_STDIO when it's available with -std=c++11.
>>>
>>> Then in the library code we can check _GLIBCXX_USE_C99_STDIO if we
>>> want to use C99 features in C++03 code, and check
>>> _GLIBCXX11_USE_C99_STDIO if we want to use the features in C++11 code.
>>>
>>> That should still solve the problem for the numeric conversion
>>> functions, because they are defined in C++11 and so would check
>>> _GLIBCXX11_USE_C99_STDIO, which will be defined for newlib.
>>>
>>> Other pieces of the library, such as locales, will use
>>> _GLIBCXX_USE_C99_STDIO and that might still be false for newlib (and
>>> for other strict C libraries like the Solaris and FreeBSD libc).
>>>
>>> I will make the changes to acinclude.m4 to duplicate the tests, so we
>>> test once with -std=c++98 and once with -std=c++11, and then change
>>> the library to check either _GLIBCXX_xxx or _GLIBCXX11_xxx as
>>> appropriate.
>>
>>
>> Here's a patch implementing my suggestion.
>>
>> The major changes since Jennifer's original patch are in acinclude.m4,
>> to do the autoconf tests once with -std=c++98 and again with
>> -std=c++11, and in include/bits/c++config to define the
>> _GLIBCXX_USE_C99_XXX macros according to either _GLIBCXX98_USE_CXX_XXX
>> or _GLIBCXX11_USE_CXX_XXX, depending on the standard mode in effect
>> when the file is included.
>>
>> Because those new definitions in bits/c++config are unconditional I
>> had to adjust a few #ifdef tests to use #if instead.
>>
>> I also removed the changes to GLIBCXX_CHECK_C99_TR1, so that there are
>> no changes to the macros used for the TR1 library. As a follow-up
>> change I will add a test for  to GLIBCXX_ENABLE_C99 and
>> change several C++ headers to stop using the TR1 macros.
>>
>> This passes all tests on powerpc64le-linux, I'll also try to test on
>> DragonFly and FreeBSD.
>
>
> That patch was wrong, the new macros in include/bits/c++config used
> "CSTDIO" instead of "STDIO" so it caused several tests to go from
> PASS to UNSUPPORTED, oops!
>
> This is the correct version, tested again more carefully, on
> powerpc64le-linux and powerpc-aix and x86_64-dragonfly.
>
> Committed to trunk.
>

Hi, this commit makes the GCC build to fail for targets using newlib
(I tested arm-none-eabi and aarch64-none-elf)

I'm seeing errors such as:
In file included from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/string:52:0,
 from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/bits/locale_classes.h:40,
 from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/bits/ios_base.h:41,
 from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-el

Re: [Patch, vrp] Allow VRP type conversion folding only for widenings upto word mode

2015-11-14 Thread Senthil Kumar Selvaraj
On Sat, Nov 14, 2015 at 09:13:41AM +0100, Marc Glisse wrote:
> On Sat, 14 Nov 2015, Senthil Kumar Selvaraj wrote:
> 
> >This patch came out of a discussion held in the gcc mailing list
> >(https://gcc.gnu.org/ml/gcc/2015-11/msg00067.html).
> >
> >The patch restricts folding of conditional exprs with lhs previously
> >set by a type conversion to occur only if the source of the type
> >conversion's mode is word mode or smaller.
> >
> >Bootstrapped and reg tested on x86_64 (with --enable-languages=c,c++).
> >
> >If ok, could you commit please? I don't have commit access.
> >
> >Regards
> >Senthil
> >
> >gcc/ChangeLog
> >
> >2015-11-11  Senthil Kumar Selvaraj  
> >
> > * tree-vrp.c (simplify_cond_using_ranges): Fold only
> > if innerop's mode is word_mode or smaller.
> >
> >
> >diff --git gcc/tree-vrp.c gcc/tree-vrp.c
> >index e2393e4..c139bc6 100644
> >--- gcc/tree-vrp.c
> >+++ gcc/tree-vrp.c
> >@@ -9467,6 +9467,8 @@ simplify_cond_using_ranges (gcond *stmt)
> >  innerop = gimple_assign_rhs1 (def_stmt);
> >
> >  if (TREE_CODE (innerop) == SSA_NAME
> >+ && (GET_MODE_SIZE(TYPE_MODE(TREE_TYPE(innerop)))
> >+   <= GET_MODE_SIZE(word_mode))
> >   && !POINTER_TYPE_P (TREE_TYPE (innerop)))
> > {
> >   value_range *vr = get_value_range (innerop);
> 
> I thought the result of the discussion was that the transformation is ok if
> either it is narrowing or it widens but to something no bigger than
> word_mode. So you should have 2 comparisons, or 1 with a max.

Hmm, I came to the opposite conclusion - I thought Richard only okayed
"widening upto word-mode", not the narrowing. 

Richard?

Regards
Senthil
> 
> -- 
> Marc Glisse


Re: [Patch, vrp] Allow VRP type conversion folding only for widenings upto word mode

2015-11-14 Thread Richard Biener
On November 14, 2015 9:49:28 AM GMT+01:00, Senthil Kumar Selvaraj 
 wrote:
>On Sat, Nov 14, 2015 at 09:13:41AM +0100, Marc Glisse wrote:
>> On Sat, 14 Nov 2015, Senthil Kumar Selvaraj wrote:
>> 
>> >This patch came out of a discussion held in the gcc mailing list
>> >(https://gcc.gnu.org/ml/gcc/2015-11/msg00067.html).
>> >
>> >The patch restricts folding of conditional exprs with lhs previously
>> >set by a type conversion to occur only if the source of the type
>> >conversion's mode is word mode or smaller.
>> >
>> >Bootstrapped and reg tested on x86_64 (with
>--enable-languages=c,c++).
>> >
>> >If ok, could you commit please? I don't have commit access.
>> >
>> >Regards
>> >Senthil
>> >
>> >gcc/ChangeLog
>> >
>> >2015-11-11  Senthil Kumar Selvaraj 
>
>> >
>> >* tree-vrp.c (simplify_cond_using_ranges): Fold only
>> >if innerop's mode is word_mode or smaller.
>> >
>> >
>> >diff --git gcc/tree-vrp.c gcc/tree-vrp.c
>> >index e2393e4..c139bc6 100644
>> >--- gcc/tree-vrp.c
>> >+++ gcc/tree-vrp.c
>> >@@ -9467,6 +9467,8 @@ simplify_cond_using_ranges (gcond *stmt)
>> >  innerop = gimple_assign_rhs1 (def_stmt);
>> >
>> >  if (TREE_CODE (innerop) == SSA_NAME
>> >+ && (GET_MODE_SIZE(TYPE_MODE(TREE_TYPE(innerop)))
>> >+   <= GET_MODE_SIZE(word_mode))
>> >  && !POINTER_TYPE_P (TREE_TYPE (innerop)))
>> >{
>> >  value_range *vr = get_value_range (innerop);
>> 
>> I thought the result of the discussion was that the transformation is
>ok if
>> either it is narrowing or it widens but to something no bigger than
>> word_mode. So you should have 2 comparisons, or 1 with a max.
>
>Hmm, I came to the opposite conclusion - I thought Richard only okayed
>"widening upto word-mode", not the narrowing. 

I didn't mean to suggest narrowing is not OK.  In fact narrowing is always OK.

Richard.

>Richard?
>
>Regards
>Senthil
>> 
>> -- 
>> Marc Glisse




[Ada] PR ada/68345

2015-11-14 Thread Arnaud Charlet
This is a mechanical change made blindly since I do not have access to
a dragonfly system. Should fix PR ada/68345.

Committed on trunk.

2015-11-13  Arnaud Charlet  

PR ada/68345
* s-osinte-dragonfly.ads (Get_Page_Size): C function returns an int.

--
Index: s-osinte-dragonfly.ads
===
--- s-osinte-dragonfly.ads  (revision 230301)
+++ s-osinte-dragonfly.ads  (working copy)
@@ -330,8 +330,7 @@
--  returns the stack base of the specified thread. Only call this function
--  when Stack_Base_Available is True.
 
-   function Get_Page_Size return size_t;
-   function Get_Page_Size return Address;
+   function Get_Page_Size return int;
pragma Import (C, Get_Page_Size, "getpagesize");
--  Returns the size of a page
 


Re: [PATCH] Remove first_pass_instance from pass_vrp

2015-11-14 Thread Tom de Vries

On 13/11/15 14:57, Tom de Vries wrote:

I've implemented the set_arg scenario, though I've renamed it to
set_pass_param. I've also added a parameter number argument to
set_pass_param.

Furthermore, I've included the gdbhooks.py update.

OK for trunk if bootstrap and reg-test passes?



Bootstrap and reg-test on x86_64 succeeded.

OK for trunk?

Thanks,
- Tom


Btw, I think
   NEXT_PASS (pass_vrp, false /* warn_array_bounds_p */);
is now equivalent to
   NEXT_PASS (pass_vrp);
I'm not sure which one I prefer in passes.def.

Thanks,
- Tom


0003-Remove-first_pass_instance-from-pass_vrp.patch


Remove first_pass_instance from pass_vrp

2015-11-13  Tom de Vries

* gdbhooks.py (class PassNames): Handle extra arg NEXT_PASS argument.
* gen-pass-instances.awk (handle_line): Same.
* pass_manager.h (class pass_manager): Define and undefine
NEXT_PASS_WITH_ARG.
* passes.c (opt_pass::set_pass_param): New function.
(pass_manager::pass_manager): Define and undefine NEXT_PASS_WITH_ARG.
* passes.def: Add extra arg to NEXT_PASS (pass_vrp).
* tree-pass.h (gimple_opt::set_pass_param): Declare.
* tree-vrp.c (vrp_finalize, execute_vrp): Add and handle
warn_array_bounds_p parameter.
(pass_vrp::pass_vrp): Initialize warn_array_bounds_p.
(pass_vrp::set_pass_param): New function.
(pass_vrp::execute): Add warn_array_bounds_p arg to execute_vrp call.
(pass_vrp::warn_array_bounds_p): New private member.

---
  gcc/gdbhooks.py|  2 +-
  gcc/gen-pass-instances.awk | 28 +++-
  gcc/pass_manager.h |  2 ++
  gcc/passes.c   | 14 ++
  gcc/passes.def |  4 ++--
  gcc/tree-pass.h|  1 +
  gcc/tree-vrp.c | 20 ++--
  7 files changed, 57 insertions(+), 14 deletions(-)

diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index 2b9a94c..f920392 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -537,7 +537,7 @@ class PassNames:
  self.names = []
  with open(os.path.join(srcdir, 'passes.def')) as f:
  for line in f:
-m = re.match('\s*NEXT_PASS \((.+)\);', line)
+m = re.match('\s*NEXT_PASS \(([^,]+).*\);', line)
  if m:
  self.names.append(m.group(1))

diff --git a/gcc/gen-pass-instances.awk b/gcc/gen-pass-instances.awk
index 9cff429..106a2f6 100644
--- a/gcc/gen-pass-instances.awk
+++ b/gcc/gen-pass-instances.awk
@@ -61,12 +61,14 @@ function handle_line()
len_of_args = len_of_call - (len_of_start + len_of_close);
args_start_at = call_starts_at + len_of_start;
args_str = substr(line, args_start_at, len_of_args);
+   split(args_str, args, ",");

-   # Set pass_name argument
-   pass_name = args_str;
+   # Set pass_name argument, an optional with_arg argument
+   pass_name = args[1];
+   with_arg = args[2];

-   # Find call expression prefix (until and including called function)
-   len_of_prefix = args_start_at - 1 - len_of_open;
+   # Find call expression prefix
+   len_of_prefix = call_starts_at - 1;
prefix = substr(line, 1, len_of_prefix);

# Find call expression postfix
@@ -82,7 +84,23 @@ function handle_line()
pass_num = pass_counts[pass_name];

# Print call expression with extra pass_num argument
-   printf "%s(%s, %s)%s\n", prefix, pass_name, pass_num, postfix;
+   printf "%s", prefix;
+   if (with_arg)
+   {
+   printf "NEXT_PASS_WITH_ARG";
+   }
+   else
+   {
+   printf "NEXT_PASS";
+   }
+   printf " (";
+   printf "%s", pass_name;
+   printf ", %s", pass_num;
+   if (with_arg)
+   {
+   printf ", %s", with_arg;
+   }
+   printf ")%s\n", postfix;
  }

  { handle_line() }
diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h
index 7d539e4..a8199e2 100644
--- a/gcc/pass_manager.h
+++ b/gcc/pass_manager.h
@@ -120,6 +120,7 @@ private:
  #define PUSH_INSERT_PASSES_WITHIN(PASS)
  #define POP_INSERT_PASSES()
  #define NEXT_PASS(PASS, NUM) opt_pass *PASS ## _ ## NUM
+#define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM)
  #define TERMINATE_PASS_LIST()

  #include "pass-instances.def"
@@ -128,6 +129,7 @@ private:
  #undef PUSH_INSERT_PASSES_WITHIN
  #undef POP_INSERT_PASSES
  #undef NEXT_PASS
+#undef NEXT_PASS_WITH_ARG
  #undef TERMINATE_PASS_LIST

  }; // class pass_manager
diff --git a/gcc/passes.c b/gcc/passes.c
index dd8d00a..e634c5c 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -81,6 +81,13 @@ opt_pass::clone ()
internal_error ("pass %s does not support cloning", name);
  }

+void
+opt_pass::set_pass_param (unsigned int, bool)
+{
+  internal_error ("pass %s needs a set_pass_param implementation to handle the"
+ " extra argument in NEXT_PASS", name);
+}
+
  bool
  opt_pass::gate (function *)
  {
@@ -1572,6 +15

Re: [PATCH] g++.dg/init/vbase1.C and g++.dg/cpp/ucn-1.C

2015-11-14 Thread Andreas Schwab
David Edelsohn  writes:

> +  int c\u0024c;// { dg-error "not valid in an identifier" {
> target { powerpc-ibm-aix* } } }

FAIL: g++.dg/cpp/ucn-1.C  -std=gnu++11  target { powerpc-ibm-aix* }  (test for 
errors, line 12)

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


New Swedish PO file for 'gcc' (version 5.2.0)

2015-11-14 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the Swedish team of translators.  The file is available at:

http://translationproject.org/latest/gcc/sv.po

(This file, 'gcc-5.2.0.sv.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.




Re: [PATCH] g++.dg/init/vbase1.C and g++.dg/cpp/ucn-1.C

2015-11-14 Thread David Edelsohn
On Sat, Nov 14, 2015 at 5:16 AM, Andreas Schwab  wrote:
> David Edelsohn  writes:
>
>> +  int c\u0024c;// { dg-error "not valid in an identifier" {
>> target { powerpc-ibm-aix* } } }
>
> FAIL: g++.dg/cpp/ucn-1.C  -std=gnu++11  target { powerpc-ibm-aix* }  (test 
> for errors, line 12)

Argh.  So why isn't it limited to the specified target as the
documentation implies?

Thanks, David


Re: [patch] GSoC: Implement std::experimental::shared_ptr

2015-11-14 Thread David Edelsohn
The copy_ctor_neg testcase fails on AIX.

/nasfarm/edelsohn/src/src/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:
In function 'void test02()':
/nasfarm/edelsohn/src/src/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:50:44:
error: no matching function for call to 'st
d::experimental::fundamentals_v2::shared_ptr::shared_ptr(std::experimental::fundamentals_v2::shared_ptr&)'
In file included from
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/memory:46:0,
 from
/nasfarm/edelsohn/src/src/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:23:
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:772:7:
note: candidate: std::experimental::fundamentals_v2::sha
red_ptr<_Tp>::shared_ptr(const
std::experimental::fundamentals_v2::weak_ptr<_Tp>&, std::nothrow_t)
[with _Tp = A [2]]
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:772:7:
note:   candidate expects 2 arguments, 1 provided
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:763:7:
note: candidate: template
 
std::experimental::fundamentals_v2::shared_ptr<_Tp>::shared_ptr(std::_Sp_make_shared_tag,
const _Alloc&, _Args&& ...)
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:763:7:
note:   template argument deduction/substitution failed:
/nasfarm/edelsohn/src/src/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:50:44:
note:   candidate expects at least 2 argume
nts, 1 provided
In file included from
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/memory:46:0,
 from
/nasfarm/edelsohn/src/src/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:23:
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:706:17:
note: candidate: constexpr std::experimental::fundament
als_v2::shared_ptr<_Tp>::shared_ptr(std::nullptr_t) [with _Tp = A [2];
std::nullptr_t = std::nullptr_t]
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:706:17:
note:   no known conversion for argument 1 from 'std::e
xperimental::fundamentals_v2::shared_ptr' to 'std::nullptr_t'
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:703:2:
note: candidate: template
 
std::experimental::fundamentals_v2::shared_ptr<_Tp>::shared_ptr(std::unique_ptr<_Up,
_Ep>&&)
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:703:2:
note:   template argument deduction/substitution failed:
/nasfarm/edelsohn/src/src/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:50:44:
note:   'std::experimental::fundamentals_v2
::shared_ptr' is not derived from 'std::unique_ptr<_Tp, _Dp>'
In file included from
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/memory:46:0,
 from
/nasfarm/edelsohn/src/src/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:23:
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:696:2:
note: candidate: template std::experimental:
:fundamentals_v2::shared_ptr<_Tp>::shared_ptr(std::auto_ptr<_Up>&&)
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:696:2:
note:   template argument deduction/substitution failed:
/nasfarm/edelsohn/src/src/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:50:44:
note:   'std::experimental::fundamentals_v2
::shared_ptr' is not derived from 'std::auto_ptr<_Up>'
In file included from
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/memory:46:0,
 from
/nasfarm/edelsohn/src/src/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:23:
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:691:11:
note: candidate: template std::experimental
::fundamentals_v2::shared_ptr<_Tp>::shared_ptr(const
std::experimental::fundamentals_v2::weak_ptr<_Tp1>&)
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:691:11:
note:   template argument deduction/substitution failed
:
/nasfarm/edelsohn/src/src/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:50:44:
note:   'std::experimental::fundamentals_v2
::shared_ptr' is not derived from 'const
std::experimental::fundamentals_v2::weak_ptr<_Tp>'
In file included from
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/memory:46:0,
 from
/nasfarm/edelsohn/src/src/libstdc++-v3/testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:23:
/tmp/20151113/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/experimental/bits/shared_ptr.h:687:2:
note: candidate: template std::experi
mental

Re: [PATCH] g++.dg/init/vbase1.C and g++.dg/cpp/ucn-1.C

2015-11-14 Thread Jakub Jelinek
On Sat, Nov 14, 2015 at 08:09:44AM -0500, David Edelsohn wrote:
> On Sat, Nov 14, 2015 at 5:16 AM, Andreas Schwab  wrote:
> > David Edelsohn  writes:
> >
> >> +  int c\u0024c;// { dg-error "not valid in an identifier" {
> >> target { powerpc-ibm-aix* } } }
> >
> > FAIL: g++.dg/cpp/ucn-1.C  -std=gnu++11  target { powerpc-ibm-aix* }  (test 
> > for errors, line 12)
> 
> Argh.  So why isn't it limited to the specified target as the
> documentation implies?

Because there needs to be "" or some other string in between the regexp
and { target ... }.

Jakub


Re: [PATCH] g++.dg/init/vbase1.C and g++.dg/cpp/ucn-1.C

2015-11-14 Thread David Edelsohn
On Sat, Nov 14, 2015 at 8:30 AM, Jakub Jelinek  wrote:
> On Sat, Nov 14, 2015 at 08:09:44AM -0500, David Edelsohn wrote:
>> On Sat, Nov 14, 2015 at 5:16 AM, Andreas Schwab  
>> wrote:
>> > David Edelsohn  writes:
>> >
>> >> +  int c\u0024c;// { dg-error "not valid in an identifier" {
>> >> target { powerpc-ibm-aix* } } }
>> >
>> > FAIL: g++.dg/cpp/ucn-1.C  -std=gnu++11  target { powerpc-ibm-aix* }  (test 
>> > for errors, line 12)
>>
>> Argh.  So why isn't it limited to the specified target as the
>> documentation implies?
>
> Because there needs to be "" or some other string in between the regexp
> and { target ... }.

Fixed.  Sorry.

Thanks, David


Re: [PATCH] g++.dg/init/vbase1.C and g++.dg/cpp/ucn-1.C

2015-11-14 Thread Andreas Schwab
David Edelsohn  writes:

> On Sat, Nov 14, 2015 at 5:16 AM, Andreas Schwab  wrote:
>> David Edelsohn  writes:
>>
>>> +  int c\u0024c;// { dg-error "not valid in an identifier" {
>>> target { powerpc-ibm-aix* } } }
>>
>> FAIL: g++.dg/cpp/ucn-1.C  -std=gnu++11  target { powerpc-ibm-aix* }  (test 
>> for errors, line 12)
>
> Argh.  So why isn't it limited to the specified target as the
> documentation implies?

Where does it imply that?

# dg-error regexp comment [{ target/xfail selector } [{.|0|linenum}]]

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [patch] update locale support fro FreeBSD

2015-11-14 Thread Jonathan Wakely

On 13/11/15 15:28 +, Jonathan Wakely wrote:

On 12/11/15 23:32 +0100, Andreas Tobler wrote:

All,

with the work from Jennifer Yao and John Marino we can now update 
the locale support on FreeBSD to the level of DragonFly.


Results of this work can be found on the results list.

Here my small addendum to make it work on FreeBSD.

Is this ok for trunk? (Given that the work from Jennifer and John 
are committed before stage3?)


Those patches are now in.

I'm OK with this change for gcc6. It is an ABI change for FreeBSD, as
it changes the std::locale definitions, but as the target maintainer
you can decide if that's OK.



My mistake, this doesn't make any incompatible change at all, so is a
no-brainer IMHO. (I thought there was a change to where something got
deallocated, but that's only a local variable in the constructor).



Re: [patch] GSoC: Implement std::experimental::shared_ptr

2015-11-14 Thread Jonathan Wakely

On 14/11/15 08:19 -0500, David Edelsohn wrote:

I can provide the pre-processed source file if needed.


I should be able to fix it just from the errors - thanks.




Re: [PATCH] g++.dg/init/vbase1.C and g++.dg/cpp/ucn-1.C

2015-11-14 Thread David Edelsohn
On Sat, Nov 14, 2015 at 8:41 AM, Andreas Schwab  wrote:
> David Edelsohn  writes:
>
>> On Sat, Nov 14, 2015 at 5:16 AM, Andreas Schwab  
>> wrote:
>>> David Edelsohn  writes:
>>>
 +  int c\u0024c;// { dg-error "not valid in an identifier" {
 target { powerpc-ibm-aix* } } }
>>>
>>> FAIL: g++.dg/cpp/ucn-1.C  -std=gnu++11  target { powerpc-ibm-aix* }  (test 
>>> for errors, line 12)
>>
>> Argh.  So why isn't it limited to the specified target as the
>> documentation implies?
>
> Where does it imply that?
>
> # dg-error regexp comment [{ target/xfail selector } [{.|0|linenum}]]

That's not right either.

I incorrectly read it as

dg-error regexp [comment] [{ target/xfail selector} [line] }]

- David


Re: [PATCH] PR fortran/68283 -- remove a rogue gfc_internal_error()

2015-11-14 Thread Dominique d'Humières
Hi Steve,

Although I have not strong objection to your proposed patch, I’ld prefer the 
following one

--- ../_clean/gcc/fortran/primary.c 2015-10-18 13:07:28.0 +0200
+++ gcc/fortran/primary.c   2015-11-13 23:32:08.0 +0100
@@ -2194,7 +2194,7 @@ check_substring:
 symbol_attribute
 gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
 {
-  int dimension, codimension, pointer, allocatable, target, n;
+  int dimension, codimension, pointer, allocatable, target;
   symbol_attribute attr;
   gfc_ref *ref;
   gfc_symbol *sym;
@@ -2253,22 +2253,9 @@ gfc_variable_attr (gfc_expr *expr, gfc_t
  case AR_UNKNOWN:
/* If any of start, end or stride is not integer, there will
   already have been an error issued.  */
-   for (n = 0; n < ref->u.ar.as->rank; n++)
- {
-   int errors;
-   gfc_get_errors (NULL, &errors);
-   if (((ref->u.ar.start[n]
- && ref->u.ar.start[n]->ts.type == BT_UNKNOWN)
-||
-(ref->u.ar.end[n]
- && ref->u.ar.end[n]->ts.type == BT_UNKNOWN)
-||
-(ref->u.ar.stride[n]
- && ref->u.ar.stride[n]->ts.type == BT_UNKNOWN))
-   && errors > 0)
- break;
- }
-   if (n == ref->u.ar.as->rank)
+   int errors;
+   gfc_get_errors (NULL, &errors);
+   if (errors == 0)
  gfc_internal_error ("gfc_variable_attr(): Bad array reference");
  }
 
Now both patches are just papering over the real issues:

(1) Why is this block reached when compiling with -ffrontend-optimize, but not 
with -fno-frontend-optimize (Thomas)?
(2) Is there expected side effect(s) when removing the' for‘ block introduced 
at revision r221955 for pr56852 (Paul)?

Dominique



Re: [PATCH] Enable libstdc++ numeric conversions on Cygwin

2015-11-14 Thread Jonathan Wakely

On 14/11/15 09:37 +0100, Christophe Lyon wrote:

Hi, this commit makes the GCC build to fail for targets using newlib


Doh, this was supposed to *help* newlib!

I'll deal with it asap.


[PATCH] testsuite/experimental/random/randint.cc

2015-11-14 Thread David Edelsohn
Testcases that use TLS need additional options on some targets
(normall -pthread).  This fixes the testcase on AIX and Solaris.

Committed as obvious.

* testsuite/experimental/random/randint.cc: Add dg-add-options tls.

Index: testsuite/experimental/random/randint.cc
===
--- testsuite/experimental/random/randint.cc(revision 230347)
+++ testsuite/experimental/random/randint.cc(working copy)
@@ -1,5 +1,6 @@
 // { dg-options "-std=gnu++14" }
 // { dg-require-effective-target tls_runtime }
+// { dg-add-options tls }

 // Copyright (C) 2015 Free Software Foundation, Inc.
 //

Thanks, David


Re: libcpp/C FE source range patch committed (r230331).

2015-11-14 Thread David Edelsohn
This patch causes numerous new testsuite failure on AIX caused by the
compiler crashing during compilation, e.g.

gcc.c-torture/execute/20020206-1.c

in GCC libcpp

991   linemap_assert (line >= LINEMAPS_MACRO_LOWEST_LOCATION (set));

(gdb) where
#0  _Z11fancy_abortPKciS0_ (
file=0x11296dc0
<_GLOBAL__F__ZN9text_info9set_rangeEj12source_rangeb+3056>
"/nasfarm/edelsohn/src/src/libcpp/line-map.c", line=991,
function=0x11296f30
<_GLOBAL__F__ZN9text_info9set_rangeEj12source_rangeb+3424>
"linemap_macro_map_lookup")
at /nasfarm/edelsohn/src/src/gcc/diagnostic.c:1332
#1  0x100169b4 in _Z14linemap_lookupP9line_mapsj (set=0x7000, line=991)
at /nasfarm/edelsohn/src/src/libcpp/line-map.c:991
#2  0x100188f8 in
_Z40linemap_unwind_to_first_non_reserved_locP9line_mapsjPPK8line_map
(set=0x7000, loc=991, map=0x0)
at /nasfarm/edelsohn/src/src/libcpp/line-map.c:1629
#3  0x100753c8 in _ZL17expand_location_1jb (loc=889323520,
expansion_point_p=false) at /nasfarm/edelsohn/src/src/gcc/input.c:158
#4  0x10076488 in _Z48linemap_client_expand_location_to_spelling_pointj (
loc=991) at /nasfarm/edelsohn/src/src/gcc/input.c:751
#5  0x10019928 in _ZN13rich_location9add_rangeEjjb (this=0x2ff21cd8,
start=991, finish=889323520, show_caret_p=true)
at /nasfarm/edelsohn/src/src/libcpp/line-map.c:2012
#6  0x10019a54 in _ZN13rich_locationC2EP9line_mapsj (this=0x2ff21cd8,
set=0x3df, loc=287928112)
at /nasfarm/edelsohn/src/src/libcpp/line-map.c:2024
#7  0x1000ed84 in _Z7warningiPKcz (opt=164,
gmsgid=0x11488d18
<_GLOBAL__F__Z20prepare_call_addressP9tree_nodeP7rtx_defS2-
_PS2_ii+3752> "function call has aggregate value")
at /nasfarm/edelsohn/src/src/gcc/diagnostic.c:1003
#8  0x1067ebac in _Z11expand_callP9tree_nodeP7rtx_defi (exp=0x700dcf20,
target=0x700ec080, ignore=0) at /nasfarm/edelsohn/src/src/gcc/calls.c:2476
#9  0x10406858 in
_Z18expand_expr_real_1P9tree_nodeP7rtx_def12machine_mode15expand_modifierPS2_b
(exp=0x700dcf20, target=0x700ec080, tmode=BLKmode,
modifier=EXPAND_NORMAL, alt_rtl=0x17, inner_reference_p=false)
at /nasfarm/edelsohn/src/src/gcc/expr.c:10581
#10 0x104158c0 in _Z22store_expr_with_boundsP9tree_nodeP7rtx_defibbS0_ (
exp=0x700dcf20, target=0x700ec080, call_param_p=0, nontemporal=false,
reverse=false, btarget=0x700df058)
at /nasfarm/edelsohn/src/src/gcc/expr.c:5405
#11 0x104178fc in _Z17expand_assignmentP9tree_nodeS0_b (to=0x700df058,
from=0x700dcf20, nontemporal=false)
at /nasfarm/edelsohn/src/src/gcc/expr.c:5174
#12 0x106f67b4 in _ZL18expand_gimple_stmtP6gimple (stmt=0x7000e240)
at /nasfarm/edelsohn/src/src/gcc/cfgexpand.c:6278
#13 0x106f87d8 in _ZL25expand_gimple_basic_blockP15basic_block_defb (
bb=0x700c7740, disable_tail_calls=false)
at /nasfarm/edelsohn/src/src/gcc/cfgexpand.c:5679
#14 0x106ffbf4 in _ZN12_GLOBAL__N_111pass_expand7executeEP8function (
this=0x11296dc0
<_GLOBAL__F__ZN9text_info9set_rangeEj12source_rangeb+3056>,
fun=0x70009138) at /nasfarm/edelsohn/src/src/gcc/cfgexpand.c:6291


Re: [PATCH] PR fortran/68283 -- remove a rogue gfc_internal_error()

2015-11-14 Thread Thomas Koenig

Hi Dominique,


(1) Why is this block reached when compiling with -ffrontend-optimize, but not 
with -fno-frontend-optimize (Thomas)?


The problem here is that gfc_variable_attr is called (indirectly)
during optimize_assignment.  In this case, this causes the ICE
because of the existing error condition.

Here is the backtrace:

#0  gfc_internal_error (gmsgid=gmsgid@entry=0x14e4170 
"gfc_variable_attr(): Bad array reference") at 
../../trunk/gcc/fortran/error.c:1288
#1  0x0069f15a in gfc_variable_attr (expr=, 
ts=ts@entry=0x0) at ../../trunk/gcc/fortran/primary.c:2272
#2  0x0069f180 in gfc_expr_attr (e=e@entry=0x2162d20) at 
../../trunk/gcc/fortran/primary.c:2351
#3  0x006d50de in gfc_check_dependency (expr1=0x2162990, 
expr2=0x2162d20, identical=) at 
../../trunk/gcc/fortran/dependency.c:1292
#4  0x006d5043 in gfc_check_dependency (expr1=0x2162990, 
expr2=0x20da550, identical=true) at 
../../trunk/gcc/fortran/dependency.c:1260
#5  0x00770f8c in optimize_assignment (c=0x20da730) at 
../../trunk/gcc/fortran/frontend-passes.c:1162
#6  optimize_code (c=, walk_subtrees=, 
data=) at ../../trunk/gcc/fortran/frontend-passes.c:206



It might be worth not running the optimization when error conditions
exist.  I'll think about this.

However, I have no objection to just removing the gfc_internal_error.

Regards

Thomas


Re: [PATCH] Enable libstdc++ numeric conversions on Cygwin

2015-11-14 Thread Jonathan Wakely

On 14/11/15 09:37 +0100, Christophe Lyon wrote:

Hi, this commit makes the GCC build to fail for targets using newlib
(I tested arm-none-eabi and aarch64-none-elf)

I'm seeing errors such as:
In file included from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/string:52:0,
from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/bits/locale_classes.h:40,
from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/bits/ios_base.h:41,
from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/ios:42,
from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/istream:38,
from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/sstream:38,
from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/complex:45,
from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/ccomplex:38,
from
/tmp/9122162_8.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libstdc++-v3/include/precompiled/stdc++.h:52:
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/bits/basic_string.h:
In function 'long long int std::__cxx11::stoll(const wstring&,
std::size_t*, int)':
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/bits/basic_string.h:5524:31:
error: 'wcstoll' is not a member of 'std'
  { return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(),
  ^


This shouldn't be possible unless you're using --enable-cheaders=c
because we have an autoconf test for wcstoll, and if it's found then
it should get added to namespace std by .

Could you let me know the output of:

grep C_INCLUDE_DIR 
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/Makefile

Or alternatively:

ls -l 
/tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/cwchar



Re: [PATCH] PR fortran/68283 -- remove a rogue gfc_internal_error()

2015-11-14 Thread Steve Kargl
On Sat, Nov 14, 2015 at 02:51:08PM +0100, Dominique d'Humi??res wrote:
> Hi Steve,
> 
> Although I have not strong objection to your proposed patch,
> I???ld prefer the following one

The patch is fine.  Need a ChangeLog entry.

(patch elided)

>  
> Now both patches are just papering over the real issues:
> 
> (1) Why is this block reached when compiling with -ffrontend-optimize,
> but not with -fno-frontend-optimize (Thomas)?

I saw Thomas's reply.  Of course, -ffrontend-optimize takes a
different code path through the compiler and rewrites some of
the internal state along the way.  If the source code is fixed,
the ICE goes away.  Why waste time worrying about the cause of
an ICE that clearly should be suppressed in the presences of a
sequence of emitted errors?

> (2) Is there expected side effect(s) when removing the' for???
> block introduced at revision r221955 for pr56852 (Paul)?

I doubt that there are anything side effects.

-- 
Steve


Re: [PATCH] 21_strings/basic_string/capacity/wchar_t/18654.cc

2015-11-14 Thread Jonathan Wakely
On 14 November 2015 at 00:56, Jonathan Wakely  wrote:
> On 13 November 2015 at 23:53, David Edelsohn  wrote:
>> On Fri, Nov 13, 2015 at 1:40 PM, David Edelsohn  wrote:
>>> http://www.cplusplus.com/reference/string/basic_string/reserve/
>>>
>>> "Note that the resulting string capacity may be equal or greater than n."
>>>
>>> The current testcase verifies that the capacity is exactly equal to
>>> the length of the string or reserve value, but the standard allows the
>>> capacity to be larger.  On AIX, the capacity is larger and the
>>> testcase incorrectly fails.
>>>
>>> Linux x86-64:
>>> i: 4
>>> str.length: 4
>>> str.capacity: 4
>>> str.capacity: 12
>>> str.capacity: 8
>>> str.capacity: 4
>>>
>>> AIX:
>>> i: 4
>>> str.length: 4
>>> str.capacity: 7   <-- i
>>> str.capacity: 14  <-- i*3
>>> str.capacity: 8   <-- i*2
>>> str.capacity: 7   <-- default
>>>
>>> * 21_strings/basic_string/capacity/wchar_t/18654.cc: Verify the
>>
>> Jonathan,
>>
>> AIX has 2-byte wchar_t in 32 bit mode, which seems to be the cause of
>> all of the libstdc++ testsuite wchar_t failures.  If GCC libstdc++ is
>> suppose to shrink-to-fit, how should the testcases be fixed?
>
> It's shrink-to-fit, but not below a minimum size, which depends on
> sizeof(wchar_t).
>
> Something like 
> https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=63f5425911daddb9a328565cb0acc3b0f30144fa#patch81
> would work for both old and new string ABIs, I'll prepare an
> equivalent patch for the wchar_t test case.

This makes it adapt to the short-string buffer size, rather than
making an assumption about sizeof(wchar_t). Committed to trunk.

I'll have a look at the other wchar_t failures on AIX.
commit e907e5ca66e8a829eb5359c1b18e079ccd77f989
Author: Jonathan Wakely 
Date:   Sat Nov 14 16:57:17 2015 +

Fix std::wstring capacity test for short wchar_t

* testsuite/21_strings/basic_string/capacity/char/18654.cc: Use
real minimum capacity.
* testsuite/21_strings/basic_string/capacity/wchar_t/18654.cc:
Likewise.

diff --git 
a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/18654.cc 
b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/18654.cc
index 6944627..2198077 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/18654.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/char/18654.cc
@@ -38,7 +38,7 @@ void test01()
 
 #if _GLIBCXX_USE_CXX11_ABI
   // Can't shrink below small string size.
-  const size_type minsize = 2 << 3;
+  const size_type minsize = string().capacity() + 1;
 #else
   // Exact shrink-to-size and shrink-to-fit
   const size_type minsize = 2 << 0;
diff --git 
a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/18654.cc 
b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/18654.cc
index 3bd853a..d6202c9 100644
--- a/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/18654.cc
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/capacity/wchar_t/18654.cc
@@ -38,7 +38,7 @@ void test01()
 
 #if _GLIBCXX_USE_CXX11_ABI
   // Can't shrink below small string size.
-  const size_type minsize = 2 << 1;
+  const size_type minsize = wstring().capacity() + 1;
 #else
   // Exact shrink-to-size and shrink-to-fit
   const size_type minsize = 2 << 0;


Ping: [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs50221, 68216, 63932, 66408, 67674 and 49954

2015-11-14 Thread Paul Richard Thomas
Dear All,

I am completely unable to reproduce the problems that Dominique is
reporting for deferred_character_4.f90. This might be because the
patch has moved on to fix PR49554 :-)

Concatenation expressions assigned to deferred length character arrays
need careful handling to ensure that the temporary creation for the
concatenation operator occurs at the right place, that the descriptor
dtype is updated and an array temporary is created if there is any
dependency between lhs and rhs. This latter has been implemented in
resolve.c.

Testcases 4-6 have been added to reflect the additional fixes afforded
by the original patch, as reported by Dominique (thanks!).

As soon as this patch has been committed, I will prepare a version for
4.9 and 5 branches

Bootstrapped and regtested on FC21/x86_64 - OK for trunk?

Paul

2015-15-08  Paul Thomas  

PR fortran/50221
PR fortran/68216
PR fortran/63932
PR fortran/66408
* trans_array.c (gfc_conv_scalarized_array_ref): Pass the
symbol decl for deferred character length array references.
* trans-stmt.c (gfc_trans_allocate): Keep the string lengths
to update deferred length character string lengths.
* trans-types.c (gfc_get_dtype_rank_type); Use the string
length of deferred character types for the dtype size.
* trans.c (gfc_build_array_ref): For references to deferred
character arrays, use the domain max value, if it is a variable
to set the 'span' and use pointer arithmetic for acces to the
element.
(trans_code): Set gfc_current_locus for diagnostic purposes.

PR fortran/67674
* trans-expr.c (gfc_conv_procedure_call): Do not fix deferred
string lengths of components.

PR fortran/49954
* resolve.c (deferred_op_assign): New function.
(gfc_resolve_code): Call it.
* trans-array.c (concat_str_length): New function.
(gfc_alloc_allocatable_for_assignment): Jump directly to alloc/
realloc blocks for deferred character length arrays because the
string length might change, even if the shape is the same. Call
concat_str_length to obtain the string length for concatenation
since it is needed to compute the lhs string length.
Set the descriptor dtype appropriately for the new string
length.
* trans-expr.c (gfc_trans_assignment_1): Use the rse string
length for all characters, other than deferred types. For
concatenation operators, push the rse.pre block to the inner
most loop so that the temporary pointer and the assignments
are properly placed.

2015-15-08  Paul Thomas  

PR fortran/50221
* gfortran.dg/deferred_character_1.f90: New test.
* gfortran.dg/deferred_character_4.f90: New test for comment
#4 of the PR.

PR fortran/68216
* gfortran.dg/deferred_character_2.f90: New test.

PR fortran/67674
* gfortran.dg/deferred_character_3.f90: New test.

PR fortran/63932
* gfortran.dg/deferred_character_5.f90: New test.

PR fortran/66408
* gfortran.dg/deferred_character_6.f90: New test.

PR fortran/49954
* gfortran.dg/deferred_character_7.f90: New test.
Index: gcc/fortran/resolve.c
===
*** gcc/fortran/resolve.c   (revision 229953)
--- gcc/fortran/resolve.c   (working copy)
*** resolve_ptr_fcn_assign (gfc_code **code,
*** 10222,10227 
--- 10222,10271 
  }
  
  
+ /* Deferred character length assignments from an operator expression
+require a temporary because the character length of the lhs can
+change in the course of the assignment.  */
+ 
+ static bool
+ deferred_op_assign (gfc_code **code, gfc_namespace *ns)
+ {
+   gfc_expr *tmp_expr;
+   gfc_code *this_code;
+ 
+   if (!((*code)->expr1->ts.type == BT_CHARACTER
+&& (*code)->expr1->ts.deferred && (*code)->expr1->rank
+&& (*code)->expr2->expr_type == EXPR_OP))
+ return false;
+ 
+   if (!gfc_check_dependency ((*code)->expr1, (*code)->expr2, 1))
+ return false;
+ 
+   tmp_expr = get_temp_from_expr ((*code)->expr1, ns);
+   tmp_expr->where = (*code)->loc;
+ 
+   /* A new charlen is required to ensure that the variable string
+  length is different to that of the original lhs.  */
+   tmp_expr->ts.u.cl = gfc_get_charlen();
+   tmp_expr->symtree->n.sym->ts.u.cl = tmp_expr->ts.u.cl;
+   tmp_expr->ts.u.cl->next = (*code)->expr2->ts.u.cl->next;
+   (*code)->expr2->ts.u.cl->next = tmp_expr->ts.u.cl;
+ 
+   tmp_expr->symtree->n.sym->ts.deferred = 1;
+ 
+   this_code = build_assignment (EXEC_ASSIGN,
+   (*code)->expr1,
+   gfc_copy_expr (tmp_expr),
+   NULL, NULL, (*code)->loc);
+ 
+   (*code)->expr1 = tmp_expr;
+ 
+   this_code->next = (*code)->next;
+   (*code)->next = this_code;
+ 
+   return true;
+ }
+ 
+ 
  /* Given a block of code, recursively resolve everything pointed to by this
 code block.  */
  
*** start:
*** 10427,10432 **

Re: Ping: [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs50221, 68216, 63932, 66408, 67674 and 49954

2015-11-14 Thread Steve Kargl
On Sat, Nov 14, 2015 at 06:39:28PM +0100, Paul Richard Thomas wrote:
> 
> I am completely unable to reproduce the problems that Dominique is
> reporting for deferred_character_4.f90. This might be because the
> patch has moved on to fix PR49554 :-)
> 
> Concatenation expressions assigned to deferred length character arrays
> need careful handling to ensure that the temporary creation for the
> concatenation operator occurs at the right place, that the descriptor
> dtype is updated and an array temporary is created if there is any
> dependency between lhs and rhs. This latter has been implemented in
> resolve.c.
> 
> Testcases 4-6 have been added to reflect the additional fixes afforded
> by the original patch, as reported by Dominique (thanks!).
> 
> As soon as this patch has been committed, I will prepare a version for
> 4.9 and 5 branches
> 
> Bootstrapped and regtested on FC21/x86_64 - OK for trunk?
> 

Hi Paul,

I was going to cast an eye over your diff today.  I'll
build and run some tests on FreeBSD.  Dominiq uses 
MacOS.  So, perhaps, some latent memory corruption 
issue. 

-- 
steve


Re: [Patch, vrp] Allow VRP type conversion folding only for widenings upto word mode

2015-11-14 Thread Senthil Kumar Selvaraj
On Sat, Nov 14, 2015 at 09:57:40AM +0100, Richard Biener wrote:
> On November 14, 2015 9:49:28 AM GMT+01:00, Senthil Kumar Selvaraj 
>  wrote:
> >On Sat, Nov 14, 2015 at 09:13:41AM +0100, Marc Glisse wrote:
> >> On Sat, 14 Nov 2015, Senthil Kumar Selvaraj wrote:
> >> 
> >> >This patch came out of a discussion held in the gcc mailing list
> >> >(https://gcc.gnu.org/ml/gcc/2015-11/msg00067.html).
> >> >
> >> >The patch restricts folding of conditional exprs with lhs previously
> >> >set by a type conversion to occur only if the source of the type
> >> >conversion's mode is word mode or smaller.
> >> >
> >> >Bootstrapped and reg tested on x86_64 (with
> >--enable-languages=c,c++).
> >> >
> >> >If ok, could you commit please? I don't have commit access.
> >> >
> >> >Regards
> >> >Senthil
> >> >
> >> >gcc/ChangeLog
> >> >
> >> >2015-11-11  Senthil Kumar Selvaraj 
> >
> >> >
> >> >  * tree-vrp.c (simplify_cond_using_ranges): Fold only
> >> >  if innerop's mode is word_mode or smaller.
> >> >
> >> >
> >> >diff --git gcc/tree-vrp.c gcc/tree-vrp.c
> >> >index e2393e4..c139bc6 100644
> >> >--- gcc/tree-vrp.c
> >> >+++ gcc/tree-vrp.c
> >> >@@ -9467,6 +9467,8 @@ simplify_cond_using_ranges (gcond *stmt)
> >> >  innerop = gimple_assign_rhs1 (def_stmt);
> >> >
> >> >  if (TREE_CODE (innerop) == SSA_NAME
> >> >+ && (GET_MODE_SIZE(TYPE_MODE(TREE_TYPE(innerop)))
> >> >+   <= GET_MODE_SIZE(word_mode))
> >> >&& !POINTER_TYPE_P (TREE_TYPE (innerop)))
> >> >  {
> >> >value_range *vr = get_value_range (innerop);
> >> 
> >> I thought the result of the discussion was that the transformation is
> >ok if
> >> either it is narrowing or it widens but to something no bigger than
> >> word_mode. So you should have 2 comparisons, or 1 with a max.
> >
> >Hmm, I came to the opposite conclusion - I thought Richard only okayed
> >"widening upto word-mode", not the narrowing. 
> 
> I didn't mean to suggest narrowing is not OK.  In fact narrowing is always OK.

My bad. Here's a revised patch that checks for both conditions, using
max as Marc suggested to limit to word_mode or narrowing conversions.

Bootstrapped and regtested for x86_64 with c and c++.

Is this ok? If yes, would you commit it
for me please? I don't have commit access.

gcc/ChangeLog
2015-11-14  Senthil Kumar Selvaraj  

* tree-vrp.c (simplify_cond_using_ranges): Fold only
if innerop's mode smaller or equal to word_mode or op0's mode.


diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index e2393e4..cfd90e7 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -9467,7 +9467,10 @@ simplify_cond_using_ranges (gcond *stmt)
   innerop = gimple_assign_rhs1 (def_stmt);
 
   if (TREE_CODE (innerop) == SSA_NAME
- && !POINTER_TYPE_P (TREE_TYPE (innerop)))
+ && !POINTER_TYPE_P (TREE_TYPE (innerop))
+ && (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (innerop)))
+   <= std::max (GET_MODE_SIZE (word_mode),
+GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (op0))
{
  value_range *vr = get_value_range (innerop);
 

Regards
Senthil
> 
> Richard.
> 
> >Richard?
> >
> >Regards
> >Senthil
> >> 
> >> -- 
> >> Marc Glisse
> 
> 


Re: Ping: [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs50221, 68216, 63932, 66408, 67674 and 49954

2015-11-14 Thread Paul Richard Thomas
Hi Steve,

Following an email from Dominique to me, I think not. In the course of
fixing PR49954, I put right the setting of the descriptor dtype. Since
this gets passed to the IO runtime, I think that this is the reason
for the difference in behaviour.

I think that another week of effort should put right gfortran's woes
with deferred characters. As well as concatenation problems that I
think I have fixed, parentheses cause instant death :-(

Cheers

Paul


On 14 November 2015 at 18:49, Steve Kargl
 wrote:
> On Sat, Nov 14, 2015 at 06:39:28PM +0100, Paul Richard Thomas wrote:
>>
>> I am completely unable to reproduce the problems that Dominique is
>> reporting for deferred_character_4.f90. This might be because the
>> patch has moved on to fix PR49554 :-)
>>
>> Concatenation expressions assigned to deferred length character arrays
>> need careful handling to ensure that the temporary creation for the
>> concatenation operator occurs at the right place, that the descriptor
>> dtype is updated and an array temporary is created if there is any
>> dependency between lhs and rhs. This latter has been implemented in
>> resolve.c.
>>
>> Testcases 4-6 have been added to reflect the additional fixes afforded
>> by the original patch, as reported by Dominique (thanks!).
>>
>> As soon as this patch has been committed, I will prepare a version for
>> 4.9 and 5 branches
>>
>> Bootstrapped and regtested on FC21/x86_64 - OK for trunk?
>>
>
> Hi Paul,
>
> I was going to cast an eye over your diff today.  I'll
> build and run some tests on FreeBSD.  Dominiq uses
> MacOS.  So, perhaps, some latent memory corruption
> issue.
>
> --
> steve



-- 
Outside of a dog, a book is a man's best friend. Inside of a dog it's
too dark to read.

Groucho Marx


Re: Ping: [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs50221, 68216, 63932, 66408, 67674 and 49954

2015-11-14 Thread Dominique d'Humières
Dear Paul,

Update with your latest patch. Using the following patch

--- /opt/gcc/work/gcc/testsuite/gfortran.dg/deferred_character_4.f90
2015-11-14 19:28:59.0 +0100
+++ deferred_character_4_db.f90 2015-11-14 19:43:55.0 +0100
@@ -21,6 +21,16 @@ program chk_alloc_string
 
 strings = [character(len=4) :: "A", "C", "ABCDE", "V", ""]
 
+print *, len(strings), size(strings, 1)
+do i = 1, size(strings, 1)
+  print *, "'",strings(i),"'"
+end do
+print *, "other print"
+print *, (strings(i), i= 1, size(strings, 1))
+print *, "'", strings(1),"' '", strings(2), "' '", strings(3), "' '", 
strings(4), "' '", strings(5), "'"
+print *, "'", strings, "'"
+print '(">",a,"<")', strings
+print '(">",a,"<")', strings(1:5)
 if (len(strings) .ne. 4) call abort
 if (size(strings, 1) .ne. 5) call abort
 if (any (strings .ne. [character(len=4) :: "A", "C", "ABCD", "V", 
""])) call abort

the output is now correct except the one for print '(">",a,"<")', strings(1:5) 
which is now

>A   <
>A   <
>A   <
>A   <
>A   <

It was correct with the previous patch.

Everything else looks good.

IMO the latest issue may be delayed after a commit!-)

Dominique

> Le 14 nov. 2015 à 19:25, Paul Richard Thomas  
> a écrit :
> 
> Hi Steve,
> 
> Following an email from Dominique to me, I think not. In the course of
> fixing PR49954, I put right the setting of the descriptor dtype. Since
> this gets passed to the IO runtime, I think that this is the reason
> for the difference in behaviour.
> 
> I think that another week of effort should put right gfortran's woes
> with deferred characters. As well as concatenation problems that I
> think I have fixed, parentheses cause instant death :-(
> 
> Cheers
> 
> Paul


C++ PATCH for bootstrap/68346 (bogus -Wtautological-compare)

2015-11-14 Thread Jason Merrill
With delayed folding we added folding for arguments to various warning 
functions, but that seems to be wrong for warn_tautological_cmp.  In 
general, it's a tricky call; probably better long run will be for the 
warning functions to do their own folding if that's what they want.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 941058d18590e5c524ca97ad57f9ffdfcfec0469
Author: jason 
Date:   Sat Nov 14 18:54:16 2015 +

	PR bootstrap/68346
	* call.c (build_new_op_1): Don't fold arguments to
	warn_tautological_cmp.

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

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 77c2936..8cdda62 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5741,7 +5741,7 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
 	maybe_warn_bool_compare (loc, code, fold (arg1),
  fold (arg2));
   if (complain & tf_warning && warn_tautological_compare)
-	warn_tautological_cmp (loc, code, fold (arg1), fold (arg2));
+	warn_tautological_cmp (loc, code, arg1, arg2);
   /* Fall through.  */
 case PLUS_EXPR:
 case MINUS_EXPR:
diff --git a/gcc/testsuite/g++.dg/warn/Wtautological-compare.C b/gcc/testsuite/g++.dg/warn/Wtautological-compare.C
new file mode 100644
index 000..451fd54
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wtautological-compare.C
@@ -0,0 +1,7 @@
+// PR bootstrap/68346
+// { dg-options -Wtautological-compare }
+
+bool f(unsigned u)
+{
+  return ((unsigned)(int)u == u);
+}


[PATCH][WIP] libstdc++: Make certain exceptions transaction_safe.

2015-11-14 Thread Torvald Riegel
The attached patch makes some exceptions transaction-safe, as require by
the Transactional Memory TS.  It has some rough edges, but I'm hoping I
can sort them out quickly using your feedback.  It only supports
logic_error and exception/bad_exception, but the other exceptions that
the TM TS specifies as transaction-safe basically require the same
support (notably, runtime_error is the same as logic_error, and their
subclasses don't add anything).

There are two things that complicate such support.  First, it seems
better to not rely on -fgnu-tm of libstdc++ code for now (or at least we
tried to avoid this so far).  Therefore, the transactional clones in
this patch are all manually instrumented (ie, the functions are C
functions with names matching the mangled names of the respective C++
functions, and the _ZGTt prefix signaling that they are txnal clones).

Second, exceptions still use a COW string internally, which cannot be
made transaction-safe with just compiler support because of the
reference counting implementation inside of COW strings, which uses
atomics.  One would need something custom for that nonetheless.

Thus, the patch adds txnal clones as required.  They are new exported
symbols, but not visible to nontransactional code.  The only changes to
headers is transaction_safe[_dynamic] annotations where required by the
TS, and a few friend declarations.  The annotaitons are only enabled if
a user compiles with -fgnu-tm.  IOW, the changes are pretty much
invisible when not using the TM TS.

The patch doesn't include tests yet, but tests like this one seem to run
successfully on x86_64:

template void thrower4(const string& what)
{
  try
{
  // Creating a temporary inside of the txn ICEs.
  T t(what);
  atomic_commit
  {
_ITM_hackOrTxnProp (pr_atomicCancel);
dontoptimize (t.what());
throw T (what);
  }
}
  catch (T ex)
{
  if (what != ex.what()) abort ();
}
}
thrower4 ("test");

I can't yet test the destructors because of issues on the compiler side.
There are also commented-out calls to _ITM_setAssociatedException in the
code, which exist to show how we plan to support transaction
cancellation through exceptions (which needs some more libitm support
and bugfixes on the compiler side).
commit e81080a01ab0daf2949a400c1a2d5077d37ba515
Author: Torvald Riegel 
Date:   Fri Nov 13 01:00:52 2015 +0100

libstdc++: Make certain exceptions transaction_safe.

diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 1b3184a..d902b03 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1876,6 +1876,12 @@ GLIBCXX_3.4.22 {
 _ZNSt6thread6_StateD[012]Ev;
 _ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE;
 
+# Support for the Transactional Memory TS (N4514)
+_ZGTtNSt11logic_errorC1EPKc;
+_ZGTtNSt11logic_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE;
+_ZGTtNKSt11logic_error4whatEv;
+_ZGTtNSt11logic_errorD1Ev;
+
 } GLIBCXX_3.4.21;
 
 # Symbols in the support library (libsupc++) have their own tag.
@@ -2107,6 +2113,12 @@ CXXABI_1.3.9 {
 # operator delete[](void*, std::size_t)
 _ZdaPv[jmy];
 
+# Support for the Transactional Memory TS (N4514)
+_ZGTtNKSt9exceptionD1Ev;
+_ZGTtNKSt9exception4whatEv;
+_ZGTtNKSt13bad_exceptionD1Ev;
+_ZGTtNKSt13bad_exception4whatEv;
+
 } CXXABI_1.3.8;
 
 # Symbols in the support library (libsupc++) supporting transactional memory.
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index b3853cd..47d9f2f 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -4904,6 +4904,18 @@ _GLIBCXX_END_NAMESPACE_CXX11
   int
   compare(size_type __pos, size_type __n1, const _CharT* __s,
 	  size_type __n2) const;
+
+# ifdef _GLIBCXX_TM_TS_INTERNAL
+  friend void
+  ::_txnal_cow_string_C1_for_exceptions(void* that, const char* s,
+	void* exc);
+  friend const char*
+  ::_txnal_cow_string_c_str(const void *that);
+  friend void
+  ::_txnal_cow_string_D1(void *that);
+  friend void
+  ::_txnal_cow_string_D1_commit(void *that);
+# endif
   };
 #endif  // !_GLIBCXX_USE_CXX11_ABI
 
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 723feb1..0e66bb0 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -481,6 +481,17 @@ namespace std
 # define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
 # define _GLIBCXX_END_EXTERN_C }
 
+// Conditionally enable annotations for the Transactional Memory TS on C++11.
+#if __cplusplus >= 201103L && \
+  _GLIBCXX_USE_CXX11_ABI && _GLIBCXX_USE_DUAL_ABI && \
+  defined(__cpp_transactional_memory) && __cpp_transactional_memory >= 201505L
+#define _GLIBCXX_TXN_SAFE transaction_safe
+#define _GLIBCXX_TXN_SAFE_DYN trans

Re: Ping: [Patch, fortran] Bug 68241 - [meta-bug] Deferred-length character - PRs50221, 68216, 63932, 66408, 67674 and 49954

2015-11-14 Thread Steve Kargl
On Sat, Nov 14, 2015 at 07:25:29PM +0100, Paul Richard Thomas wrote:
> 
> Following an email from Dominique to me, I think not. In the course of
> fixing PR49954, I put right the setting of the descriptor dtype. Since
> this gets passed to the IO runtime, I think that this is the reason
> for the difference in behaviour.
> 
> I think that another week of effort should put right gfortran's woes
> with deferred characters. As well as concatenation problems that I
> think I have fixed, parentheses cause instant death :-(
> 

Hi Paul,

I built and tested on both x86_64-*-freebsd and i386-*-freebsd.
All tests passed.

I read through the patch did not raise any red (or what
the heck is he doing here) flags.

OK to commit as this is a step in the right direction in
dealing with deferred character issues.

-- 
Steve


[wwwdocs] isocpp.org now uses https

2015-11-14 Thread Gerald Pfeifer
Applied.

Gerald

Index: gcc-5/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.130
diff -u -r1.130 changes.html
--- gcc-5/changes.html  10 Nov 2015 10:53:58 -  1.130
+++ gcc-5/changes.html  14 Nov 2015 20:41:51 -
@@ -282,7 +282,7 @@
attribute, __has_attribute, has been added.
The equivalent built-in macro __has_cpp_attribute was
added to C++ to support
-   http://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations";>
+   https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations";>
Feature-testing recommendations for C++.
The macro __has_attribute is added to all C-like
languages as an extension:
@@ -376,7 +376,7 @@
   prevents excessive diagnostics that usually do not help to identify the
   problem.
   G++ and libstdc++ now implement the feature-testing macros from
-http://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations";>Feature-testing
+https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations";>Feature-testing
 recommendations for C++.
   G++ now allows typename in a template template parameter.
 
Index: projects/cxx1y.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/projects/cxx1y.html,v
retrieving revision 1.26
diff -u -r1.26 cxx1y.html
--- projects/cxx1y.html 30 Sep 2015 09:01:44 -  1.26
+++ projects/cxx1y.html 14 Nov 2015 20:41:51 -
@@ -61,7 +61,7 @@
 
 
   Return type deduction for normal functions
-  http://isocpp.org/files/papers/N3638.html";>N3638
+  https://isocpp.org/files/papers/N3638.html";>N3638
   
4.8 (N3386)
4.9 (N3638)
@@ -70,7 +70,7 @@
 
 
   Generalized lambda capture (init-capture)
-  http://isocpp.org/files/papers/N3648.html";>N3648
+  https://isocpp.org/files/papers/N3648.html";>N3648
   
4.5 (partial)
4.9 (N3648)
@@ -79,7 +79,7 @@
 
 
   Generic (polymorphic) lambda expressions
-  http://isocpp.org/files/papers/N3649.html";>N3649
+  https://isocpp.org/files/papers/N3649.html";>N3649
   
4.9
   
@@ -88,7 +88,7 @@
 
 
   Variable templates
-  http://isocpp.org/files/papers/N3651.pdf";>N3651
+  https://isocpp.org/files/papers/N3651.pdf";>N3651
   
5
   
@@ -97,7 +97,7 @@
 
 
   Relaxing requirements on constexpr functions
-  http://isocpp.org/files/papers/N3652.html";>N3652
+  https://isocpp.org/files/papers/N3652.html";>N3652
   
5
   
@@ -119,7 +119,7 @@
 
 
   Sized deallocation
-  http://isocpp.org/files/papers/n3778.html";>N3778
+  https://isocpp.org/files/papers/n3778.html";>N3778
   
5
   


[wwwdocs] gcc-4.8/changes.html: adjust AddressSanitizer link

2015-11-14 Thread Gerald Pfeifer
AddressSanitizer has moved from code.google.com to github.com.

Committed.

Gerald

Index: gcc-4.8/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.8/changes.html,v
retrieving revision 1.134
diff -u -r1.134 changes.html
--- gcc-4.8/changes.html23 Jun 2015 07:24:16 -  1.134
+++ gcc-4.8/changes.html14 Nov 2015 20:51:09 -
@@ -130,7 +130,7 @@
 inlining decisions (for example in the case of Fortran
 array descriptors) and devirtualization.
 
-https://code.google.com/p/address-sanitizer/";>AddressSanitizer
+https://github.com/google/sanitizers";>AddressSanitizer
, a fast memory error detector, has been added and can be
enabled via -fsanitize=address. Memory access
instructions will be instrumented to detect heap-, stack-, and


[wwwdocs] Remove dead reference from gcc-4.3/porting_to.html

2015-11-14 Thread Gerald Pfeifer
I tried to find a new URL, but failed.

Committed.

Gerald

Index: gcc-4.3/porting_to.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.3/porting_to.html,v
retrieving revision 1.12
diff -u -r1.12 porting_to.html
--- gcc-4.3/porting_to.html 28 Jun 2014 22:44:29 -  1.12
+++ gcc-4.3/porting_to.html 14 Nov 2015 20:53:00 -
@@ -525,10 +525,6 @@
 
 
 
-Martin Michlmayr, http://www.cyrius.com/journal/gcc";>GCC 4.3 related 
build problems
-
-
-
 Brian M. Carlson, http://crustytoothpaste.ath.cx/~bmc/blog/entries/";>GCC 4.3: Declaration 
of...Changes Meaning of...
 
 


[wwwdocs] projects/prefetch.html: change reference to mips.com

2015-11-14 Thread Gerald Pfeifer
...to a textual one (only), since mips.com itself redirects to
imgtec.com, which is not what was intended here.

Committed.

Gerald

Index: projects/prefetch.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/projects/prefetch.html,v
retrieving revision 1.26
diff -u -r1.26 prefetch.html
--- projects/prefetch.html  29 Jun 2015 11:31:31 -  1.26
+++ projects/prefetch.html  14 Nov 2015 21:02:41 -
@@ -775,14 +775,13 @@
 [9]
 MIPS32[tm] Architecture for Programmers; Volume II: The MIPS32[tm]
 Instruction Set, MIPS Technologies, Document Number MD00086,
-Revision 0.95, March 12, 2001;
-search from http://www.mips.com";>http://www.mips.com.
+Revision 0.95, March 12, 2001 search from www.mips.com.
 
 [10]
 MIPS64[tm] Architecture for Programmers; Volume II: The MIPS64[tm]
 Instruction Set, MIPS Technologies, Document Number MD00087,
 Revision 0.95, March 12, 2001;
-search from http://www.mips.com";>http://www.mips.com.
+search from www.mips.com.
 
 [11]
 MMIX Op Codes, Don Knuth;


[PATCH 2/2] [graphite] Enable condegen in case of cond phis.

2015-11-14 Thread hiraditya
From: hiraditya 

The codegen of conditional PHIs inside the scop where one predecessor dominates
the other was difficult so it wasn't enabled in the previous patch. After a
couple of bug-fixes this has been enabled in this patch.  Not all the cases
could be handled in this case because it becomes difficult to map the basic
block back to original code in some cases.

Bug-fixes:
1. The vec_find returns -1 when no element was found. This wasn't checked.
2. When the arguments to pending phis could not be resolved in the second pass,
the codegen would fail so the new code should be cleaned up.

This patch passes regtest and bootstrap on linux-x86-64 with
BOOT_CFLAGS='-O2 -fgraphite-identity -floop-nest-optimize'

2015-11-14  hiraditya  

* graphite-isl-ast-to-gimple.c (copy_loop_phi_args): Change the return
  type to bool for early exit.
  (translate_isl_ast_to_gimple::copy_loop_phi_nodes): Early return in
  case of error.
  (translate_isl_ast_to_gimple::copy_loop_close_phi_args): Same.
  (add_phi_arg_for_new_expr): Enable codegen for if-block where one 
predecessor
  dominates the other.
  (translate_isl_ast_to_gimple::copy_cond_phi_args): Fix. When the 
element is not
  found it returns -1.
  (translate_isl_ast_to_gimple::translate_pending_phi_nodes): Bail out 
early when
  codegen fails.
  (graphite_regenerate_ast_isl): Remove codegen region when pending phis
  could not be generated.

---
 gcc/graphite-isl-ast-to-gimple.c | 168 ---
 1 file changed, 106 insertions(+), 62 deletions(-)

diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index 82a7740..2021df8 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -352,7 +352,7 @@ class translate_isl_ast_to_gimple
   /* Copy the PHI arguments from OLD_PHI to the NEW_PHI.  The arguments to
  NEW_PHI must be found unless they can be POSTPONEd for later.  */
 
-  void copy_loop_phi_args (gphi *old_phi, init_back_edge_pair_t &ibp_old_bb,
+  bool copy_loop_phi_args (gphi *old_phi, init_back_edge_pair_t &ibp_old_bb,
   gphi *new_phi, init_back_edge_pair_t &ibp_new_bb,
   bool postpone);
 
@@ -1928,7 +1928,7 @@ get_edges (basic_block bb)
 /* Copy the PHI arguments from OLD_PHI to the NEW_PHI.  The arguments to 
NEW_PHI
must be found unless they can be POSTPONEd for later.  */
 
-void
+bool
 translate_isl_ast_to_gimple::
 copy_loop_phi_args (gphi *old_phi, init_back_edge_pair_t &ibp_old_bb,
gphi *new_phi, init_back_edge_pair_t &ibp_new_bb,
@@ -1969,8 +1969,9 @@ copy_loop_phi_args (gphi *old_phi, init_back_edge_pair_t 
&ibp_old_bb,
}
   else
/* Either we should add the arg to phi or, we should postpone.  */
-   gcc_unreachable ();
+   return false;
 }
+  return true;
 }
 
 /* Copy loop phi nodes from BB to NEW_BB.  */
@@ -2006,7 +2007,8 @@ translate_isl_ast_to_gimple::copy_loop_phi_nodes 
(basic_block bb,
   tree new_res = create_new_def_for (res, new_phi,
 gimple_phi_result_ptr (new_phi));
   set_rename (res, new_res);
-  copy_loop_phi_args (phi, ibp_old_bb, new_phi, ibp_new_bb, true);
+  codegen_error = !copy_loop_phi_args (phi, ibp_old_bb, new_phi,
+ ibp_new_bb, true);
   update_stmt (new_phi);
 }
 
@@ -2126,7 +2128,9 @@ translate_isl_ast_to_gimple::copy_loop_close_phi_args 
(basic_block old_bb,
   /* A close phi must come from a loop-phi having an init value.  */
   if (!init)
{
- gcc_assert (postpone);
+ if (!postpone)
+   return false;
+
  region->incomplete_phis.safe_push (std::make_pair (phi, new_phi));
  if (dump_file)
{
@@ -2199,7 +2203,7 @@ add_phi_arg_for_new_expr (tree old_phi_args[2], tree 
new_phi_args[2],
  gphi *phi, gphi *new_phi,
  basic_block new_bb)
 {
-  basic_block def_pred[2];
+  basic_block def_pred[2] = { NULL, NULL };
   int not_found_bb_index = -1;
   for (int i = 0; i < 2; i++)
 {
@@ -2208,11 +2212,14 @@ add_phi_arg_for_new_expr (tree old_phi_args[2], tree 
new_phi_args[2],
   if (TREE_CODE (old_phi_args[i]) == INTEGER_CST)
def_pred[i] = get_def_bb_for_const (new_bb,
gimple_phi_arg_edge (phi, i)->src);
-  else
+  else if (new_phi_args[i] && (TREE_CODE (new_phi_args[i]) == SSA_NAME))
def_pred[i] = gimple_bb (SSA_NAME_DEF_STMT (new_phi_args[i]));
+
   if (!def_pred[i])
{
- gcc_assert (not_found_bb_index == -1);
+ /* When non are available bail out.  */
+ if (not_found_bb_index != -1)
+   return false;
  not_found_bb_index = i;
}
 }
@@ -2220,32 +2227,54 @@ add_phi_arg_for_new_expr (tre

Re: [patch] update locale support fro FreeBSD

2015-11-14 Thread Andreas Tobler

On 14.11.15 14:43, Jonathan Wakely wrote:

On 13/11/15 15:28 +, Jonathan Wakely wrote:

On 12/11/15 23:32 +0100, Andreas Tobler wrote:

All,

with the work from Jennifer Yao and John Marino we can now update
the locale support on FreeBSD to the level of DragonFly.

Results of this work can be found on the results list.

Here my small addendum to make it work on FreeBSD.

Is this ok for trunk? (Given that the work from Jennifer and John
are committed before stage3?)


Those patches are now in.

I'm OK with this change for gcc6. It is an ABI change for FreeBSD, as
it changes the std::locale definitions, but as the target maintainer
you can decide if that's OK.



My mistake, this doesn't make any incompatible change at all, so is a
no-brainer IMHO. (I thought there was a change to where something got
deallocated, but that's only a local variable in the constructor).


Thank you very much!

Committed: r230383

Andreas



[wwwdocs] Update link to AVX-512... docs

2015-11-14 Thread Gerald Pfeifer
Apparently Intel released a new version of this document (and the
original address redirects, but it's of course better to directly
refer to the new one).

Committed.

Gerald
Index: gcc-5/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.131
diff -u -r1.131 changes.html
--- gcc-5/changes.html  14 Nov 2015 20:42:59 -  1.131
+++ gcc-5/changes.html  14 Nov 2015 21:17:16 -
@@ -776,7 +776,7 @@
 IA-32/x86-64
   
 New ISA extensions support
-   https://software.intel.com/sites/default/files/managed/0d/53/319433-022.pdf";>
+   https://software.intel.com/sites/default/files/managed/0d/53/319433-023.pdf";>
AVX-512{BW,DQ,VL,IFMA,VBMI} of Intel's CPU
codenamed Skylake Server was added to GCC.  That includes inline
assembly support, new intrinsics, and basic autovectorization.  These


Re: [PATCH] Enable libstdc++ numeric conversions on Cygwin

2015-11-14 Thread Jennifer Yao
> Hi, this commit makes the GCC build to fail for targets using newlib
> (I tested arm-none-eabi and aarch64-none-elf)
>
> I'm seeing errors such as:
> In file included from
> /tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/string:52:0,
>  from
> /tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/bits/locale_classes.h:40,
>  from
> /tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/bits/ios_base.h:41,
>  from
> /tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/ios:42,
>  from
> /tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/istream:38,
>  from
> /tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/sstream:38,
>  from
> /tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/complex:45,
>  from
> /tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/ccomplex:38,
>  from
> /tmp/9122162_8.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libstdc++-v3/include/precompiled/stdc++.h:52:
> /tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/bits/basic_string.h:
> In function 'long long int std::__cxx11::stoll(const wstring&,
> std::size_t*, int)':
> /tmp/9122162_8.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/gcc3/aarch64_be-none-elf/libstdc++-v3/include/bits/basic_string.h:5524:31:
> error: 'wcstoll' is not a member of 'std'
>{ return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(),
>^
> Sorry I can't provide more details until Monday.

I just finished running the testsuite on x86_64-pc-cygwin for
Jonathan's latest patch and compared the results against an older
(about two months old) run, and so far I'm not seeing any regressions.
Granted, this is strictly preliminary; I'm currently re-running the
testsuite on the up-to-date, unpatched build tree to see if there are
any differences. I'll update when I have more information.


[PATCH 1/2] [graphite] Move codegen related functions to graphite-isl-ast-to-gimple.c

2015-11-14 Thread A . K .
No functional changes intended.
This patch passes regtest and bootstrap on linux-x86-64 with 
BOOT_CFLAGS='-O2 -fgraphite-identity -floop-nest-optimize'


>From 85a4403b1e99dc7ff7ea58c1d926521bdf321d8f Mon Sep 17 00:00:00 2001
From: hiraditya 
Date: Sat, 14 Nov 2015 10:26:09 -0600
Subject: [PATCH 1/2] [graphite] Move codegen related functions to graphite-isl-ast-to-gimple.c

No functional changes intended.
This patch passes regtest and bootstrap on linux-x86-64 with
BOOT_CFLAGS='-O2 -fgraphite-identity -floop-nest-optimize'

gcc/ChangeLog:

2015-11-14  hiraditya  

	* graphite-isl-ast-to-gimple.c (struct ast_build_info): Remove semicolon.
	(class translate_isl_ast_to_gimple): Indentation.
(translate_pending_phi_nodes): Comment.
(add_parameters_to_ivs_params): Moved from sese.c inside class translate_isl_ast_to_gimple.
(get_max_schedule_dimensions): Same.
(generate_isl_context): Same.
(extend_schedule): Same.
(generate_isl_schedule): Same.
(set_options): Same.
(scop_to_isl_ast): Same.
(is_valid_rename): Same.
(get_rename): Same.
(get_rename_from_scev): Same.
(get_def_bb_for_const): Same.
(get_new_name): Same.
(collect_all_ssa_names): Same.
(copy_loop_phi_args): Same.
(copy_loop_phi_nodes): Same.
(copy_loop_close_phi_args): Same.
(copy_loop_close_phi_nodes): Same.
(copy_cond_phi_args): Same.
(copy_cond_phi_nodes): Same.
(graphite_copy_stmts_from_block): Same.
(copy_bb_and_scalar_dependences): Same.
(add_phi_arg_for_new_expr): Same.
(rename_uses): Same.
(set_rename): Same.
(set_rename_for_each_def): Same.
(gsi_insert_earliest): Same.
(rename_all_uses): Same.
(codegen_error_p): Same.
(print_isl_ast_node): Same.
	(translate_isl_ast_for_loop): Call function codegen_error_p.
	(translate_isl_ast_to_gimple::translate_isl_ast): Same.
(translate_isl_ast_node_user): Make nb_loops const and release iv_map before exit.
	(get_true_edge_from_guard_bb): Move all free-functions early.
	(get_false_edge_from_guard_bb): Same.
	(bb_contains_loop_close_phi_nodes): Same.
	(bb_contains_loop_phi_nodes): Same.
	(is_loop_closed_ssa_use):  Same.
	(number_of_phi_nodes): Same.
	(phi_uses_name): Same.
	(later_of_the_two): Same.
	(substitute_ssa_name):
	(get_edges): Same.
	(get_loc): Same.
	(get_loop_init_value): Same.
	(find_init_value): Same.
	(find_init_value_close_phi): Same.
	(ast_build_before_for): Same.
	(graphite_regenerate_ast_isl): Formatting changes.
	* graphite-scop-detection.c (build_cross_bb_scalars_use): Same.
	* sese.c (get_rename): Move to graphite-isl-ast-to-gimple.c
	(set_rename): Same.
	(gsi_insert_earliest): Same.
	(collect_all_ssa_names): Same.
	(rename_all_uses): Same.
	(rename_uses): Same.
	(get_def_bb_for_const): Same.
	(copy_loop_phi_nodes): Same.
	(copy_loop_close_phi_args): Same.
	(copy_loop_close_phi_nodes): Same.
	(copy_cond_phi_args): Same.
	(copy_cond_phi_nodes): Same.
	(set_rename_for_each_def): Same.
	(graphite_copy_stmts_from_block): Same.
	(copy_bb_and_scalar_dependences): Same.
	(if_region_set_false_region): Same.
	(scev_analyzable_p): Same.
	* sese.h: Delete extern functions moved to graphite-isl-ast-to-gimple.c

---
 gcc/graphite-isl-ast-to-gimple.c | 2233 ++
 gcc/graphite-scop-detection.c|4 +-
 gcc/sese.c   | 1575 +--
 gcc/sese.h   |   44 +-
 4 files changed, 2038 insertions(+), 1818 deletions(-)

diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index 7fa4ce3..82a7740 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -48,8 +48,14 @@ extern "C" {
 #include "gimple.h"
 #include "params.h"
 #include "fold-const.h"
+#include "gimple-fold.h"
 #include "gimple-iterator.h"
+#include "gimplify.h"
+#include "gimplify-me.h"
+#include "tree-eh.h"
 #include "tree-ssa-loop.h"
+#include "tree-ssa-operands.h"
+#include "tree-ssa-propagate.h"
 #include "tree-pass.h"
 #include "cfgloop.h"
 #include "tree-data-ref.h"
@@ -60,10 +66,13 @@ extern "C" {
 #include "tree-phinodes.h"
 #include "tree-into-ssa.h"
 #include "ssa-iterators.h"
-#include 
 #include "graphite-isl-ast-to-gimple.h"
 #include "tree-cfg.h"
 #include "gimple-pretty-print.h"
+#include "cfganal.h"
+#include "value-prof.h"
+
+#include 
 
 /* We always try to use signed 128 bit types, but fall back to smaller types
in case a platform does not provide types of these sizes. In the future we
@@ -78,7 +87,7 @@ struct ast_build_info
 {
   ast_build_info()
 : is_parallelizable(false)
-  { };
+  { }
   bool is_parallelizable;
 };
 
@@ -129,7 +138,7 @@ class translate_isl_ast_to_gimple
  public:
   translate_isl_ast_to_gimple (sese_info_p r)
 : region (r), codegen_error (false)
-  { }
+{ }
 
   /* Translates an ISL AST node NODE t

[wwwdocs] Adjust link to exactcode.de in benchmarks/index.html

2015-11-14 Thread Gerald Pfeifer
Committed.

Gerald

Index: benchmarks/index.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/benchmarks/index.html,v
retrieving revision 1.32
diff -u -r1.32 index.html
--- benchmarks/index.html   29 Jun 2014 12:29:32 -  1.32
+++ benchmarks/index.html   14 Nov 2015 21:28:50 -
@@ -93,7 +93,7 @@
 Openbench
 
 
-http://www.exactcode.de/site/open_source/openbench/";>Openbench
+http://exactcode.de/site/open_source/openbench/";>Openbench
 is a free benchmarking suite similar to SPEC.
 
 


[PATCH] OpenMP 4.5 is now publicly available

2015-11-14 Thread Jakub Jelinek
Hi!

Seems the OpenMP 4.5 standard is now publicly available already:
http://www.openmp.org/mp-documents/openmp-4.5.pdf
and therefore I've updated references to the sections in libgomp.texi.

2015-11-14  Jakub Jelinek  

* libgomp.texi: Update references from OpenMP 4.0 to OpenMP 4.5
sections.

--- libgomp/libgomp.texi(revision 230380)
+++ libgomp/libgomp.texi(working copy)
@@ -130,7 +130,7 @@ arranges for automatic linking of the Op
 
 A complete description of all OpenMP directives accepted may be found in 
 the @uref{http://www.openmp.org, OpenMP Application Program Interface} manual,
-version 4.0.
+version 4.5.
 
 
 @c -
@@ -141,7 +141,7 @@ version 4.0.
 @chapter Runtime Library Routines
 
 The runtime routines described here are defined by Section 3 of the OpenMP
-specification in version 4.0.  The routines are structured in following
+specification in version 4.5.  The routines are structured in following
 three parts:
 
 @menu
@@ -220,7 +220,7 @@ which enclose the calling call.
 @ref{omp_get_level}, @ref{omp_get_max_active_levels}, 
@ref{omp_set_max_active_levels}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.20.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.20.
 @end table
 
 
@@ -249,7 +249,7 @@ zero to @code{omp_get_level} -1 is retur
 @ref{omp_get_level}, @ref{omp_get_thread_num}, @ref{omp_get_team_size}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.18.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.18.
 @end table
 
 
@@ -277,7 +277,7 @@ deactivated.
 @ref{OMP_CANCELLATION}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.9.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.9.
 @end table
 
 
@@ -302,7 +302,7 @@ Get the default device for target region
 @ref{OMP_DEFAULT_DEVICE}, @ref{omp_set_default_device}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.24.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.30.
 @end table
 
 
@@ -334,7 +334,7 @@ disabled by default.
 @ref{omp_set_dynamic}, @ref{OMP_DYNAMIC}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.8.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.8.
 @end table
 
 
@@ -360,7 +360,7 @@ which enclose the calling call.
 @ref{omp_get_active_level}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.17.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.17.
 @end table
 
 
@@ -385,7 +385,7 @@ This function obtains the maximum allowe
 @ref{omp_set_max_active_levels}, @ref{omp_get_active_level}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.16.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.16.
 @end table
 
 
@@ -432,7 +432,7 @@ that does not use the clause @code{num_t
 @ref{omp_set_num_threads}, @ref{omp_set_dynamic}, @ref{omp_get_thread_limit}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.3.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.3.
 @end table
 
 
@@ -464,7 +464,7 @@ disabled by default.
 @ref{omp_set_nested}, @ref{OMP_NESTED}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.11.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.11.
 @end table
 
 
@@ -486,7 +486,7 @@ Returns the number of target devices.
 @end multitable
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.25.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.31.
 @end table
 
 
@@ -508,7 +508,7 @@ Returns the number of processors online
 @end multitable
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.5.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.5.
 @end table
 
 
@@ -530,7 +530,7 @@ Returns the number of teams in the curre
 @end multitable
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.26.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.32.
 @end table
 
 
@@ -563,7 +563,7 @@ one thread per CPU online is used.
 @ref{omp_get_max_threads}, @ref{omp_set_num_threads}, @ref{OMP_NUM_THREADS}
 
 @item @emph{Reference}:
-@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.2.
+@uref{http://www.openmp.org/, OpenMP specification v4.5}, Section 3.2.2.
 @end table
 
 
@@ -591,7 +591,7 @@ set via @env{OMP_PROC_BIND}.  Possible v
 @ref{OMP_PROC_BIND}, @ref{OMP_PLACES}, @ref{GOMP_CPU_AFFINITY},
 
 @item @em

Re: [PATCH], Add power9 support to GCC, patch #5 (ISA 3.0 fusion)

2015-11-14 Thread Segher Boessenkool
On Sun, Nov 08, 2015 at 07:42:04PM -0500, Michael Meissner wrote:
> This patch adds support for new fusion forms in ISA 3.0 (power9).  In
> particular, ISA 3.0 can fuse GPR loads of R0, FPR loads, GPR stores, FPR
> stores, and some constant generation that ISA 2.07 (power8) could not
> generate.

TOC fusion breaks thousands of testcases with -mlra -flto.

What happens is that LRA tries to reload the memory address (the unspec
FUSION_ADDIS) into a register, but there is no pattern that will let it
do that.

This can be fixed temporarily by not enabling TOC fusion if LRA is
enabled.

It seems that without -flto TOC fusion doesn't do much at all, btw?


Segher


[wwwdocs] Remove broken Intel AVX-512 reference from svn.html

2015-11-14 Thread Gerald Pfeifer
Once again, corporate webmaster (not) at work.

Committed.

(Kirill, if you want to add a new link, absolutely go ahead.)

Gerald

Index: svn.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/svn.html,v
retrieving revision 1.202
diff -u -r1.202 svn.html
--- svn.html27 Aug 2015 19:47:19 -  1.202
+++ svn.html14 Nov 2015 22:17:35 -
@@ -381,8 +381,7 @@
 
   avx512
   The goal of this branch is to implement Intel AVX-512 and SHA
-  Programming Reference
-  (http://download-software.intel.com/sites/default/files/319433-015.pdf";>link).
+  Programming Reference.
   The branch is maintained by Yukhin Kirill kirill.yuk...@intel.com>.
   Patches should be marked with the tag [AVX512] in the subject


[wwwdocs] Update reference to Go 1

2015-11-14 Thread Gerald Pfeifer
weekly.golang.org/doc/go1 now redirects to golang.org/doc/go1
and this uses https.

Committed.

Gerald

Index: gcc-4.7/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v
retrieving revision 1.141
diff -u -r1.141 changes.html
--- gcc-4.7/changes.html27 Aug 2015 19:55:58 -  1.141
+++ gcc-4.7/changes.html14 Nov 2015 23:24:24 -
@@ -690,7 +690,7 @@
 Go
   
 GCC 4.7 implements
-  the http://weekly.golang.org/doc/go1";>Go 1
+  the https://golang.org/doc/go1";>Go 1
   language standard.  The library support in 4.7.0 is not
   quite complete, due to release timing.  Release 4.7.1 includes
   complete support for Go 1.  The Go library is from the Go 1.0.1
@@ -1016,7 +1016,7 @@
 are not listed here).
 
 The Go frontend in the 4.7.1 release fully supports
-the http://weekly.golang.org/doc/go1";>Go 1 language
+the https://golang.org/doc/go1";>Go 1 language
 standard.
 
 GCC 4.7.2


[wwwdocs] Switch golang.org to https

2015-11-14 Thread Gerald Pfeifer
Committed.

Gerald

Index: news.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/news.html,v
retrieving revision 1.148
diff -u -r1.148 news.html
--- news.html   12 Sep 2015 22:19:00 -  1.148
+++ news.html   14 Nov 2015 23:39:04 -
@@ -328,7 +328,7 @@
 
 December 2, 2010
 GCC 4.6 will support
-  the http://golang.org/";>Go programming language.  The
+  the https://golang.org/";>Go programming language.  The
   new frontend was contributed by Ian Lance Taylor at Google.
 
 November 16, 2010
Index: readings.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/readings.html,v
retrieving revision 1.241
diff -u -r1.241 readings.html
--- readings.html   24 Aug 2015 17:18:23 -  1.241
+++ readings.html   14 Nov 2015 23:39:05 -
@@ -609,8 +609,8 @@
 Go information
 
 
-http://golang.org/";>General Go information
-http://golang.org/ref/spec";>Go language
+https://golang.org/";>General Go information
+https://golang.org/ref/spec";>Go language
 specification
 
 
Index: svn.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/svn.html,v
retrieving revision 1.203
diff -u -r1.203 svn.html
--- svn.html14 Nov 2015 23:07:45 -  1.203
+++ svn.html14 Nov 2015 23:39:05 -
@@ -508,7 +508,7 @@
   gccgo
   This branch is for the Go frontend to gcc.  For more information
 about the Go programming language,
-see http://golang.org/";>http://golang.org.  The
+see https://golang.org/";>https://golang.org.  The
 branch is maintained by Ian Lance Taylor.  Patches should be
 marked with the tag [gccgo] in the Subject line.
   
Index: gcc-4.6/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.6/changes.html,v
retrieving revision 1.152
diff -u -r1.152 changes.html
--- gcc-4.6/changes.html6 Dec 2014 16:29:23 -   1.152
+++ gcc-4.6/changes.html14 Nov 2015 23:39:06 -
@@ -615,7 +615,7 @@
 
 Go
 
-Support for the http://golang.org/";>Go programming
+Support for the https://golang.org/";>Go programming
 language has been added to GCC.  It is not enabled by default
 when you build GCC; use the --enable-languages
 configure option to build it.  The driver program for compiling Go
Index: gcc-5/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.132
diff -u -r1.132 changes.html
--- gcc-5/changes.html  14 Nov 2015 21:19:00 -  1.132
+++ gcc-5/changes.html  14 Nov 2015 23:39:07 -
@@ -594,8 +594,8 @@
 GCC 5 provides a complete implementation of the Go 1.4.2
 release.
 Building GCC 5 with Go enabled will install two new
-  programs: http://golang.org/cmd/go/";>go
-  and http://golang.org/cmd/gofmt/";>gofmt.
+  programs: https://golang.org/cmd/go/";>go
+  and https://golang.org/cmd/gofmt/";>gofmt.
   
 
 


Re: [PATCH] Fix SH/FDPIC bad codegen with ssp enabled

2015-11-14 Thread Rich Felker
On Sat, Nov 14, 2015 at 09:24:32AM +0900, Kaz Kojima wrote:
> Rich Felker  wrote:
> > The "chk_guard_add" pattern used for loading the GOT slot address for
> > __stack_chk_guard hard-codes use of r12 as a fixed GOT register and
> > thus is not suitable for FDPIC, where the saved initial value of r12
> > from function entry is what we need.
> 
> The patch is OK.  Committed as revision 230366.

Thanks!

> > I would actually prefer removing this hack entirely if possible. I
> > tried non-FDPIC with it disabled and did not experience any problems;
> > I suspect it was written to work around a bug that no longer exists.
> 
> Even we don't see the problem without that, it'll be a latent
> issue with the old reload, I think.  When SH switches to LRA
> completely, this should be revisit.

I thought about trying a patch to eliminate the use of the hard-coded
PIC register and instead generate a pseudo for the GOT address. Then
some FDPIC and non-FDPIC code could potentially be unified to use this
pseudo, just with different ways of defining it (r12-at-entry vs
PC-relative symbolic load of _GLOBAL_OFFSET_TABLE_). Would this be
acceptable?

I've already done some experiments removing r12 from fixed_regs for
FDPIC and nothing visibly broke; gcc correctly used r12 as a temp in
functions which didn't need the GOT address, and codegen was improved
even in functions which do use it. These results were observed on musl
libc.so.

Rich


[PATCH] simplify-rtx: Simplify sign_extend of lshiftrt to zero_extend (PR68330)

2015-11-14 Thread Segher Boessenkool
Since r230164, in PR68330 combine ends up with a sign_extend of an
lshiftrt by some constant, and it does not know to morph that into a
zero_extract (the extend will always extend with zeroes).  I think
it is best to let simplify-rtx always replace such a sign_extend by
a zero_extend, after which everything works as expected.

Bootstrapped and tested on powerpc64-linux.  Is this okay for trunk?


Segher


2015-11-15  Segher Boessenkool  

PR rtl-optimization/68330
* simplify-rtx.c (simplify_unary_operation_1): Simplify SIGN_EXTEND
of LSHIFTRT by a non-zero constant integer.

---
 gcc/simplify-rtx.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index c4fc42a..413d61b 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1462,6 +1462,13 @@ simplify_unary_operation_1 (enum rtx_code code, 
machine_mode mode, rtx op)
}
}
 
+  /* (sign_extend:M (lshiftrt:N  (const_int I))) is better as
+ (zero_extend:M (lshiftrt:N  (const_int I))) if I is not 0.  */
+  if (GET_CODE (op) == LSHIFTRT
+ && CONST_INT_P (XEXP (op, 1))
+ && XEXP (op, 1) != const0_rtx)
+   return simplify_gen_unary (ZERO_EXTEND, mode, op, GET_MODE (op));
+
 #if defined(POINTERS_EXTEND_UNSIGNED)
   /* As we do not know which address space the pointer is referring to,
 we can do this only if the target does not support different pointer
-- 
1.9.3



Re: libcpp/C FE source range patch committed (r230331).

2015-11-14 Thread David Malcolm
On Sat, 2015-11-14 at 09:50 -0500, David Edelsohn wrote:
> This patch causes numerous new testsuite failure on AIX caused by the
> compiler crashing during compilation, e.g.
> 
> gcc.c-torture/execute/20020206-1.c
> 
> in GCC libcpp
> 
> 991   linemap_assert (line >= LINEMAPS_MACRO_LOWEST_LOCATION (set));
> 
> (gdb) where
> #0  _Z11fancy_abortPKciS0_ (
> file=0x11296dc0
> <_GLOBAL__F__ZN9text_info9set_rangeEj12source_rangeb+3056>
> "/nasfarm/edelsohn/src/src/libcpp/line-map.c", line=991,
> function=0x11296f30
> <_GLOBAL__F__ZN9text_info9set_rangeEj12source_rangeb+3424>
> "linemap_macro_map_lookup")
> at /nasfarm/edelsohn/src/src/gcc/diagnostic.c:1332
> #1  0x100169b4 in _Z14linemap_lookupP9line_mapsj (set=0x7000, line=991)
> at /nasfarm/edelsohn/src/src/libcpp/line-map.c:991
> #2  0x100188f8 in
> _Z40linemap_unwind_to_first_non_reserved_locP9line_mapsjPPK8line_map
> (set=0x7000, loc=991, map=0x0)
> at /nasfarm/edelsohn/src/src/libcpp/line-map.c:1629
> #3  0x100753c8 in _ZL17expand_location_1jb (loc=889323520,
> expansion_point_p=false) at /nasfarm/edelsohn/src/src/gcc/input.c:158
> #4  0x10076488 in _Z48linemap_client_expand_location_to_spelling_pointj (
> loc=991) at /nasfarm/edelsohn/src/src/gcc/input.c:751
> #5  0x10019928 in _ZN13rich_location9add_rangeEjjb (this=0x2ff21cd8,
> start=991, finish=889323520, show_caret_p=true)
> at /nasfarm/edelsohn/src/src/libcpp/line-map.c:2012
> #6  0x10019a54 in _ZN13rich_locationC2EP9line_mapsj (this=0x2ff21cd8,
> set=0x3df, loc=287928112)
> at /nasfarm/edelsohn/src/src/libcpp/line-map.c:2024
> #7  0x1000ed84 in _Z7warningiPKcz (opt=164,
> gmsgid=0x11488d18
> <_GLOBAL__F__Z20prepare_call_addressP9tree_nodeP7rtx_defS2-
> _PS2_ii+3752> "function call has aggregate value")
> at /nasfarm/edelsohn/src/src/gcc/diagnostic.c:1003
> #8  0x1067ebac in _Z11expand_callP9tree_nodeP7rtx_defi (exp=0x700dcf20,
> target=0x700ec080, ignore=0) at /nasfarm/edelsohn/src/src/gcc/calls.c:2476
> #9  0x10406858 in
> _Z18expand_expr_real_1P9tree_nodeP7rtx_def12machine_mode15expand_modifierPS2_b
> (exp=0x700dcf20, target=0x700ec080, tmode=BLKmode,
> modifier=EXPAND_NORMAL, alt_rtl=0x17, inner_reference_p=false)
> at /nasfarm/edelsohn/src/src/gcc/expr.c:10581
> #10 0x104158c0 in _Z22store_expr_with_boundsP9tree_nodeP7rtx_defibbS0_ (
> exp=0x700dcf20, target=0x700ec080, call_param_p=0, nontemporal=false,
> reverse=false, btarget=0x700df058)
> at /nasfarm/edelsohn/src/src/gcc/expr.c:5405
> #11 0x104178fc in _Z17expand_assignmentP9tree_nodeS0_b (to=0x700df058,
> from=0x700dcf20, nontemporal=false)
> at /nasfarm/edelsohn/src/src/gcc/expr.c:5174
> #12 0x106f67b4 in _ZL18expand_gimple_stmtP6gimple (stmt=0x7000e240)
> at /nasfarm/edelsohn/src/src/gcc/cfgexpand.c:6278
> #13 0x106f87d8 in _ZL25expand_gimple_basic_blockP15basic_block_defb (
> bb=0x700c7740, disable_tail_calls=false)
> at /nasfarm/edelsohn/src/src/gcc/cfgexpand.c:5679
> #14 0x106ffbf4 in _ZN12_GLOBAL__N_111pass_expand7executeEP8function (
> this=0x11296dc0
> <_GLOBAL__F__ZN9text_info9set_rangeEj12source_rangeb+3056>,
> fun=0x70009138) at /nasfarm/edelsohn/src/src/gcc/cfgexpand.c:6291

I attempted to reproduce this on gcc111 (powerpc-ibm-aix7.1.3.0)
  ../src/configure --disable-bootstrap --with-gmp=/opt/cfarm/gmp-latest
--with-mpfr=/opt/cfarm/mpfr-latest --with-mpc=/opt/cfarm/mpc-latest
with latest trunk (r230384).

I saw only one ICE within "make check-gcc", when running
gcc.c-torture/execute/scal-to-vec1.c; specifically:

  /home/dmalcolm/gcc-build/build/gcc/xgcc \
-B/home/dmalcolm/gcc-build/build/gcc/ \

/home/dmalcolm/gcc-build/src/gcc/testsuite/gcc.c-torture/execute/scal-to-vec1.c 
\
-fno-diagnostics-show-caret -fdiagnostics-color=never \
   -O0  -w  -lm-o ./scal-to-vec1.exe

and this shows the same assertion failure as your report.


I was able to reproduce that ICE at will under gdb; from what I could
tell from gdb, a seemingly valid location is passed in to warning_at,
but at warning_at, the 32-bit value is seemingly corrupt, and this
eventually leads to an assertion failure in the new code.  The warning
is then discarded (OPT_Wvector_operation_performance).  I can't tell yet
if the data is corrupt, or if gdb is somehow getting confused about the
values as I go up and down the callstack (or indeed if I am), but it's
getting late here.




[PATCH/RFC] C++ FE: expression ranges (v2)

2015-11-14 Thread David Malcolm
(v2 of the patch, fixing some issues, and rebasing to be on top of
r230393 i.e. after the merge of delayed-folding).

This patch is analogous to:
"[PATCH 06/10] Track expression ranges in C frontend"
  https://gcc.gnu.org/ml/gcc-patches/2015-10/msg02535.html

in that it adds range information to the various expressions, but this
time for the C++ frontend.

The benefit here would be e.g. to highlight the LHS and RHS of a bad
binary expression:

error: no match for ‘operator+’ (operand types are ‘int’ and ‘s’)
   return (first_function_with_a_very_long_name ()
   ~~~
   + second_function_with_a_very_long_name ());
   ^ 

where exactly which is the LHS and RHS can be unclear when dealing with
complicated nesting of expressions.

As with the C frontend, there's an issue with tree nodes that
don't have locations: VAR_DECL, INTEGER_CST, etc:

  int test (int foo)
  {
return foo * 100;
   ^^^   ^^^
  }

where we'd like to access the source spelling ranges of the expressions
during parsing, so that we can use them when reporting parser errors.

I resolved this for the C frontend by augmenting struct c_expr.
However, the C++ parser works purely on "tree".  Hence this patch
introduces a new class "cp_expr", which bundles a tree and a location_t,
with implicit conversion between tree and cp_expr via a ctor,
an operator tree () etc, effectively preserving location information for
things like VAR_DECL during parsing.  (I first attempted explicit
conversions, but it turned out to be a huge task; doing it implicitly
made it doable).  Some explicit "expr.get_value ()" method calls are
needed for variadic calls e.g.:

error_at (id_expr_token->location,
  "local variable %qD may not appear in this context",
  -   decl);
  +   decl.get_value ());

since operator tree () can't be used there.

For tree nodes with a location, the location_t is always the same
as the EXPR_LOCATION of node (and redundant).
For other tree nodes, the location_t is of interest (and is asserted
to not be UNKNOWN_LOCATION).

Most of the time, the cp_expr's location is rather redundant, but
it's essential at the leaves of the parse tree, where it's used for
preserving the locations of the tokens as they become identifiers,
constants, etc: an extra 32-bit value is being stored and passed around
with the tree ptrs.

The new tests were shameless copied from the C FE testsuite, fixing
them up to reflect some apparent differences in caret location between
C and C++ for some expression, and adding some C++-specific constructs
(perhaps it could be done by referencing the C tests in
g++.dg/plugin/plugin.exp, with relative paths, rather than copying them?)

This bootstraps (x86_64-pc-linux-gnu) but isn't quite ready yet:
* it has some FIXMEs
* it has regressions for 8 test files (for a total of 139 new FAILs in
  g++.sum); these appear to all relate to locations of error messages
* no performance testing yet

That said, is this the right direction?

Also, in cp_parser_new_expression I attempted to generate meaningful
ranges e.g.:

  int *foo = new int[100];
 ^~~~

but it seems to be hard to do this, due to the trailing optional
components; I found myself wanting to ask the lexer for the last
token it consumed (in particular, I'm interested in the
location_t of that token).  Is this a reasonable thing to add to the
lexer?

gcc/cp/ChangeLog:
* call.c (build_new_op_1): Set the location of the result
of cp_build_unary_op.
* cp-tree.h (class cp_expr): New class.
(perform_koenig_lookup): Convert return type and param from tree
to cp_expr.
(finish_increment_expr): Likewise.
(finish_unary_op_expr): Likewise.
(finish_id_expression): Likewise for return type.
(build_class_member_access_expr): Likewise for param.
(finish_class_member_access_expr): Likewise.
(build_x_unary_op): Likewise.
(build_c_cast): Likewise.
(build_x_modify_expr): Likewise for return type.
* name-lookup.c (lookup_arg_dependent_1): Likewise.
(lookup_arg_dependent): Likewise; also for local "ret".
* name-lookup.h (lookup_arg_dependent): Likewise for return type.
* parser.c (struct cp_parser_expression_stack_entry): Likewise
for field "lhs".
(cp_parser_identifier): Likewise for return type.  Use cp_expr
ctor to preserve the token's location.
(cp_parser_string_literal): Likewise, building up a meaningful
location for the case where a compound string literal is built by
concatentation.
(cp_parser_userdef_char_literal): Likewise for return type.
(cp_parser_userdef_numeric_literal): Likewise.
(cp_parser_fold_expression): Likewise.
(cp_parser_primary_expression): Likewise, and for locals "expr",
"lam", "id_expres

Re: [PATCH v4] SH FDPIC backend support

2015-11-14 Thread Oleg Endo
On Wed, 2015-11-11 at 09:56 -0500, Rich Felker wrote:

> Sorry, I don't really understand RTL well enough to make a code
> snippet. What I want to express is that an insn "uses" (in the (use
> ...) sense) a register (r12) conditionally depending on a runtime
> option (TARGET_FDPIC).

As far as I know this is not possible.  It would require two variants
of the same pattern, one with the use and another without the use.  

> Is this possible in the sh backend or does it need changes to
> higher-level gcc code? (i.e. is it presently possible to make an insn
> that conditionally clobbers different things rather than having to
> make tons of different insns for each possible set of clobbers?)

This is basically the same as above ... it's not possible to
conditionally construct/modify pattern descriptions in the .md. 
 However, it's possible to modify the CALL_INSN_FUNCTION_USAGE field of
call insns -- for some examples see 'grep -r CALL_INSN_FUNCTION_USAGE
gcc/config/*'.  Also, it seems the SH backend doesn't make use of some
existing libcall related parameters and target hooks/macros.  Maybe
those could be helpful.

> Another issue I've started looking at is how r12 is put in 
> fixed_regs, which is conceptually wrong. Preliminary tests show that 
> removing it from fixed_regs doesn't break and produces much better 
> code -- r12 gets used as a temp register in functions that don't need 
> it, and in one function that made multiple calls, the saving of 
> initial r12 to a call-saved register even happened in the delay slot 
> of the call. I've been discussing it with Alexander Monakov on IRC 
> (#musl) and based on my understanding so far of how gcc works (which 
> admittedly may be wrong) the current FDPIC code looks like it's 
> written not to depend on r12 being 'fixed'. Also I think I'm pretty 
> close to understanding how we could make the same improvements for 
> non-FDPIC PIC codegen: instead loading r12 in the prologue, load a 
> pseudo, then use that pseudo for GOT access and force it into r12 the 
> same way FDPIC call code does for PLT calls. Does this sound correct?

Maybe TARGET_USE_PSEUDO_PIC_REG could be useful?

Cheers,
Oleg