Re: Strenghten early inliner analysis

2014-12-31 Thread Jan Hubicka
Hi,
this patch fixes the slp testcase that now requires no early inlining
Index: testsuite/gcc.dg/vect/slp-9.c
===
--- testsuite/gcc.dg/vect/slp-9.c   (revision 219107)
+++ testsuite/gcc.dg/vect/slp-9.c   (working copy)
@@ -1,4 +1,5 @@
 /* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-fno-early-inlining" } */
 
 #include 
 #include "tree-vect.h"

Honza


Re: [PATCH, fortran, final] PR fortran/60255 Deferred character length

2014-12-31 Thread Andre Vehreschild
Hi all,

sorry for duplicates, but the initial answer was rejected by the qmail-daemon
of the fortran-list due to my mobile sending html.

Now, the patch was not intended to solve 61337. Although I have looked into the
pseudo code generated for 61337, I couldn't figure easily what is going on
there. In my impression, this is something from incorrectly computed bounds to
an integer(8),pointer integer(4),pointer mix up. Therefore no patch for that
from my side currently. 

Nevertheless, do I hope that some reviewer finds a minute to look at the patch
for pr60255.

Regards,
Andre

On Tue, 30 Dec 2014 16:35:48 +0100
Dominique d'Humières  wrote:

> The new patch fixes the ICEs, but still emit the wrong codes reported in
> pr61337.
> 
> Thanks and Happy New Year to all,
> 
> Dominique
> 
> > Le 30 déc. 2014 à 14:39, Andre Vehreschild  a écrit :
> > 
> > Hi Dominique,
> > 
> > thanks for pointing that out. That was caused by a flaw in the current
> > patch. In the attached version this is fixed now.
> > 
> > Bootstraps and regtests ok on x86_64-linux-gnu.
> > 
> > Regards,
> > Andre
> > 
> > On Mon, 29 Dec 2014 16:32:27 +0100
> > Dominique d'Humières  wrote:
> > 
> >> For the record, compiling the tests in pr61337 with the patch applied on
> >> top of r219099 gives ICEs:
> >> 
> >>   use array_list
> >> 1
> >> internal compiler error: in gfc_advance_chain, at fortran/trans.c:58
> >> 
> >> Since this replaces some wrong-code generation by some ICEs, I don’t think
> >> this should delay the fix of pr60255.
> >> 
> >> Cheers,
> >> 
> >> Dominique
> 


-- 
Andre Vehreschild * Kreuzherrenstr. 8 * 52062 Aachen
Tel.: +49 241 9291018 * Email: ve...@gmx.de 


Re: [Patch, libstdc++/64441] Fix sub_match::first and second

2014-12-31 Thread Jonathan Wakely
OK - thanks

On 31 December 2014 at 06:58, Tim Shen  wrote:
> A dumb mistake :)
>
> Bootstrapped and tested.
>
> Thanks!
>
> --
> Regards,
> Tim Shen


Re: [build] libatomic, libgfortran: Use automake-1.11.1 to sync with the rest

2014-12-31 Thread Janne Blomqvist
On Fri, Dec 19, 2014 at 2:56 PM, Michael Haubenwallner
 wrote:
> On the way to prepare some (aix) libtool patch for toplevel libtool.m4
> I've discovered that different versions of automake were used to generate
> files across various libs:
>
> most libs:   automake-1.11.1
> libatomic   r211747: automake-1.11.6
> libgfortran r204654: automake-1.11.3
> r215741: automake-1.11.6
>
> Doesn't feel like there were specific reasons to use newer versions,
> but OTOH I've failed to find some docs on which versions to use, so
> I'd be fine with updating others to 1.11.6 instead as well.

I'm far from an autotools expert, but one justification for updating
to 1.11.6 would be CVE-2012-3386, see
https://lists.gnu.org/archive/html/automake/2012-07/msg00023.html .

Whatever version we end up choosing, the docs should say it so that
there won't be such misconceptions in the future, IMHO.




-- 
Janne Blomqvist


Re: [PATCH] Use x{v,}asprintf some more

2014-12-31 Thread Uros Bizjak
On Fri, Dec 26, 2014 at 2:00 PM, Uros Bizjak  wrote:

> This patch uses x{v,}asprintf where the result of the function is unused.
>
> 2014-12-26  Uros Bizjak  
>
> * diagnostic.c (build_message_string): Use xvasprintf.
> * final.c (output_operand_lossage): Use xvasprintf and xasprintf.
> * lto-wrapper.c (merge_and_complain): Use xasprintf.
> * targhooks.c (pch_option_mismatch): Ditto.
> * tree-ssa-structalias.c (create_function_info_for): Ditto.
> (create_variable_info_for_1): Ditto.
>
> Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
>
> OK for mainline?

Approved offline by Richi.

Committed to mainline SVN.

Uros.


[Patch, i386] Support AES, F16C, BMI and BMI2 targets in multiversioning

2014-12-31 Thread Allan Sandfeld Jensen
I recently wanted to use multiversioning for BMI2 specific extensions 
PDEP/PEXT, and noticed it wasn't there. So I wrote this patch to add it, and 
also added AES, F16C and BMI1 for completeness.

Happy new year
`Allan
commit 062c09d45d22302ffbd4f86d88e16a1a0d49cd80
Author: Allan Sandfeld Jensen 
Date:   Fri Dec 26 21:14:01 2014 +0100

AES, F16C BMI and BMI2 multiversion support

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ff8a5e6..83f16a5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-29  Allan Sandfeld Jensen  
+
+   * config/i386/i386.c (get_builtin_code_for_version): Add
+   support for AES, BMI, BMI2 and F16C multiversion functions.
+
 2014-12-27  H.J. Lu  
 
PR target/64409
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index d693fdb..a1b74dc 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -34261,15 +34261,22 @@ get_builtin_code_for_version (tree decl, tree 
*predicate_list)
 P_PROC_SSE4_A,
 P_SSE4_1,
 P_SSE4_2,
-P_PROC_SSE4_2,
 P_POPCNT,
+P_PROC_SSE4_2,
+P_AES,
+P_PROC_AES,
 P_AVX,
 P_PROC_AVX,
+P_F16C,
+P_PROC_F16C,
+P_BMI,
+P_PROC_BMI,
 P_FMA4,
 P_XOP,
 P_PROC_XOP,
 P_FMA,
 P_PROC_FMA,
+P_BMI2,
 P_AVX2,
 P_PROC_AVX2,
 P_AVX512F,
@@ -34295,12 +34302,16 @@ get_builtin_code_for_version (tree decl, tree 
*predicate_list)
   {"sse4a", P_SSE4_A},
   {"ssse3", P_SSSE3},
   {"sse4.1", P_SSE4_1},
-  {"sse4.2", P_SSE4_2},
   {"popcnt", P_POPCNT},
+  {"sse4.2", P_SSE4_2},
+  {"aes", P_AES},
   {"avx", P_AVX},
+  {"f16c", P_F16C},
+  {"bmi", P_BMI},
   {"fma4", P_FMA4},
   {"xop", P_XOP},
   {"fma", P_FMA},
+  {"bmi2", P_BMI2},
   {"avx2", P_AVX2},
   {"avx512f", P_AVX512F}
 };
@@ -34350,21 +34361,25 @@ get_builtin_code_for_version (tree decl, tree 
*predicate_list)
  priority = P_PROC_SSSE3;
  break;
case PROCESSOR_NEHALEM:
- if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_AES)
+ if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_AES) {
arg_str = "westmere";
- else
+priority = P_PROC_AES;
+  } else {
/* We translate "arch=corei7" and "arch=nehalem" to
   "corei7" so that it will be mapped to M_INTEL_COREI7
   as cpu type to cover all M_INTEL_COREI7_XXXs.  */
arg_str = "corei7";
- priority = P_PROC_SSE4_2;
+priority = P_PROC_SSE4_2;
+  }
  break;
case PROCESSOR_SANDYBRIDGE:
- if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_F16C)
+ if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_F16C) {
arg_str = "ivybridge";
- else
+   priority = P_PROC_F16C;
+ } else {
arg_str = "sandybridge";
- priority = P_PROC_AVX;
+   priority = P_PROC_AVX;
+ }
  break;
case PROCESSOR_HASWELL:
  if (new_target->x_ix86_isa_flags & OPTION_MASK_ISA_ADX)
@@ -34395,7 +34410,7 @@ get_builtin_code_for_version (tree decl, tree 
*predicate_list)
  break;
case PROCESSOR_BTVER2:
  arg_str = "btver2";
- priority = P_PROC_AVX;
+ priority = P_PROC_BMI;
  break;
case PROCESSOR_BDVER1:
  arg_str = "bdver1";
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ef6ddcc..5b11622 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-29  Allan Sandfeld Jensen  
+
+   * gcc.target/i386/funcspec-5.c: Test new multiversion targets.
+   * g++.dg/ext/mv17.C: Test BMI/BMI2 multiversion dispatcher.
+
 2014-12-28  H.J. Lu  
 
* gcc.target/i386/pr57003.c: Skip on x32.
diff --git a/gcc/testsuite/g++.dg/ext/mv17.C b/gcc/testsuite/g++.dg/ext/mv17.C
new file mode 100644
index 000..311f217
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/mv17.C
@@ -0,0 +1,91 @@
+/* Test case to check if Multiversioning works for BMI and BMI2.  */
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2" } */
+
+#include 
+
+// Check BMI feature selection works
+int foo () __attribute__((target("default")));
+int foo () __attribute__((target("bmi")));
+int foo () __attribute__((target("bmi2")));
+
+// Check specialized versions for archs with BMI is chosen over generic BMI 
versions.
+int bar () __attribute__((target("default")));
+int bar () __attribute__((target("bmi")));
+int bar () __attribute__((target("bmi2")));
+int bar () __attribute__((target("arch=btver2")));
+int bar () __attribute__((target("arch=haswell")));
+
+int main ()
+{
+  int val = foo ();
+
+  if (__builtin_cpu_supports ("bmi2"))
+assert (val == 2);
+  else if (__builtin_cpu_support

Re: libsanitizer merge from upstream r221802

2014-12-31 Thread David Abdurachmanov

On Dec 30, 2014, at 11:48 PM, Andrew Pinski wrote:
>> If we have 64-bit kernel and 64-bit application is executed sys_getresuid is
>> used for getresuid syscall, otherwise if 32-bit application is executed --
>> sys_getresuid16 is used. Thus 64-bit application will never call
>> sys_getresuid16 implemenation. Then
>> getresuid16/getresgid16/getgroups16/setgroups16/etc only needs to in 32-bit
>> binary of libsanitizer. Same should apply for x86_64/i*86.
>> 
>> Is that correct?
> 
> Kinda.  It only applies for aarch32 and not for AARCH64:ILP32.
> AARCH64:ILP32 uses the standard system calls here too.


I am attaching an updated patch, bootstrapped trunk on arrch64 with kernels 
3.12 and 3.17 (QEMU).

I looked at kernel source. If CONFIG_COMPAT is set then CONFIG_HAVE_UID16 is 
set.

From include/linux/syscalls.h

523 #ifdef CONFIG_UID16
524 asmlinkage long sys_chown16(const char __user *filename,
525 old_uid_t user, old_gid_t group);
526 asmlinkage long sys_lchown16(const char __user *filename,
527 old_uid_t user, old_gid_t group);
528 asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t 
group);
529 asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid);
530 asmlinkage long sys_setgid16(old_gid_t gid);
531 asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid);
532 asmlinkage long sys_setuid16(old_uid_t uid);
533 asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t 
suid);
534 asmlinkage long sys_getresuid16(old_uid_t __user *ruid,
535 old_uid_t __user *euid, old_uid_t __user 
*suid);
536 asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t 
sgid);
537 asmlinkage long sys_getresgid16(old_gid_t __user *rgid,
538 old_gid_t __user *egid, old_gid_t __user 
*sgid);
539 asmlinkage long sys_setfsuid16(old_uid_t uid);
540 asmlinkage long sys_setfsgid16(old_gid_t gid);
541 asmlinkage long sys_getgroups16(int gidsetsize, old_gid_t __user 
*grouplist);
542 asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user 
*grouplist);
543 asmlinkage long sys_getuid16(void);
544 asmlinkage long sys_geteuid16(void);
545 asmlinkage long sys_getgid16(void);
546 asmlinkage long sys_getegid16(void);
547 #endif

Thus I disabled such syscalls in libsanitizer with SANITIZER_WORDSIZE macro and 
disabled
type checks for __kernel_old_{uid,gid}_t. Did not touch the fragment which sets 
__kernel_old_{uid,gid}_t.

SANITIZER_WORDSIZE is set based on _LP64 macro.

If patch is acceptable I could do more tests after holidays.

Thanks,
david



pr64435v2.patch
Description: Binary data


Re: [PATCH, fortran, final] PR fortran/60255 Deferred character length

2014-12-31 Thread Janus Weil
Hi Andre,

> Now, the patch was not intended to solve 61337. Although I have looked into 
> the
> pseudo code generated for 61337, I couldn't figure easily what is going on
> there. In my impression, this is something from incorrectly computed bounds to
> an integer(8),pointer integer(4),pointer mix up. Therefore no patch for that
> from my side currently.

I think that this a completely different issue from that addressed by
your patch and I don't think you should tackle anything
non-character-related in your patch.


> Nevertheless, do I hope that some reviewer finds a minute to look at the patch
> for pr60255.

I had a look over the patch, and it looks mostly fine to me. A few remarks:

1) There are still two TODO markers in the patch. It might be a good
idea to take care of them before committing the patch. In particular
for the first one (adding the initializer in gfc_build_class_symbol)
it would be good to understand where those problems come from. For the
second one (in gfc_conv_expr), I don't directly see how it's related
to deferred char-len. Why is this change needed?

2) You're making a lot of changes to 'trans_associate_var', but I
don't see any ASSOCIATE statements covered in your test case. Can you
add more test cases which cover this code?

3) The function 'gfc_get_len_component' that you're introducing is
only called in a single place. Do you expect this to be useful in
other places in the future, or could one remove the function and
insert the code inline?

4) You're adding a prototype for a function
'gfc_assign_charlen_to_unlimited_poly' in gfortran.h which never gets
implemented.

5) The second hunk in find_intrinsic_vtab is a whitespace-only change
which should not occur at all AFAICS.

In any case, thanks for working on this!

Cheers,
Janus



> On Tue, 30 Dec 2014 16:35:48 +0100
> Dominique d'Humières  wrote:
>
>> The new patch fixes the ICEs, but still emit the wrong codes reported in
>> pr61337.
>>
>> Thanks and Happy New Year to all,
>>
>> Dominique
>>
>> > Le 30 déc. 2014 à 14:39, Andre Vehreschild  a écrit :
>> >
>> > Hi Dominique,
>> >
>> > thanks for pointing that out. That was caused by a flaw in the current
>> > patch. In the attached version this is fixed now.
>> >
>> > Bootstraps and regtests ok on x86_64-linux-gnu.
>> >
>> > Regards,
>> > Andre
>> >
>> > On Mon, 29 Dec 2014 16:32:27 +0100
>> > Dominique d'Humières  wrote:
>> >
>> >> For the record, compiling the tests in pr61337 with the patch applied on
>> >> top of r219099 gives ICEs:
>> >>
>> >>   use array_list
>> >> 1
>> >> internal compiler error: in gfc_advance_chain, at fortran/trans.c:58
>> >>
>> >> Since this replaces some wrong-code generation by some ICEs, I don’t think
>> >> this should delay the fix of pr60255.
>> >>
>> >> Cheers,
>> >>
>> >> Dominique
>>
>
>
> --
> Andre Vehreschild * Kreuzherrenstr. 8 * 52062 Aachen
> Tel.: +49 241 9291018 * Email: ve...@gmx.de


Re: [Patch, i386] Support AES, F16C, BMI and BMI2 targets in multiversioning

2014-12-31 Thread Jakub Jelinek
On Wed, Dec 31, 2014 at 01:28:47PM +0100, Allan Sandfeld Jensen wrote:
> I recently wanted to use multiversioning for BMI2 specific extensions 
> PDEP/PEXT, and noticed it wasn't there. So I wrote this patch to add it, and 
> also added AES, F16C and BMI1 for completeness.

AES nor F16C doesn't make any sense IMHO for multiversioning, you need
special intrinsics for that anyway and when you use them, the function will
fail to compile without those features.
Multiversioning only makes sense for ISA features the compiler uses for
normal C/C++ code without any intrinsics.

Jakub


[PATCH, gfortran]: Use xasprintf instead of unchecked asprintf

2014-12-31 Thread Uros Bizjak
Hello!

Trivial and almost mechanical patch.

2014-12-31  Uros Bizjak  

* trans-array.c (trans_array_bound_check): Use xasprintf instead
of unchecked asprintf.
(gfc_conv_array_ref): Ditto.
(gfc_conv_ss_startstride): Ditto.
(gfc_trans_dummy_array_bias): Ditto.
(gfc_conv_array_parameter): Ditto.
* trans-decl.c (gfc_generate_function_code): Ditto.
* trans-expr.c (gfc_conv_substring): Ditto.
(gfc_conv_procedure_call): Ditto.
* trans-io.c (gfc_trans_io_runtime_check): Ditto.
(set_string): Ditto.
* trans.c (trans-runtime_error_vararg): Ditto.

Bootstrapped and regression tested on x86_64-linux-gnu.

OK for mainline?

Uros.
Index: trans-array.c
===
--- trans-array.c   (revision 219123)
+++ trans-array.c   (working copy)
@@ -2799,11 +2799,11 @@ trans_array_bound_check (gfc_se * se, gfc_ss *ss,
   tmp_up = gfc_conv_array_ubound (descriptor, n);
 
   if (name)
-   asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
- "outside of expected range (%%ld:%%ld)", n+1, name);
+   msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
+"outside of expected range (%%ld:%%ld)", n+1, name);
   else
-   asprintf (&msg, "Index '%%ld' of dimension %d "
- "outside of expected range (%%ld:%%ld)", n+1);
+   msg = xasprintf ("Index '%%ld' of dimension %d "
+"outside of expected range (%%ld:%%ld)", n+1);
 
   fault = fold_build2_loc (input_location, LT_EXPR, boolean_type_node,
   index, tmp_lo);
@@ -2824,11 +2824,11 @@ trans_array_bound_check (gfc_se * se, gfc_ss *ss,
   tmp_lo = gfc_conv_array_lbound (descriptor, n);
 
   if (name)
-   asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
- "below lower bound of %%ld", n+1, name);
+   msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
+"below lower bound of %%ld", n+1, name);
   else
-   asprintf (&msg, "Index '%%ld' of dimension %d "
- "below lower bound of %%ld", n+1);
+   msg = xasprintf ("Index '%%ld' of dimension %d "
+"below lower bound of %%ld", n+1);
 
   fault = fold_build2_loc (input_location, LT_EXPR, boolean_type_node,
   index, tmp_lo);
@@ -3259,8 +3259,8 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * a
 
  cond = fold_build2_loc (input_location, LT_EXPR, boolean_type_node,
  indexse.expr, tmp);
- asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
-   "below lower bound of %%ld", n+1, var_name);
+ msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
+  "below lower bound of %%ld", n+1, var_name);
  gfc_trans_runtime_check (true, false, cond, &se->pre, where, msg,
   fold_convert (long_integer_type_node,
 indexse.expr),
@@ -3283,8 +3283,8 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * a
 
  cond = fold_build2_loc (input_location, GT_EXPR,
  boolean_type_node, indexse.expr, tmp);
- asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
-   "above upper bound of %%ld", n+1, var_name);
+ msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
+  "above upper bound of %%ld", n+1, var_name);
  gfc_trans_runtime_check (true, false, cond, &se->pre, where, msg,
   fold_convert (long_integer_type_node,
 indexse.expr),
@@ -3981,8 +3981,8 @@ done:
  /* Zero stride is not allowed.  */
  tmp = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node,
 info->stride[dim], gfc_index_zero_node);
- asprintf (&msg, "Zero stride is not allowed, for dimension %d "
-   "of array '%s'", dim + 1, expr_name);
+ msg = xasprintf ("Zero stride is not allowed, for dimension %d "
+  "of array '%s'", dim + 1, expr_name);
  gfc_trans_runtime_check (true, false, tmp, &inner,
   expr_loc, msg);
  free (msg);
@@ -4039,9 +4039,9 @@ done:
  tmp2 = fold_build2_loc (input_location, TRUTH_AND_EXPR,
  boolean_type_node,
  non_zerosized, tmp2);
- asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
-   "outside of expected range (%%ld:%%ld)",
-   dim + 1, expr_name);
+ msg = xa

Re: [Patch, i386] Support AES, F16C, BMI and BMI2 targets in multiversioning

2014-12-31 Thread Allan Sandfeld Jensen
On Wednesday 31 December 2014, Jakub Jelinek wrote:
> On Wed, Dec 31, 2014 at 01:28:47PM +0100, Allan Sandfeld Jensen wrote:
> > I recently wanted to use multiversioning for BMI2 specific extensions
> > PDEP/PEXT, and noticed it wasn't there. So I wrote this patch to add it,
> > and also added AES, F16C and BMI1 for completeness.
> 
> AES nor F16C doesn't make any sense IMHO for multiversioning, you need
> special intrinsics for that anyway and when you use them, the function will
> fail to compile without those features.
> Multiversioning only makes sense for ISA features the compiler uses for
> normal C/C++ code without any intrinsics.
> 
I disagree. You just include the intrinsics and use them. Inside a function 
with the right target rule they will work even if they don't outside. This 
works even without multiversioning, e.g. just specific functions with specific 
targets.

`Allan


PATCH: [5 Regression] r219037 caused FAIL: gcc.dg/pr44194-1.c

2014-12-31 Thread H.J. Lu
To fix a wrong code bug on HPPA with sibcall optimization, r219037 changes
DSE to treat sibcall as though it does a wild read.  However, it causes
a regression on x86:

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

This patch adds a sibcall_wild_read_p target hook, which returns true if
a sibcall have a wild read.  It defaults to SIBLING_CALL_P.  I added
hook_bool_rtx_insn_false and define TARGET_SIBCALL_WILD_READ_P as
hook_bool_rtx_insn_false for x86.  This patch restores the old behavior
before r219037.  Tested on x86.  OK for trunk?

Thanks.

H.J.
---
PR middle-end/64388
* dse.c (scan_insn): Call targetm.sibcall_wild_read_p to check
if a sibcall may have a wild read.
* hooks.c (hook_bool_rtx_insn_false): New.
* hooks.h (hook_bool_rtx_insn_false): Likewise.
* targhooks.c (default_sibcall_wild_read_p): Likewise.
* targhooks.h (default_sibcall_wild_read_p): Likewise.
* target.def (sibcall_wild_read_p): A new hook.
* config/i386/i386.c (TARGET_SIBCALL_WILD_READ_P): New. Defined
to hook_bool_rtx_insn_false.
* doc/tm.texi: Regenerated.
* doc/tm.texi.in: Add hook for TARGET_SIBCALL_WILD_READ_P.
---
 gcc/ChangeLog  | 15 +++
 gcc/config/i386/i386.c |  3 +++
 gcc/doc/tm.texi|  5 +
 gcc/doc/tm.texi.in |  2 ++
 gcc/dse.c  |  7 +--
 gcc/hooks.c|  6 ++
 gcc/hooks.h|  1 +
 gcc/target.def |  8 
 gcc/targhooks.c| 12 
 gcc/targhooks.h|  2 ++
 10 files changed, 55 insertions(+), 6 deletions(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 162fe26..9909391 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -51711,6 +51711,9 @@ ix86_initialize_bounds (tree var, tree lb, tree ub, 
tree *stmts)
 #undef TARGET_FUNCTION_OK_FOR_SIBCALL
 #define TARGET_FUNCTION_OK_FOR_SIBCALL ix86_function_ok_for_sibcall
 
+#undef TARGET_SIBCALL_WILD_READ_P
+#define TARGET_SIBCALL_WILD_READ_P hook_bool_rtx_insn_false
+
 #undef TARGET_MEMMODEL_CHECK
 #define TARGET_MEMMODEL_CHECK ix86_memmodel_check
 
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index a3fda45..1a78f05 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -2857,6 +2857,11 @@ machines with non orthogonal register usage for 
addressing, such
 as SH, this hook can be used to avoid excessive spilling.
 @end deftypefn
 
+@deftypefn {Target Hook} bool TARGET_SIBCALL_WILD_READ_P (rtx_insn *@var{insn})
+A target hook which returns @code{true} if a sibcall @var{insn} may
+have a wild read.
+@end deftypefn
+
 @deftypefn {Target Hook} bool TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT (rtx 
*@var{disp}, rtx *@var{offset}, machine_mode @var{mode})
 A target hook which returns @code{true} if *@var{disp} is
 legitimezed to valid address displacement with subtracting *@var{offset}
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 20c0129..0358235 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -2483,6 +2483,8 @@ as below:
 
 @hook TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P
 
+@hook TARGET_SIBCALL_WILD_READ_P
+
 @hook TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT
 
 @hook TARGET_SPILL_CLASS
diff --git a/gcc/dse.c b/gcc/dse.c
index 3a7f31c..c0e1a0c 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -2483,12 +2483,7 @@ scan_insn (bb_info_t bb_info, rtx_insn *insn)
 
   insn_info->cannot_delete = true;
 
-  /* Arguments for a sibling call that are pushed to memory are passed
-using the incoming argument pointer of the current function.  These
-may or may not be frame related depending on the target.  Since
-argument pointer related stores are not currently tracked, we treat
-a sibling call as though it does a wild read.  */
-  if (SIBLING_CALL_P (insn))
+  if (targetm.sibcall_wild_read_p (insn))
{
  add_wild_read (bb_info);
  return;
diff --git a/gcc/hooks.c b/gcc/hooks.c
index f698d1d..7ac6c8a 100644
--- a/gcc/hooks.c
+++ b/gcc/hooks.c
@@ -320,6 +320,12 @@ hook_bool_rtx_insn_true (rtx_insn *insn ATTRIBUTE_UNUSED)
 }
 
 bool
+hook_bool_rtx_insn_false (rtx_insn *insn ATTRIBUTE_UNUSED)
+{
+  return false;
+}
+
+bool
 hook_bool_rtx_false (rtx a ATTRIBUTE_UNUSED)
 {
   return false;
diff --git a/gcc/hooks.h b/gcc/hooks.h
index b1b312d..988724c 100644
--- a/gcc/hooks.h
+++ b/gcc/hooks.h
@@ -54,6 +54,7 @@ extern bool hook_bool_const_tree_hwi_hwi_const_tree_true 
(const_tree,
  HOST_WIDE_INT,
  const_tree);
 extern bool hook_bool_rtx_insn_true (rtx_insn *);
+extern bool hook_bool_rtx_insn_false (rtx_insn *);
 extern bool hook_bool_rtx_false (rtx);
 extern bool hook_bool_rtx_insn_int_false (rtx_insn *, int);
 extern bool hook_bool_uintp_uintp_false (unsigned int

Re: [PATCH, fortran, final] PR fortran/60255 Deferred character length

2014-12-31 Thread Andre Vehreschild
Hi Janus,

thank you for your review. 

> I had a look over the patch, and it looks mostly fine to me. A few remarks:
> 
> 1) There are still two TODO markers in the patch. It might be a good
> idea to take care of them before committing the patch. In particular
> for the first one (adding the initializer in gfc_build_class_symbol)
> it would be good to understand where those problems come from. 

I started with the initializer for the _len component and ran into "Pointer
assignment target is neither TARGET nor POINTER at %L" errors (expr.c:3714). I
tracked this back to the constructor resolve of the class type. Resolving the
constructor somehow concludes, that something needs to be done for the constant
initializer although it is marked artificial. I could not track down the
location that is causing this behavior, or if I need to set a flag in the class
itself to get through with it. I am hoping, that either some fortran guru says
"You just need to do xyz to get it running." or that we conclude to remove the
TODO and the commented instructions (setting a zero value for _len is done where
needed (gfc_conv_structure trans-expr.c:6540)).

> For the
> second one (in gfc_conv_expr), I don't directly see how it's related
> to deferred char-len. Why is this change needed?

That change is needed, because in some rare case where an associated variable
in a "select type ()" is used, then the type and f90_type match the condition
while them not really being in a bind_c context. Therefore I have added
the check for bind_c. Btw, I now have removed the TODO, because that case is
covered by the regression tests. 

> 2) You're making a lot of changes to 'trans_associate_var', but I
> don't see any ASSOCIATE statements covered in your test case. Can you
> add more test cases which cover this code?

Select type (assoc => upoly) uses these where an explicit assoc is supplied.
The many changes are needed to migrate from using _vptr%size to then _len
component. All these changes are covered by existing regression tests starting
from unlimited_polymorphic_N.* to the character_length tests. The remaining open
cases not covered by existing tests are in unlimited_polymorphic_20.f03.

> 3) The function 'gfc_get_len_component' that you're introducing is
> only called in a single place. Do you expect this to be useful in
> other places in the future, or could one remove the function and
> insert the code inline?

In one of the first versions it was uses from two locations. But I had to
remove one call site again. I am currently not sure, if I will be using it in
the patch for allocatable components when deferred char arrays are handled. So
what I do I do now? Inline it and when needed make it explicit again in a
future patch?

> 4) You're adding a prototype for a function
> 'gfc_assign_charlen_to_unlimited_poly' in gfortran.h which never gets
> implemented.

Whoopsie, sorry, removed. 

> 5) The second hunk in find_intrinsic_vtab is a whitespace-only change
> which should not occur at all AFAICS.

Yep, agreed. Misconfigured my IDE. Fixed. Sorry for the noise.


So two open questions remain:
ad 1) How to handle the initializer?
ad 3) What to do with the function?

Can you give me an opinion, then I will change the patch and resubmit.

> In any case, thanks for working on this!

Your welcome and happy new year to you.

Regards,
Andre

Btw, just cleaning up some oddities in the allocatable component patch for
pr60357/pr61337/pr55901 (and may be covering others). Then that one goes
public, too. (pr60357 is just my working title. I know it is fixed already by
your patch.)

> 
> Cheers,
> Janus
> 
> 
> 
> > On Tue, 30 Dec 2014 16:35:48 +0100
> > Dominique d'Humières  wrote:
> >
> >> The new patch fixes the ICEs, but still emit the wrong codes reported in
> >> pr61337.
> >>
> >> Thanks and Happy New Year to all,
> >>
> >> Dominique
> >>
> >> > Le 30 déc. 2014 à 14:39, Andre Vehreschild  a écrit :
> >> >
> >> > Hi Dominique,
> >> >
> >> > thanks for pointing that out. That was caused by a flaw in the current
> >> > patch. In the attached version this is fixed now.
> >> >
> >> > Bootstraps and regtests ok on x86_64-linux-gnu.
> >> >
> >> > Regards,
> >> > Andre
> >> >
> >> > On Mon, 29 Dec 2014 16:32:27 +0100
> >> > Dominique d'Humières  wrote:
> >> >
> >> >> For the record, compiling the tests in pr61337 with the patch applied on
> >> >> top of r219099 gives ICEs:
> >> >>
> >> >>   use array_list
> >> >> 1
> >> >> internal compiler error: in gfc_advance_chain, at fortran/trans.c:58
> >> >>
> >> >> Since this replaces some wrong-code generation by some ICEs, I don’t
> >> >> think this should delay the fix of pr60255.
> >> >>
> >> >> Cheers,
> >> >>
> >> >> Dominique
> >>
> >
> >
> > --
> > Andre Vehreschild * Kreuzherrenstr. 8 * 52062 Aachen
> > Tel.: +49 241 9291018 * Email: ve...@gmx.de


-- 
Andre Vehreschild * Kreuzherrenstr. 8 * 52062 Aachen
Tel.: +49 241 9291018 * Email: ve...@gmx.de 


Re: [PATCH, gfortran]: Use xasprintf instead of unchecked asprintf

2014-12-31 Thread Tobias Burnus

Hello Uros, hi all,

Happy New Year to all.

Uros Bizjak wrote:

Trivial and almost mechanical patch.

2014-12-31  Uros Bizjak  

 * trans-array.c (trans_array_bound_check): Use xasprintf instead
 of unchecked asprintf.
 (gfc_conv_array_ref): Ditto.
 (gfc_conv_ss_startstride): Ditto.
 (gfc_trans_dummy_array_bias): Ditto.
 (gfc_conv_array_parameter): Ditto.
 * trans-decl.c (gfc_generate_function_code): Ditto.
 * trans-expr.c (gfc_conv_substring): Ditto.
 (gfc_conv_procedure_call): Ditto.
 * trans-io.c (gfc_trans_io_runtime_check): Ditto.
 (set_string): Ditto.
 * trans.c (trans-runtime_error_vararg): Ditto.

Bootstrapped and regression tested on x86_64-linux-gnu.
OK for mainline?


OK. Thanks for the patch!

Tobias


[Patch, Fortran] (F2015) Permit ERROR STOP in PURE procedures

2014-12-31 Thread Tobias Burnus
It often happens that one wants to debug PURE procedures but as I/O is 
not permitted, this can be difficult. F2008's IMPURE ELEMENTAL helps a 
bit not completely.


Fortran 2015 adds another aid – not I/O which is intrinsically impure – 
but at least ERROR STOP is now permitted.


Attached is this belate Christmas present for Damian and the second 
F2015 for GCC 5. (The first was "IMPLICIT NONE (external)".)


Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias
gcc/fortran/
2014-12-31  Tobias Burnus  

	* match.c (gfc_match_stopcode): Permit error stop in pure
	procedures with F2015.

gcc/testsuite/
2014-12-31  Tobias Burnus  

	* gfortran.dg/error_stop_3.f90: New.
	* gfortran.dg/error_stop_4.f90: New.
	* gfortran.dg/coarray_3.f90: Remove a dg-error.

diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index fb68eec..2b4202b 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -2557,7 +2557,8 @@ gfc_match_cycle (void)
 }
 
 
-/* Match a number or character constant after an (ALL) STOP or PAUSE statement.  */
+/* Match a number or character constant after an (ERROR) STOP or PAUSE
+   statement.  */
 
 static match
 gfc_match_stopcode (gfc_statement st)
@@ -2581,9 +2582,18 @@ gfc_match_stopcode (gfc_statement st)
 
   if (gfc_pure (NULL))
 {
-  gfc_error ("%s statement not allowed in PURE procedure at %C",
-		 gfc_ascii_statement (st));
-  goto cleanup;
+  if (st == ST_ERROR_STOP)
+	{
+	  if (!gfc_notify_std (GFC_STD_F2015, "%s statement at %C in PURE "
+			   "procedure", gfc_ascii_statement (st)))
+	goto cleanup;
+	}
+  else
+	{
+	  gfc_error ("%s statement not allowed in PURE procedure at %C",
+		 gfc_ascii_statement (st));
+	  goto cleanup;
+	}
 }
 
   gfc_unset_implicit_pure (NULL);
diff --git a/gcc/testsuite/gfortran.dg/coarray_3.f90 b/gcc/testsuite/gfortran.dg/coarray_3.f90
index 63c3bd3..aba4eb1 100644
--- a/gcc/testsuite/gfortran.dg/coarray_3.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_3.f90
@@ -79,7 +79,7 @@ pure subroutine pureSub()
   critical ! { dg-error "Image control statement CRITICAL" }
   end critical ! { dg-error "Expecting END SUBROUTINE statement" }
   sync all ! { dg-error "Image control statement SYNC" }
-  error stop ! { dg-error "not allowed in PURE procedure" }
+  error stop
 end subroutine pureSub
 
 
diff --git a/gcc/testsuite/gfortran.dg/error_stop_3.f90 b/gcc/testsuite/gfortran.dg/error_stop_3.f90
new file mode 100644
index 000..40fe5de
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/error_stop_3.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "-std=gnu" }
+!
+! F2015 permits ERROR STOP in PURE procedures
+! FIXME: Change to -std=f2015, when available
+!
+pure subroutine foo()
+  error stop "failed"  ! { dg-error "GNU Extension: ERROR STOP statement at .1. in PURE procedure" }
+end
diff --git a/gcc/testsuite/gfortran.dg/error_stop_4.f90 b/gcc/testsuite/gfortran.dg/error_stop_4.f90
new file mode 100644
index 000..703a2f2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/error_stop_4.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "-std=f2008ts" }
+!
+! F2015 permits ERROR STOP in PURE procedures
+! FIXME: Change to error_stop_3.f90 to -std=f2015.
+!
+pure subroutine foo()
+  error stop "failed"
+end


[PATCH, ada]: Use xasprintf instead of unchecked asprintf

2014-12-31 Thread Uros Bizjak
Hello!

The ada part.

2014-12-31  Uros Bizjak  

* gcc-interface/misc.c (internal_error_function): Use xasprintf instead
of unchecked asprintf.

Although almost trivial, this patch is *not* tested, so I'd kindly ask
someone to bootstrap and regresion test this patch.

Uros.
Index: ChangeLog
===
--- ChangeLog   (revision 219123)
+++ ChangeLog   (working copy)
@@ -1,3 +1,8 @@
+2014-12-31  Uros Bizjak  
+
+   * gcc-interface/misc.c (internal_error_function): Use xasprintf instead
+   of unchecked asprintf.
+
 2014-12-22  Eric Botcazou  
 
* gcc-interface/trans.c (Attribute_to_gnu) : If the
Index: gcc-interface/misc.c
===
--- gcc-interface/misc.c(revision 219123)
+++ gcc-interface/misc.c(working copy)
@@ -326,9 +326,9 @@ internal_error_function (diagnostic_context *conte
 
   xloc = expand_location (input_location);
   if (context->show_column && xloc.column != 0)
-asprintf (&loc, "%s:%d:%d", xloc.file, xloc.line, xloc.column);
+loc = xasprintf ("%s:%d:%d", xloc.file, xloc.line, xloc.column);
   else
-asprintf (&loc, "%s:%d", xloc.file, xloc.line);
+loc = xasprintf ("%s:%d", xloc.file, xloc.line);
   temp_loc.Low_Bound = 1;
   temp_loc.High_Bound = strlen (loc);
   sp_loc.Bounds = &temp_loc;


[PATCH] Dejagnu fixes for TLS on AIX

2014-12-31 Thread David Edelsohn
On AIX, GCC needs to build a multilib for AIX.  When testing in tree,
the Dejagnu infrastructure adds linking options for the default,
non-pthread multilib.  This causes failures for the G++ TLS tests.

The following patch uses the existing add_options_for_tls
infrastructure to adjust the flags to prepend the pthread multilib
before the other options.  The patch also XFAILs three assembler tests
on AIX.  This fixes all of the TLS tests on AIX.

Is the Dejagnu library change okay?

Bootstrapped on powerpc-ibm-aix7.1.2.0

Thanks, David

* lib/target-support.exp (add_options_for_tls): Prepend pthread link flags.
* g++.dg/tls/thread_local1.C: XFAIL on AIX.
* g++.dg/tls/thread_local7.C: Same.
* g++.dg/tls/thread_local7g.C: Same.

Index: lib/target-supports.exp
===
--- lib/target-supports.exp (revision 219126)
+++ lib/target-supports.exp (working copy)
@@ -596,7 +596,7 @@
 int f (void) { return i; }
 void g (int j) { i = j; }
 }] } {
-   return "$flags -pthread"
+   return "-pthread [g++_link_flags [get_multilibs "-pthread"] ] $flags "
 }
 return $flags
 }
Index: g++.dg/tls/thread_local1.C
===
--- g++.dg/tls/thread_local1.C  (revision 219126)
+++ g++.dg/tls/thread_local1.C  (working copy)
@@ -7,7 +7,7 @@
 // simultaneous execution.
 // { dg-final { scan-assembler-not "cxa_guard" } }
 // The guard should be TLS, not local common.
-// { dg-final { scan-assembler-not "\.comm" } }
+// { dg-final { scan-assembler-not "\.comm" { xfail powerpc-*-aix* } } }

 struct A
 {
Index: g++.dg/tls/thread_local7.C
===
--- g++.dg/tls/thread_local7.C  (revision 219126)
+++ g++.dg/tls/thread_local7.C  (working copy)
@@ -2,7 +2,7 @@
 // { dg-require-effective-target tls }

 // The reference temp should be TLS, not normal data.
-// { dg-final { scan-assembler-not "\\.data" { target tls_native } } }
+// { dg-final { scan-assembler-not "\\.data" { target tls_native
xfail powerpc-*-aix* } } }

 void f()
 {
Index: g++.dg/tls/thread_local7g.C
===
--- g++.dg/tls/thread_local7g.C (revision 219126)
+++ g++.dg/tls/thread_local7g.C (working copy)
@@ -2,7 +2,7 @@
 // { dg-require-effective-target tls }

 // The reference temp should be TLS, not normal data.
-// { dg-final { scan-assembler-not "\\.data" { target tls_native } } }
+// { dg-final { scan-assembler-not "\\.data" { target tls_native
xfail powerpc-*-aix* } } }

 thread_local int&& ir = 42;


Re: [Patch, Fortran] (F2015) Permit ERROR STOP in PURE procedures

2014-12-31 Thread Janus Weil
Hi Tobias,

> It often happens that one wants to debug PURE procedures but as I/O is not
> permitted, this can be difficult. F2008's IMPURE ELEMENTAL helps a bit not
> completely.
>
> Fortran 2015 adds another aid – not I/O which is intrinsically impure – but
> at least ERROR STOP is now permitted.
>
> Attached is this belate Christmas present for Damian and the second F2015
> for GCC 5. (The first was "IMPLICIT NONE (external)".)
>
> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?

looks (almost) ok to me. Just one thing about your test cases:
Shouldn't the dg-error go into error_stop_4.f90 (where you have
-std=f2008ts) instead of error_stop_3.f90 (with -std=gnu)? And then:

-/* Match a number or character constant after an (ALL) STOP or PAUSE
statement.  */
+/* Match a number or character constant after an (ERROR) STOP or PAUSE
+   statement.  */

I don't actually understand what the "(ALL)" was supposed to mean
here. There is nothing like an ALL STOP statement, right? Or was it
just supposed to refer to *all kinds* of STOP statements? In any case
it's good that it is corrected.

Btw: It's probably not worth to introduce an option like -std=f2015
yet, but since there is an early draft document already, maybe it
would make sense to start a wiki page to document which of those F15
draft features are implemented already?

Thanks for the patch,
Janus


[PATCH] pass pr20621 testcase on a small stack target

2014-12-31 Thread James Bowman
Test pr20621 requires a target with more than 64K of available stack.
This patch adds a path to pass the test when the target has declared 
a STACK_SIZE of 64K or less

2014-12-30  James Bowman  

  * gcc/testsuite/gcc.c-torture/execute/pr20621-1.c:
  pass if stack < 64K

Index: gcc/testsuite/gcc.c-torture/execute/pr20621-1.c
===
--- gcc/testsuite/gcc.c-torture/execute/pr20621-1.c (revision 215531)
+++ gcc/testsuite/gcc.c-torture/execute/pr20621-1.c (working copy)
@@ -1,6 +1,10 @@
 /* When generating o32 MIPS PIC, main's $gp save slot was out of range
of a single load instruction.  */
+#if defined(STACK_SIZE) && STACK_SIZE <= 0x1
+int main (void) { return 0; }
+#else
 struct big { int i[sizeof (int) >= 4 && sizeof (void *) >= 4 ? 0x4000 : 4]; };
 struct big gb;
 int foo (struct big b, int x) { return b.i[x]; }
 int main (void) { return foo (gb, 0) + foo (gb, 1); }
+#endif

--
James Bowman
FTDI Open Source Liaison


Re: [Patch, Fortran] (F2015) Permit ERROR STOP in PURE procedures

2014-12-31 Thread Tobias Burnus

Hi Janus,

Janus Weil wrote:

looks (almost) ok to me. Just one thing about your test cases:
Shouldn't the dg-error go into error_stop_4.f90 (where you have
-std=f2008ts) instead of error_stop_3.f90 (with -std=gnu)?


Yes, I missed to re-diff it, after realizing that I mis-inserted the 
dg-error.



And then:
-/* Match a number or character constant after an (ALL) STOP or PAUSE
statement.  */
+/* Match a number or character constant after an (ERROR) STOP or PAUSE
+   statement.  */

I don't actually understand what the "(ALL)" was supposed to mean
here.


The draft Fortran 2008 standard had "ALL STOP" to stop all images of a 
parallel coarray program when an error occurred. They later renamed it 
to ERROR STOP. In my coarray draft patches, I first had ALL STOP and 
then – before the merge (for GCC 4.6, 2010-03) – J3/WG5 renamed it to 
ERROR STOP. Seemingly, I missed that comment when doing the name change.


Committed as Rev. 219127.


Btw: It's probably not worth to introduce an option like -std=f2015
yet, but since there is an early draft document already, maybe it
would make sense to start a wiki page to document which of those F15
draft features are implemented already?


Currently, it's listed at https://gcc.gnu.org/gcc-5/changes.html#fortran 
and 
https://gcc.gnu.org/wiki/GFortran/News#gfortran_5_.28current_development_version.29 
; I think we should wait a bit before starting a 
https://gcc.gnu.org/wiki/Fortran2015Status page. (The "Introduction" of 
the F2015 standard lists the major new features.)


Regarding  -std=f2015: I think we should add that option once the GCC 6 
development starts.


Tobias


[www-data, patch, committed] gcc-5/changed.html: Fortran: Add F2015's ERROR STOP in pure

2014-12-31 Thread Tobias Burnus

Committed patch attached.

Tobias
Index: changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.55
diff -p -u -r1.55 changes.html
--- changes.html	30 Dec 2014 18:17:15 -	1.55
+++ changes.html	31 Dec 2014 17:19:09 -
@@ -380,6 +380,7 @@ void operator delete[] (void *, std::siz
 Fortran 2015:
 
   Support for IMPLICIT NONE (external, type).
+  ERROR STOP is now permitted in pure procedures.
 
   
 


Re: [Patch, Fortran] PR 60507: Passing function call into procedure argument not caught

2014-12-31 Thread Janus Weil
(early) ping!


2014-12-29 13:50 GMT+01:00 Janus Weil :
> Hi all,
>
> here is a patch to improve diagnostics for dummy procedures. Regtested
> on x86_64-unknown-linux-gnu. Ok for trunk?
>
> Cheers,
> Janus
>
>
>
> 2014-12-29  Janus Weil  
>
> PR fortran/60507
> * interface.c (is_procptr_result): New function to check if an
> expression is a procedure-pointer result.
> (compare_actual_formal): Use it.
>
> 2014-12-29  Janus Weil  
>
> PR fortran/60507
> * gfortran.dg/dummy_procedure_11: New.


[Patch, Fortran] add co_reduce to libcaf_single

2014-12-31 Thread Tobias Burnus
Looking through the stashed patches, I realized a pending (unsubmitted) 
patch, showing that both a test case for CO_REDUCE was missing and that 
libcaf_single didn't include co_reduce.


This patch adds them.

Build and regtested on x86-64-gnu-linux.
OK for the trunk?

[Still to do for co_reduce: Checking whether any recent changes to the 
coarray draft requires changes to that feature. I think there were 
changes to co_reduce.]


Tobias

PS: For GCC 5, I really should complete the coarray support: add LOCKING 
as missing F2008 feature (basic support only; currently its pretending 
to always succeed), catch at compile time unsupported features (rather 
than to fail at run time with wrong results) plus adding vector support 
in libcaf_single.
2014-12-31  Tobias Burnus  

	* caf/single.c (_gfortran_caf_co_reduce): New function.
	* caf/libcaf.h (_gfortran_caf_co_reduce): New prototype.

2014-12-31  Tobias Burnus  

	* gfortran.dg/coarray/collectives_4.f90: New.

Index: libgfortran/caf/libcaf.h
===
--- libgfortran/caf/libcaf.h	(Revision 219126)
+++ libgfortran/caf/libcaf.h	(Arbeitskopie)
@@ -110,6 +110,8 @@ void _gfortran_caf_co_broadcast (gfc_descriptor_t
 void _gfortran_caf_co_sum (gfc_descriptor_t *, int, int *, char *, int);
 void _gfortran_caf_co_min (gfc_descriptor_t *, int, int *, char *, int, int);
 void _gfortran_caf_co_max (gfc_descriptor_t *, int, int *, char *, int, int);
+void _gfortran_caf_co_reduce (gfc_descriptor_t *, void* (*) (void *, void*),
+			  int, int, int *, char *, int, int);
 
 void _gfortran_caf_get (caf_token_t, size_t, int, gfc_descriptor_t *,
 caf_vector_t *, gfc_descriptor_t *, int, int, bool);
Index: libgfortran/caf/single.c
===
--- libgfortran/caf/single.c	(Revision 219126)
+++ libgfortran/caf/single.c	(Arbeitskopie)
@@ -254,6 +254,21 @@ _gfortran_caf_co_max (gfc_descriptor_t *a __attrib
 }
 
 
+void
+_gfortran_caf_co_reduce (gfc_descriptor_t *a __attribute__ ((unused)),
+void * (*opr) (void *, void *)
+   __attribute__ ((unused)),
+int opr_flags __attribute__ ((unused)),
+int result_image __attribute__ ((unused)),
+int *stat, char *errmsg __attribute__ ((unused)),
+int a_len __attribute__ ((unused)),
+int errmsg_len __attribute__ ((unused)))
+ {
+   if (stat)
+ *stat = 0;
+ }
+
+
 static void
 assign_char4_from_char1 (size_t dst_size, size_t src_size, uint32_t *dst,
 			 unsigned char *src)
Index: gcc/testsuite/gfortran.dg/coarray/collectives_4.f90
===
--- gcc/testsuite/gfortran.dg/coarray/collectives_4.f90	(Revision 0)
+++ gcc/testsuite/gfortran.dg/coarray/collectives_4.f90	(Arbeitskopie)
@@ -0,0 +1,24 @@
+! { dg-do run }
+!
+! CO_REDUCE
+!
+implicit none (type, external)
+intrinsic :: co_reduce
+integer :: stat
+integer :: i4, i4_2, i
+
+i4 = 21 * this_image()
+i4_2 = 21
+do i = 2, num_images()
+  i4_2 = i4_2 * 21 * i
+end do
+call co_reduce(i4, op_i4, stat=stat)
+if (stat /= 0) call abort()
+if (i4_2 /= i4) call abort()
+
+contains
+  pure integer function op_i4(a,b)
+integer, value :: a, b
+op_i4 = a * b
+  end function op_i4
+end


Re: [Patch, Fortran] PR 60507: Passing function call into procedure argument not caught

2014-12-31 Thread Tobias Burnus

Janus Weil wrote:

here is a patch to improve diagnostics for dummy procedures. Regtested
on x86_64-unknown-linux-gnu. Ok for trunk?


Looks good to me. Thanks for the patch!

Tobias


2014-12-29  Janus Weil  

 PR fortran/60507
 * interface.c (is_procptr_result): New function to check if an
 expression is a procedure-pointer result.
 (compare_actual_formal): Use it.

2014-12-29  Janus Weil  

 PR fortran/60507
 * gfortran.dg/dummy_procedure_11: New.


Re: [PATCH, libgo] Backport fix for compiler flags in mksysinfo.sh to gcc 4.9

2014-12-31 Thread Ian Lance Taylor
On Tue, Dec 30, 2014 at 11:33 AM, Lynn A. Boger
 wrote:
> Hi,
>
> Please backport the change from
> https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00713.html to gcc 4.9.
>
> 2014-12-30  Lynn Boger 
>
> * libgo/mksysinfo.sh:  Add the same compiler flags used by configure to
> detect whether off64_t is present
>when generating the go structures for C types.  Otherwise the go type
> for off64_t might not be
>generated.

The patch you attached is not a backport of the change to trunk.

Ian


Re: [PATCH] pass pr20621 testcase on a small stack target

2014-12-31 Thread Mike Stump
On Dec 31, 2014, at 8:46 AM, James Bowman  wrote:
> Test pr20621 requires a target with more than 64K of available stack.
> This patch adds a path to pass the test when the target has declared 
> a STACK_SIZE of 64K or less
> 
> 2014-12-30  James Bowman  
> 
>  * gcc/testsuite/gcc.c-torture/execute/pr20621-1.c:
>  pass if stack < 64K

Be sure to ask Ok? on work you want reviewed and approved explicitly.  Feels 
like you wanted to ask, but did not.

Ok.

On the changelog comment, upper case the first letter and end with a period.

  Pass if stack < 64K.

Re: [PATCH] Dejagnu fixes for TLS on AIX

2014-12-31 Thread Mike Stump
On Dec 31, 2014, at 8:44 AM, David Edelsohn  wrote:
> On AIX, GCC needs to build a multilib for AIX.  When testing in tree,
> the Dejagnu infrastructure adds linking options for the default,
> non-pthread multilib.  This causes failures for the G++ TLS tests.
> 
> The following patch uses the existing add_options_for_tls
> infrastructure to adjust the flags to prepend the pthread multilib
> before the other options.  The patch also XFAILs three assembler tests
> on AIX.  This fixes all of the TLS tests on AIX.
> 
> Is the Dejagnu library change okay?

Ok.


Re: [Patch, libstdc++/64441] Fix sub_match::first and second

2014-12-31 Thread David Edelsohn
After this patch I now see

FAIL: 28_regex/algorithms/regex_match/ecma/char/backref.cc execution test

on AIX.

Thanks, David


Re: [Patch, libstdc++/64441] Fix sub_match::first and second

2014-12-31 Thread Tim Shen
On Wed, Dec 31, 2014 at 4:17 PM, David Edelsohn  wrote:
> FAIL: 28_regex/algorithms/regex_match/ecma/char/backref.cc execution test
>
> on AIX.

Oops, a dumb mistake from fixing a dumb mistake. Thanks David! :)

Bootstrapped and tested.


-- 
Regards,
Tim Shen
commit adee3fe36298ddd79ec04a1e8c3ccacf76514479
Author: timshen 
Date:   Wed Dec 31 19:07:55 2014 -0800

* include/bits/regex_executor.tcc (_Executor<>::_M_dfs): Copy the
iterator, since the original one shouldn't be mutated.

diff --git a/libstdc++-v3/include/bits/regex_executor.tcc 
b/libstdc++-v3/include/bits/regex_executor.tcc
index 7954d06..a973667 100644
--- a/libstdc++-v3/include/bits/regex_executor.tcc
+++ b/libstdc++-v3/include/bits/regex_executor.tcc
@@ -310,7 +310,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (!__submatch.matched)
  break;
auto __last = _M_current;
-   for (auto& __tmp = __submatch.first;
+   for (auto __tmp = __submatch.first;
 __last != _M_end && __tmp != __submatch.second;
 ++__tmp)
  ++__last;