Re: [PATCH] microblaze: microblaze.md: Use 'SI' instead of 'VOID' for operand 1 of 'call_value_intern'

2014-11-29 Thread Chen Gang
Hello Maintainers:

After analysing, it is not kernel's issue, it is gcc issue, after let
kernel related variable bypass this gcc issue, the kernel can start up
successfully.

The issue is "after declaration, the __attribute_((__section__ ...))
will be ignored". After simplification, the related shell commands are:

  [root@localhost ana]# cat test.i
  extern int a;
  int a __attribute__((__section__(".data..init_task"))) = 0;
  [root@localhost ana]# /upstream/release/bin/microblaze-gchen-linux-gcc -c -o 
test.o test.i -save-temps
  [root@localhost ana]# cat test.s
.globl  a
.bss
.lcomm  a,4,4
.type   a, @object
  [root@localhost ana]# microblaze-linux-gnu-gcc -c -o test.o test.i -save-temps
  [root@localhost ana]# cat test.s
.globl  a
.section.data..init_task,"aw",@progbits
.align  2
.type   a,@object
.size   a,4
  a:
.space  4
  [root@localhost ana]# /upstream/release/bin/microblaze-gchen-linux-gcc -v
  Using built-in specs.
  COLLECT_GCC=/upstream/release/bin/microblaze-gchen-linux-gcc
  
COLLECT_LTO_WRAPPER=/upstream/release/libexec/gcc/microblaze-gchen-linux/5.0.0/lto-wrapper
  Target: microblaze-gchen-linux
  Configured with: ../gcc-new/configure --target=microblaze-gchen-linux 
--disable-nls --enable-languages=c --disable-threads --disable-shared 
--with-headers=/upstream/release/kernel --disable-libssp --disable-libquadmath 
--disable-libgomp --disable-libatomic --with-sysroot=/upstream/release 
--prefix=/upstream/release : (reconfigured) ../gcc-new/configure 
--target=microblaze-gchen-linux --disable-nls --disable-threads 
--disable-shared --with-headers=/upstream/release/kernel --disable-libssp 
--disable-libquadmath --disable-libgomp --disable-libatomic 
--with-sysroot=/upstream/release --prefix=/upstream/release 
target_alias=microblaze-gchen-linux --enable-languages=c,lto --no-create 
--no-recursion
  Thread model: single
  gcc version 5.0.0 20140925 (experimental) (GCC) 


And it is fixed in the latest microblaze gcc version, but the latest gcc
will cause another issue for compiling kernel. I shall try to analyse it
within next month (2014-12-31), the related issue is:

  net/core/dev.c: In function 'register_netdevice':
  net/core/dev.c:7285:1: internal compiler error: in verify_ssa, at 
tree-ssa.c:939
   subsys_initcall(net_dev_init);
   ^
  0xbf77ab verify_ssa(bool, bool)
  ../../gcc-microblaze/gcc/tree-ssa.c:939
  0x956e6b execute_function_todo
  ../../gcc-microblaze/gcc/passes.c:1947
  0x95756d do_per_function
  ../../gcc-microblaze/gcc/passes.c:1639
  0x957683 execute_todo
  ../../gcc-microblaze/gcc/passes.c:1997
  Please submit a full bug report,
  with preprocessed source if appropriate.
  Please include the complete backtrace with any bug report.
  See <http://gcc.gnu.org/bugs.html> for instructions.
  make[2]: *** [net/core/dev.o] Error 1
  [root@localhost ana]# 
/upstream/release-microblaze/bin/microblaze-gchen-linux-gcc -v
  Using built-in specs.
  COLLECT_GCC=/upstream/release-microblaze/bin/microblaze-gchen-linux-gcc
  
COLLECT_LTO_WRAPPER=/upstream/release-microblaze/libexec/gcc/microblaze-gchen-linux/5.0.0/lto-wrapper
  Target: microblaze-gchen-linux
  Configured with: ../gcc-microblaze/configure --target=microblaze-gchen-linux 
--disable-nls --enable-languages=c --disable-threads --disable-shared 
--with-headers=/upstream/release-microblaze/kernel --disable-libssp 
--disable-libquadmath --disable-libgomp --disable-libatomic 
--with-sysroot=/upstream/release-microblaze 
--prefix=/upstream/release-microblaze
  Thread model: single
  gcc version 5.0.0 20141129 (experimental) (GCC) 


After finish analysing, I shall start "make check" under microblaze qemu
(may need about 12-13 days for testing).

Welcome any ideas, suggestions, and completions.

Thanks.

On 11/20/2014 11:33 PM, Chen Gang wrote:
> 
> Oh, sorry, after ran more than 10 days, the qemu crashed :-(
> 
> After checked the output log, and compare with the original log, we know
> we have finished more than 90% test, and it is OK (no any new issues).
> I guess the reason is I started too many other things on this machine.
> 
> Next, I shall try to analyze "the cross compiled Linux kernel will run
> in dead lock" issue. After finish analyzing, I shall restart the test.
> I guess it needs 12-13 days (more than a week -- I originally expected).
> 
> Thanks.
> 
> On 11/9/14 21:15, Chen Gang wrote:
>>
>> At present, I use simplified sshd, ssh and scp (dropbear open source
>> program) to communicate with microblaze qemu successfully, and let gcc
>> 'make check' have real effect.
>>
>> It is just testing, at least after almost 10 hours, the log output is
>> OK. For each ssh login, it will wast 10 - 20 seconds, so I guess, the
>> "make c

Re: [PATCH] Use = NULL default value for {make,copy}_ssa_name and create_tmp_{reg,var{,_raw}} last argument

2014-11-29 Thread Richard Biener
On November 28, 2014 8:02:23 PM CET, Jakub Jelinek  wrote:
>Hi!
>
>As the following patch shows, , NULL) is passed to these 5 functions
>way too often that forcing everybody to spell it everywhere seems to
>verbose, leading to formatting issues and making code less readable.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok.

>As possible follow-up, I wonder if gimple_build_assign_with_ops
>isn't too long and too verbose either, couldn't we just
>use overloads of gimple_build_assign instead?

Sure.

>Either with the argument order of gimple_build_assign_with_ops,
>i.e. tree_code, lhs, operands... , or perhaps swap the lhs and
>tree_code, so lhs, tree_code, operands... In either case, I'd
>find it to be pretty much unambiguous with the current two operand
>gimple_build_assign which takes lhs, treeop, the presence of
>enum tree_code would make it obvious that you are supplying ops for it
>rather than building it from what is extracted from the tree.
>Thoughts on that?

Swapping tree_code and lhs makes sense I think.

Richard.

>
>2014-11-28  Jakub Jelinek  
>
>   * gimple-expr.h (create_tmp_var_raw, create_tmp_var,
>   create_tmp_reg): Add default NULL value to last argument.
>   * tree-ssanames.h (make_ssa_name, copy_ssa_name): Likewise.
>   * gimple-low.c (lower_builtin_posix_memalign): Remove NULL
>   last argument from create_tmp_var_raw, create_tmp_var,
>   create_tmp_reg, make_ssa_name and copy_ssa_name calls.
>   * tree-ssa-strlen.c (get_string_length): Likewise.
>   * tree-emutls.c (gen_emutls_addr, lower_emutls_1): Likewise.
>   * tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
>   * tree-vect-slp.c (vect_get_constant_vectors): Likewise.
>   * ipa-prop.c (ipa_modify_call_arguments): Likewise.
>   * tree-ssa-forwprop.c (simplify_rotate): Likewise.
>   * tree-ssa-ccp.c (fold_builtin_alloca_with_align): Likewise.
>   * asan.c (build_shadow_mem_access, maybe_create_ssa_name,
>   maybe_cast_to_ptrmode, asan_expand_check_ifn): Likewise.
>   * tsan.c (instrument_expr, instrument_builtin_call,
>   instrument_func_entry): Likewise.
>   * varpool.c (add_new_static_var): Likewise.
>   * tree-loop-distribution.c (generate_memset_builtin): Likewise.
>   * gimplify.c (internal_get_tmp_var, gimplify_return_expr,
>   gimplify_modify_expr_to_memcpy, gimplify_modify_expr_to_memset,
>   gimplify_init_ctor_eval_range, gimplify_init_constructor,
>   gimplify_omp_atomic, gimplify_expr): Likewise.
>   * gimple-builder.c (build_assign, build_type_cast): Likewise.
>   * tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1,
>   slpeel_update_phi_nodes_for_guard2, slpeel_tree_peel_loop_to_edge,
>   vect_loop_versioning): Likewise.
>   * tree-if-conv.c (version_loop_for_if_conversion): Likewise.
>   * gimple-match-head.c (maybe_push_res_to_seq): Likewise.
>   * tree-vect-patterns.c (vect_handle_widen_op_by_const,
>   vect_recog_widen_mult_pattern, vect_operation_fits_smaller_type,
>   vect_recog_over_widening_pattern): Likewise.
>   * tree-sra.c (build_ref_for_offset, create_access_replacement):
>   Likewise.
>   * tree-cfg.c (make_blocks): Likewise.
>   * tree-eh.c (lower_eh_constructs_2, lower_resx, lower_eh_dispatch):
>   Likewise.
>   * tree-ssa-propagate.c (update_call_from_tree): Likewise.
>   * tree-complex.c (get_component_ssa_name, expand_complex_div_wide):
>   Likewise.
>   * tree-ssa-math-opts.c (build_and_insert_cast): Likewise.
>   * tree-tailcall.c (update_accumulator_with_ops): Likewise.
>   * tree-predcom.c (initialize_root_vars, initialize_root_vars_lm,
>   execute_load_motion, reassociate_to_the_same_stmt): Likewise.
>   * tree-ssa-reassoc.c (build_and_add_sum,
>   optimize_range_tests_to_bit_test, update_ops,
>   maybe_optimize_range_tests, rewrite_expr_tree, linearize_expr,
>   negate_value, repropagate_negates): Likewise.
>   * tree-vect-loop.c (vect_is_simple_reduction_1,
>   vect_create_epilog_for_reduction): Likewise.
>   * ipa-split.c (split_function): Likewise.
>   * tree-inline.c (remap_ssa_name, setup_one_parameter,
>   declare_return_variable, tree_function_versioning): Likewise.
>   * tree-cfgcleanup.c (fixup_noreturn_call): Likewise.
>   * cfgexpand.c (update_alias_info_with_stack_vars, expand_used_vars):
>   Likewise.
>   * tree-ssa-phiopt.c (conditional_replacement, abs_replacement,
>   neg_replacement): Likewise.
>   * gimplify-me.c (force_gimple_operand_1, gimple_regimplify_operands):
>   Likewise.
>   * tree-vrp.c (simplify_truth_ops_using_ranges,
>   simplify_float_conversion_using_ranges,
>   simplify_internal_call_using_ranges): Likewise.
>   * tree-switch-conversion.c (emit_case_bit_tests,
>   build_one_array, build_arrays, gen_def_assigns): Likewise.
>   * gimple-fold.c (gimple_fold_builtin_me

[Patch, Fortran, committed] Change two gfc_warning_now_1 to common diagnostics

2014-11-29 Thread Tobias Burnus
It turned out that those two could be converted. At least two of the 
remaining three gfc_warning_now_1 currently can't (they lead to ICEs).


Committed as Rev. 218180.

Tobias
Index: gcc/fortran/ChangeLog
===
--- gcc/fortran/ChangeLog	(Revision 218179)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,4 +1,9 @@
 2014-11-29  Tobias Burnus  
+
+	* scanner.c (skip_free_comments, gfc_gobble_whitespace): Use
+	gfc_warning_now instead of ..._now_1.
+
+2014-11-29  Tobias Burnus  
 	Manuel López-Ibáñez  
 
 	* lang.opt (Wtabs): Combine duplicated item into a single
Index: gcc/fortran/scanner.c
===
--- gcc/fortran/scanner.c	(Revision 218179)
+++ gcc/fortran/scanner.c	(Arbeitskopie)
@@ -775,10 +775,10 @@ skip_free_comments (void)
 }
 			}
 			  else
-			gfc_warning_now_1 ("!$OMP at %C starts a commented "
-	   "line as it neither is followed "
-	   "by a space nor is a "
-	   "continuation line");
+			gfc_warning_now ("!$OMP at %C starts a commented "
+	 "line as it neither is followed "
+	 "by a space nor is a "
+	 "continuation line");
 			}
 		  gfc_current_locus = old_loc;
 		  next_char ();
@@ -1388,7 +1388,7 @@ gfc_gobble_whitespace (void)
 	  if (cur_linenum != linenum)
 	{
 	  linenum = cur_linenum;
-	  gfc_warning_now_1 ("Nonconforming tab character at %C");
+	  gfc_warning_now (OPT_Wtabs, "Nonconforming tab character at %C");
 	}
 	}
 }


[Patch, Fortran, RFC] Use gfc_warning_now for gfc_warning

2014-11-29 Thread Tobias Burnus

Hi all,

this patch uses the unbuffered gfc_warning_now code for gfc_warning, 
which might be buffered. Looking at the code, I fail to construct a code 
where buffering would be done - and the buffer be dropped in case of 
warnings. I used defines to make it simpler to re-instate buffereing in 
case it will be needed at some point.


Note: For gfc_errors, dropping the buffer *does* happen. I have also not 
completely investigated gfc_notify_std for the warning case, but the 
_DEL and _OBS seem to be only issued after nonambiguous code. I wondered 
whether "goto var = 1" would trigger it, but seemingly "gotovar = 1" is 
matched before "goto var" as the warning is not triggered.


Regtesting didn't show any failures. Is the patch OK for the trunk? Do 
you have comments, concerns or similar?


Tobias

PS: After that patch – or, alternatively, Manuel's buffered warning 
patch - is in, I will add OPT_W* to the gfc_warning. We also have to 
think about notify_std.
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index 1864145..6c6b7d1 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -956,10 +956,10 @@ gfc_check_argument_var_dependency (gfc_expr *var, sym_intent intent,
 		 If a dependency is found in the case
 		 elemental == ELEM_CHECK_VARIABLE, we will generate
 		 a temporary, so we don't need to bother the user.  */
-		  gfc_warning ("INTENT(%s) actual argument at %L might "
-			   "interfere with actual argument at %L.",
-		   	   intent == INTENT_OUT ? "OUT" : "INOUT",
-		   	   &var->where, &expr->where);
+		  gfc_warning_1 ("INTENT(%s) actual argument at %L might "
+ "interfere with actual argument at %L.",
+ intent == INTENT_OUT ? "OUT" : "INOUT",
+ &var->where, &expr->where);
 		}
 	  return 0;
 	}
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index 00e9228..a40bdde 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -804,35 +804,6 @@ gfc_increment_error_count (void)
 }
 
 
-/* Issue a warning.  */
-
-void
-gfc_warning (const char *gmsgid, ...)
-{
-  va_list argp;
-
-  if (inhibit_warnings)
-return;
-
-  warning_buffer.flag = 1;
-  warning_buffer.index = 0;
-  cur_error_buffer = &warning_buffer;
-
-  va_start (argp, gmsgid);
-  error_print (_("Warning:"), _(gmsgid), argp);
-  va_end (argp);
-
-  error_char ('\0');
-
-  if (buffer_flag == 0)
-  {
-warnings++;
-if (warnings_are_errors)
-  gfc_increment_error_count();
-  }
-}
-
-
 /* Whether, for a feature included in a given standard set (GFC_STD_*),
we should issue an error or a warning, or be quiet.  */
 
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 095d526..bb7ed61 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2690,7 +2690,10 @@ void gfc_buffer_error (int);
 
 const char *gfc_print_wide_char (gfc_char_t);
 
-void gfc_warning (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
+/* Contrary to gfc_warning_now, gfc_warning could be buffered. However, it
+   turned out that the buffer is never dropped but always printed.  */
+#define gfc_warning_1 gfc_warning_now_1
+#define gfc_warning gfc_warning_now
 void gfc_warning_now_1 (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
 bool gfc_warning_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
 bool gfc_warning_now (int opt, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
diff --git a/gcc/testsuite/gfortran.dg/warnings_are_errors_1.f b/gcc/testsuite/gfortran.dg/warnings_are_errors_1.f
index 49bf112..510f93e 100644
--- a/gcc/testsuite/gfortran.dg/warnings_are_errors_1.f
+++ b/gcc/testsuite/gfortran.dg/warnings_are_errors_1.f
@@ -18,7 +18,7 @@
end do
call foo j bar
 ! gfc_warning:
-   r2(4) = 0 ! { dg-warning "is out of bounds" }
+   r2(4) = 0 ! { dg-error "is out of bounds" }

goto 3 45
end
diff --git a/gcc/testsuite/gfortran.dg/warnings_are_errors_1.f90 b/gcc/testsuite/gfortran.dg/warnings_are_errors_1.f90
index 8ce4699..efb4508 100644
--- a/gcc/testsuite/gfortran.dg/warnings_are_errors_1.f90
+++ b/gcc/testsuite/gfortran.dg/warnings_are_errors_1.f90
@@ -17,7 +17,7 @@
 
implicit none
 ! gfc_warning:
-1234  complex :: cplx ! { dg-warning "defined but cannot be used" }
+1234  complex :: cplx ! { dg-error "defined but cannot be used" }
   cplx = 20.
 
 ! gfc_warning_now:


Re: [PATCH] Fix and improve avx2 broadcasts (PR target/63594)

2014-11-29 Thread H.J. Lu
On Tue, Oct 21, 2014 at 9:10 AM, Jakub Jelinek  wrote:
> Hi!
>
> This patch fixes a bunch of recent regressions:
> FAIL: gcc.target/i386/avx-1.c (internal compiler error)
> FAIL: gcc.target/i386/avx-1.c (test for excess errors)
> FAIL: gcc.target/i386/avx-2.c (internal compiler error)
> FAIL: gcc.target/i386/avx-2.c (test for excess errors)
> FAIL: gcc.target/i386/avx512f-vec-init.c (internal compiler error)
> FAIL: gcc.target/i386/avx512f-vec-init.c (test for excess errors)
> UNRESOLVED: gcc.target/i386/avx512f-vec-init.c scan-assembler-times 
> vbroadcastsd 1
> UNRESOLVED: gcc.target/i386/avx512f-vec-init.c scan-assembler-times 
> vbroadcastss 1
> UNRESOLVED: gcc.target/i386/avx512f-vec-init.c scan-assembler-times 
> vmovdqa64[ t]+%zmm 2
> UNRESOLVED: gcc.target/i386/avx512f-vec-init.c scan-assembler-times 
> vpbroadcastb 2
> UNRESOLVED: gcc.target/i386/avx512f-vec-init.c scan-assembler-times 
> vpbroadcastd 1
> UNRESOLVED: gcc.target/i386/avx512f-vec-init.c scan-assembler-times 
> vpbroadcastq 1
> UNRESOLVED: gcc.target/i386/avx512f-vec-init.c scan-assembler-times 
> vpbroadcastw 2
> FAIL: gcc.target/i386/sse-14.c (internal compiler error)
> FAIL: gcc.target/i386/sse-14.c (test for excess errors)
> FAIL: gcc.target/i386/sse-22.c (internal compiler error)
> FAIL: gcc.target/i386/sse-22.c (test for excess errors)
> FAIL: gcc.target/i386/sse-22a.c (internal compiler error)
> FAIL: gcc.target/i386/sse-22a.c (test for excess errors)
> FAIL: gcc.target/i386/sse-23.c (internal compiler error)
> FAIL: gcc.target/i386/sse-23.c (test for excess errors)
> FAIL: gcc.target/i386/sse-24.c (internal compiler error)
> FAIL: gcc.target/i386/sse-24.c (test for excess errors)
> and improves quality of code generated for AVX2 and AVX512F broadcasts;
> as AVX2 broadcast instructions can have source in memory or vector register
> (but only AVX512F can have it in GPRs), the patch adds splitter for the
> GPR case and adds ! for that, so that RA can choose what is best and if
> broadcast from GPR is desirable, it first performs vmovd from GPR into
> the dest register and then vpbroadcast{b,w,d} it.
>
> The AVX512* patterns should be IMHO merged, so that whether GPR or MEM is used
> are just alternatives of the same define_insn rather than different 
> define_insns,
> but am not changing that right now, will leave that to Kirill as a follow-up.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2014-10-21  Jakub Jelinek  
>
> PR target/63594
> * config/i386/i386.c (ix86_expand_vector_init_duplicate): For
> V{8HI,16QI,16HI,32QI}mode call ix86_vector_duplicate_value
> even for just TARGET_AVX2, not only for
> TARGET_AVX512VL && TARGET_AVX512BW.  For V{32HI,64QI}mode,
> call ix86_vector_duplicate_value only if TARGET_AVX512BW,
> otherwise build it using concatenation of 256-bit
> broadcast.
> * config/i386/sse.md (AVX_VEC_DUP_MODE): Moved after
> avx512 broadcast patterns.
> (vec_dup): Likewise.  For avx2 use
> vbroadcast instead of
> vbroadcast.
> (AVX2_VEC_DUP_MODE): New mode iterator.
> (*vec_dup): New TARGET_AVX2 define_insn with
> AVX2_VEC_DUP_MODE iterator, add a splitter for that.
>
> * gcc.dg/pr63594-1.c: New test.
> * gcc.dg/pr63594-2.c: New test.
> * gcc.target/i386/sse2-pr63594-1.c: New test.
> * gcc.target/i386/sse2-pr63594-2.c: New test.
> * gcc.target/i386/avx-pr63594-1.c: New test.
> * gcc.target/i386/avx-pr63594-2.c: New test.
> * gcc.target/i386/avx2-pr63594-1.c: New test.
> * gcc.target/i386/avx2-pr63594-2.c: New test.
> * gcc.target/i386/avx512f-pr63594-1.c: New test.
> * gcc.target/i386/avx512f-pr63594-2.c: New test.
> * gcc.target/i386/avx512f-vec-init.c: Adjust expected
> insn counts.
>

This caused:

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


-- 
H.J.


PATCH: ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops

2014-11-29 Thread H.J. Lu
When searching for an usable algorithm with -minline-all-stringops,
decide_alg stops when it sees libcall even if there is a usable
algorithm.  It goes into an infinite loop.  This patch changes
decide_alg to stop searching only if there aren't any usable algorithms.
Testd on Linux/x86-64.  OK for trunk.


H.J.

gcc/

2014-11-29  H.J. Lu  

PR target/64108
* config/i386/i386.c (decide_alg): Stop only if there aren't
any usable algorithms.

gcc/testsuite/

2014-11-29  H.J. Lu  

PR target/64108
* gcc.target/i386/memset-strategy-2.c: New test.

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 2493130..d789635 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -24464,7 +24464,9 @@ decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT 
expected_size,
  *noalign = alg_noalign;
  return alg;
}
- break;
+ /* Stop only if there aren't any usable algorithms.  */
+ if (!any_alg_usable_p)
+   break;
}
  else if (alg_usable_p (candidate, memset))
{
diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-2.c 
b/gcc/testsuite/gcc.target/i386/memset-strategy-2.c
new file mode 100644
index 000..aafa54d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/memset-strategy-2.c
@@ -0,0 +1,10 @@
+/* PR target/64108 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=atom -mmemset-strategy=libcall:-1:align 
-minline-all-stringops" } */
+
+char a[2048];
+void t (void)
+{
+  __builtin_memset (a, 1, 2048);
+}
+


Re: PATCH: ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops

2014-11-29 Thread H.J. Lu
On Sat, Nov 29, 2014 at 6:00 AM, H.J. Lu  wrote:
> When searching for an usable algorithm with -minline-all-stringops,
> decide_alg stops when it sees libcall even if there is a usable
> algorithm.  It goes into an infinite loop.  This patch changes
> decide_alg to stop searching only if there aren't any usable algorithms.
> Testd on Linux/x86-64.  OK for trunk.

The bug is also in GCC 4.9.  OK for backport?

>
> H.J.
> 
> gcc/
>
> 2014-11-29  H.J. Lu  
>
> PR target/64108
> * config/i386/i386.c (decide_alg): Stop only if there aren't
> any usable algorithms.
>
> gcc/testsuite/
>
> 2014-11-29  H.J. Lu  
>
> PR target/64108
> * gcc.target/i386/memset-strategy-2.c: New test.
>
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 2493130..d789635 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -24464,7 +24464,9 @@ decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT 
> expected_size,
>   *noalign = alg_noalign;
>   return alg;
> }
> - break;
> + /* Stop only if there aren't any usable algorithms.  */
> + if (!any_alg_usable_p)
> +   break;
> }
>   else if (alg_usable_p (candidate, memset))
> {
> diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-2.c 
> b/gcc/testsuite/gcc.target/i386/memset-strategy-2.c
> new file mode 100644
> index 000..aafa54d
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/memset-strategy-2.c
> @@ -0,0 +1,10 @@
> +/* PR target/64108 */
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -march=atom -mmemset-strategy=libcall:-1:align 
> -minline-all-stringops" } */
> +
> +char a[2048];
> +void t (void)
> +{
> +  __builtin_memset (a, 1, 2048);
> +}
> +



-- 
H.J.


PATCH: PR target/64114: ICE: in lra_create_live_ranges, at lra-lives.c:1330 with -O -mstringop-strategy=vector_loop -mno-push-args

2014-11-29 Thread H.J. Lu
Hi,

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

was fixed by

http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=217947

I checked in this testcase to close it.

H.J.
---
Index: gcc/testsuite/ChangeLog
===
--- gcc/testsuite/ChangeLog (revision 218181)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2014-11-29  H.J. Lu  
+
+   PR target/64114
+   * gcc.target/i386/pr64114.c: New test.
+
 2014-11-29  Joseph Myers  
 
PR preprocessor/41698
Index: gcc/testsuite/gcc.target/i386/pr64114.c
===
--- gcc/testsuite/gcc.target/i386/pr64114.c (revision 0)
+++ gcc/testsuite/gcc.target/i386/pr64114.c (working copy)
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O -mstringop-strategy=vector_loop -mno-push-args" } */
+
+extern float *ptrs[];
+extern int incs[];
+
+struct big
+{
+  int i[0x1];
+};
+
+extern void bar (struct big b);
+
+struct big
+foo (int n)
+{
+  struct big b;
+
+  int inc14 = incs[15], inc16 = n, inc17 = n, inc19 = incs[3];
+  float *ptr0 = ptrs[1], *ptr14 = ptrs[14], *ptr16 = ptrs[16];
+  while (n--)
+*ptr0 += *ptr14 += inc14 += *ptr16 += inc16 += inc17 += inc19, bar (b);
+  return b;
+}


[Patch, Fortran] fortran/lang.opt cleanup

2014-11-29 Thread Tobias Burnus
This patch converts all warnings to Var(), which cleans up options.c 
quite a bit and makes it additionally possible to use the OPT_* with 
common diagnostics, once gfc_warning is converted. I also remove one 
-Wall setting of a warning as it was already enabled by default; 
additionally, I mentioned this fact in the man page.


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

Tobias
2014-11-29  Tobias Burnus  

	* gfortran.h (gfc_option_t): Remove warn_aliasing, warn_ampersand,
	warn_function_elimination, warn_implicit_interface,
	warn_implicit_procedure, warn_line_truncation,
	warn_surprising, warn_underflow, warn_intrinsic_shadow,
	warn_array_temp, warn_align_commons, warn_real_q_constant,
	warn_unused_dummy_argument, warn_zerotrip, warn_realloc_lhs,
	warn_realloc_lhs_all, warn_compare_reals, warn_target_lifetime.
	* arith.c (check_result, gfc_real2real, gfc_real2complex,
	gfc_complex2real, gfc_complex2complex): Honor changed
	variable names.
	* check.c (gfc_check_transfer): Ditto.
	* expr.c (gfc_check_assign, gfc_check_pointer_assign): Ditto.
	* interface.c (compare_parameter, gfc_procedure_use, gfc_ppc_use,
	gfc_arglist_matches_symbol): Ditto.
	* intrinsic.c (gfc_warn_intrinsic_shadow): Ditto.
	* primary.c (match_real_constant, match_string_constant): Ditto.
	* resolve.c (gfc_resolve_intrinsic, resolve_operator,
	gfc_resolve_iterator, resolve_select, resolve_ordinary_assign,
	resolve_charlen, gfc_resolve_finalizers): Ditto.
	* scanner.c (gfc_next_char_literal): Ditto.
	* simplify.c (simplify_achar_char, gfc_simplify_iachar): Ditto.
	* trans-array.c (gfc_trans_create_temp_array,
	gfc_trans_dummy_array_bias, gfc_conv_array_parameter): Ditto.
	* trans-common.c (translate_common):
	* trans-decl.c (generate_local_decl): Ditto.
	* trans-expr.c (realloc_lhs_warning): Ditto.
	* trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ditto.
	* decl.c (do_warn_intrinsic_shadow): Ditto. Renamed from
	warn_intrinsic_shadow.
	* frontend-passes.c (do_warn_function_elimination): Honor
	changed variable names. Renamed from do_warn_function_elimination.
	* invoke.texi (Wunderflow): Document that it is enabled by default.
	* lang.opt (Waliasing, Walign-commons, Warray-temporaries,
	Wcompare-reals, Wfunction-elimination, Wimplicit-interface,
	Wimplicit-procedure, Wline-truncation, Wreal-q-constant, Wrealloc-lhs,
	Wrealloc-lhs-all, Wtarget-lifetime, Wsurprising, Wunderflow,
	Wintrinsic-shadow, Wunused-dummy-argument, Wzerotrip): Use Var(),
	add Init() and LangEnabledBy() were required.
	(Wmaybe-uninitialized, Wreturn-type, Wuninitialized): Add
	LangEnabledBy.
	* options.c (gfc_init_options, gfc_post_options, gfc_handle_option):
	Remove options handled in lang.opt; handle renaming.
	(set_Wall, set_Wextra): Remove.

diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c
index f8f2ba6..efbe6de 100644
--- a/gcc/fortran/arith.c
+++ b/gcc/fortran/arith.c
@@ -544,7 +544,7 @@ check_result (arith rc, gfc_expr *x, gfc_expr *r, gfc_expr **rp)
 
   if (val == ARITH_UNDERFLOW)
 {
-  if (gfc_option.warn_underflow)
+  if (warn_underflow)
 	gfc_warning (gfc_arith_error (val), &x->where);
   val = ARITH_OK;
 }
@@ -2077,7 +2077,7 @@ gfc_real2real (gfc_expr *src, int kind)
 
   if (rc == ARITH_UNDERFLOW)
 {
-  if (gfc_option.warn_underflow)
+  if (warn_underflow)
 	gfc_warning (gfc_arith_error (rc), &src->where);
   mpfr_set_ui (result->value.real, 0, GFC_RND_MODE);
 }
@@ -2108,7 +2108,7 @@ gfc_real2complex (gfc_expr *src, int kind)
 
   if (rc == ARITH_UNDERFLOW)
 {
-  if (gfc_option.warn_underflow)
+  if (warn_underflow)
 	gfc_warning (gfc_arith_error (rc), &src->where);
   mpfr_set_ui (mpc_realref (result->value.complex), 0, GFC_RND_MODE);
 }
@@ -2163,7 +2163,7 @@ gfc_complex2real (gfc_expr *src, int kind)
 
   if (rc == ARITH_UNDERFLOW)
 {
-  if (gfc_option.warn_underflow)
+  if (warn_underflow)
 	gfc_warning (gfc_arith_error (rc), &src->where);
   mpfr_set_ui (result->value.real, 0, GFC_RND_MODE);
 }
@@ -2194,7 +2194,7 @@ gfc_complex2complex (gfc_expr *src, int kind)
 
   if (rc == ARITH_UNDERFLOW)
 {
-  if (gfc_option.warn_underflow)
+  if (warn_underflow)
 	gfc_warning (gfc_arith_error (rc), &src->where);
   mpfr_set_ui (mpc_realref (result->value.complex), 0, GFC_RND_MODE);
 }
@@ -2209,7 +2209,7 @@ gfc_complex2complex (gfc_expr *src, int kind)
 
   if (rc == ARITH_UNDERFLOW)
 {
-  if (gfc_option.warn_underflow)
+  if (warn_underflow)
 	gfc_warning (gfc_arith_error (rc), &src->where);
   mpfr_set_ui (mpc_imagref (result->value.complex), 0, GFC_RND_MODE);
 }
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 5fea5a8..cea2689 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -5070,7 +5070,7 @@ gfc_check_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size)
 	return false;
 }
 
-  if (!gfc_option.warn_surprising)
+  if (!warn_surprising)
 return true;
 
   /* If we can't calcula

Re: [Patch, Fortran] fortran/lang.opt cleanup

2014-11-29 Thread FX
> This patch converts all warnings to Var(), which cleans up options.c quite a 
> bit and makes it additionally possible to use the OPT_* with common 
> diagnostics, once gfc_warning is converted. I also remove one -Wall setting 
> of a warning as it was already enabled by default; additionally, I mentioned 
> this fact in the man page.

Cool stuff! Thanks for doing this, and OK to commit.

FX

[patch] Some std::locale improvements

2014-11-29 Thread Jonathan Wakely

These are a few small things I noticed while working on the facets,
which I'm going to commit separately.

Tested x86_64-linux and powerpc64-linux, committed to trunk.


commit 384475184b4245ac23cb35a363e7e8d98838ec2e
Author: Jonathan Wakely 
Date:   Sat Nov 29 20:45:10 2014 +

	* src/c++98/locale_init.cc (locale::_Impl::_Impl(size_t)): Use
	new-initializer instead of loop.
	* src/c++98/localename.cc (locale::_Impl::_Impl(const char*, size_t)):
	Likewise.

diff --git a/libstdc++-v3/src/c++98/locale_init.cc b/libstdc++-v3/src/c++98/locale_init.cc
index 2c6dfc5..c007648 100644
--- a/libstdc++-v3/src/c++98/locale_init.cc
+++ b/libstdc++-v3/src/c++98/locale_init.cc
@@ -375,17 +375,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   : _M_refcount(__refs), _M_facets(0), _M_facets_size(_GLIBCXX_NUM_FACETS),
   _M_caches(0), _M_names(0)
   {
-_M_facets = new (&facet_vec) const facet*[_M_facets_size];
-_M_caches = new (&cache_vec) const facet*[_M_facets_size];
-for (size_t __i = 0; __i < _M_facets_size; ++__i)
-  _M_facets[__i] = _M_caches[__i] = 0;
+_M_facets = new (&facet_vec) const facet*[_M_facets_size]();
+_M_caches = new (&cache_vec) const facet*[_M_facets_size]();
 
 // Name the categories.
-_M_names = new (&name_vec) char*[_S_categories_size];
+_M_names = new (&name_vec) char*[_S_categories_size]();
 _M_names[0] = new (&name_c[0]) char[2];
 std::memcpy(_M_names[0], locale::facet::_S_get_c_name(), 2);
-for (size_t __j = 1; __j < _S_categories_size; ++__j)
-  _M_names[__j] = 0;
 
 // This is needed as presently the C++ version of "C" locales
 // != data in the underlying locale model for __timepunct,
diff --git a/libstdc++-v3/src/c++98/localename.cc b/libstdc++-v3/src/c++98/localename.cc
index e93c846..589f8c6 100644
--- a/libstdc++-v3/src/c++98/localename.cc
+++ b/libstdc++-v3/src/c++98/localename.cc
@@ -184,15 +184,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 __try
   {
-	_M_facets = new const facet*[_M_facets_size];
-	for (size_t __i = 0; __i < _M_facets_size; ++__i)
-	  _M_facets[__i] = 0;
-	_M_caches = new const facet*[_M_facets_size];
-	for (size_t __j = 0; __j < _M_facets_size; ++__j)
-	  _M_caches[__j] = 0;
-	_M_names = new char*[_S_categories_size];
-	for (size_t __k = 0; __k < _S_categories_size; ++__k)
-	  _M_names[__k] = 0;
+	_M_facets = new const facet*[_M_facets_size]();
+	_M_caches = new const facet*[_M_facets_size]();
+	_M_names = new char*[_S_categories_size]();
 
 	// Name the categories.
 	const char* __smon = __s;

commit e90b7f80d7fcef752a4a89325b1bd02d0533f6c2
Author: Jonathan Wakely 
Date:   Sat Nov 29 18:42:53 2014 +

	* include/bits/locale_facets/nonio.h (__timepunct): Remove unused
	typedef.
	(time_get): Likewise. Fix comments.

diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.h b/libstdc++-v3/include/bits/locale_facets_nonio.h
index 3e2cc7f..5c1eeb7 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.h
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.h
@@ -179,7 +179,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 public:
   // Types:
   typedef _CharT			__char_type;
-  typedef basic_string<_CharT>	__string_type;
   typedef __timepunct_cache<_CharT>	__cache_type;
 
 protected:
@@ -374,7 +373,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   typedef _CharT			char_type;
   typedef _InIter			iter_type;
   //@}
-  typedef basic_string<_CharT>	__string_type;
 
   /// Numpunct facet id.
   static locale::id			id;
@@ -393,15 +391,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /**
*  @brief  Return preferred order of month, day, and year.
*
-   *  This function returns an enum from timebase::dateorder giving the
+   *  This function returns an enum from time_base::dateorder giving the
*  preferred ordering if the format @a x given to time_put::put() only
*  uses month, day, and year.  If the format @a x for the associated
*  locale uses other fields, this function returns
-   *  timebase::dateorder::noorder.
+   *  time_base::dateorder::noorder.
*
*  NOTE: The library always returns noorder at the moment.
*
-   *  @return  A member of timebase::dateorder.
+   *  @return  A member of time_base::dateorder.
   */
   dateorder
   date_order()  const
@@ -548,12 +546,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /**
*  @brief  Return preferred order of month, day, and year.
*
-   *  This function returns an enum from timebase::dateorder giving the
+   *  This function returns an enum from time_base::dateorder giving the
*  preferred ordering if the format @a x given to time_put::put() only
*  uses month, day, and year.  This function is a hook for derived
*  classes to change the value returned.
*
-   *  @return  A member of timebase::dateorder.
+   *  @return  A member of time_base::dateorder.

Re: [PATCH 0/6] various combine patches, v2

2014-11-29 Thread Segher Boessenkool
On Thu, Nov 27, 2014 at 05:44:30PM -0800, Segher Boessenkool wrote:
> The first three of these are from the previous series, with hopefully
> all comments addressed.
> 
> The fourth simplifies the code that breaks up an arith insn with a
> compare to zero, using the helpers that the third patch introduced.
> 
> The fifth and the sixth are separate from the rest and each other;
> they fix PRs that people optimistically thought this patch series
> would fix.  Well, now they are right ;-)

I completely forgot to explain how this was tested.

Bootstrapped and tested on powerpc64-linux, no regressions, with
-m64,-m32,-m32/-mpowerpc64,-m64/-mlra.  Also built cross-compilers
and built the Linux kernel for all archs where that works (28 builds).

Over the weekend, I bootstrapped on x86_64-linux, no configure flags
at all.  It regchecked fine after a few tries (one fortran testcase
ping-pongs, actual_array_substr_2.f90).  Also had to filter out all
ASAN noise of course.  And one of the gomp testcases runs for at
least two hours ("./tpow_z", if that means something to anyone).


Segher


Re: [PATCH 0/6] various combine patches, v2

2014-11-29 Thread Andrew Pinski
On Sat, Nov 29, 2014 at 5:15 PM, Segher Boessenkool
 wrote:
> On Thu, Nov 27, 2014 at 05:44:30PM -0800, Segher Boessenkool wrote:
>> The first three of these are from the previous series, with hopefully
>> all comments addressed.
>>
>> The fourth simplifies the code that breaks up an arith insn with a
>> compare to zero, using the helpers that the third patch introduced.
>>
>> The fifth and the sixth are separate from the rest and each other;
>> they fix PRs that people optimistically thought this patch series
>> would fix.  Well, now they are right ;-)
>
> I completely forgot to explain how this was tested.
>
> Bootstrapped and tested on powerpc64-linux, no regressions, with
> -m64,-m32,-m32/-mpowerpc64,-m64/-mlra.  Also built cross-compilers
> and built the Linux kernel for all archs where that works (28 builds).
>
> Over the weekend, I bootstrapped on x86_64-linux, no configure flags
> at all.  It regchecked fine after a few tries (one fortran testcase
> ping-pongs, actual_array_substr_2.f90).  Also had to filter out all
> ASAN noise of course.  And one of the gomp testcases runs for at
> least two hours ("./tpow_z", if that means something to anyone).

I saw tpow_z running for a long time also on AARCH64-linux-gnu.

Thanks,
Andrew

>
>
> Segher