Re: [PATCH] Fix illegal cast to rtx (*insn_gen_fn) (rtx, ...)

2013-07-10 Thread Andreas Schwab
Stefan Kristiansson  writes:

> @@ -291,14 +290,41 @@
>  const char *const *multi;
>  insn_output_fn function;
>} output;
> +  union {
> +rtx (*argc0) (void);
> +rtx (*argc1) (rtx);
> +rtx (*argc2) (rtx, rtx);
> +rtx (*argc3) (rtx, rtx, rtx);
> +rtx (*argc4) (rtx, rtx, rtx, rtx);
> +rtx (*argc5) (rtx, rtx, rtx, rtx, rtx);
> +rtx (*argc6) (rtx, rtx, rtx, rtx, rtx, rtx);
> +rtx (*argc7) (rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +rtx (*argc8) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +rtx (*argc9) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +rtx (*argc10)(rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +rtx (*argc11)(rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +  } genfun;
>  #else
>struct {
>  const char *single;
>  const char *const *multi;
>  insn_output_fn function;
>} output;
> +  struct {
> +rtx (*argc0) (void);
> +rtx (*argc1) (rtx);
> +rtx (*argc2) (rtx, rtx);
> +rtx (*argc3) (rtx, rtx, rtx);
> +rtx (*argc4) (rtx, rtx, rtx, rtx);
> +rtx (*argc5) (rtx, rtx, rtx, rtx, rtx);
> +rtx (*argc6) (rtx, rtx, rtx, rtx, rtx, rtx);
> +rtx (*argc7) (rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +rtx (*argc8) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +rtx (*argc9) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +rtx (*argc10)(rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +rtx (*argc11)(rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +  } genfun;

I don't think there is a need to conditionalize this on
HAVE_DESIGNATED_UNION_INITIALIZERS.  All function pointers are alike, so
it should be good enough to cast on assignment and use the right
alternative on call.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Re: RFA: PATCH to get_inner_reference for c++/57793

2013-07-10 Thread Eric Botcazou
> This PR isn't really a C++ issue; it affects C as well, and presumably
> all other languages.  A comment a few lines down says
> 
> /* Avoid returning a negative bitpos as this may wreak havoc later.  */
> 
> but we were failing to avoid that in this case.
> 
> Tested x86_64-pc-linux-gnu.  OK for trunk/4.8?

Don't we want to error out instead of silently accepting this though?  You 
could call valid_constant_size_p at the beginning of the block for example.

The idea behind the existing trick is that the reference is within the bounds 
of the base object, i.e. the global offset (offset<<3 + bitpos) is positive, 
but the bitpos part is negative, so we rearrange it into ((offset-c>>3)<<3 + 
(bitpos+c)).  Here the global offset is negative because it has overflowed so 
I'm not sure the rearrangement makes any sense.

-- 
Eric Botcazou


Re: FW: [PATCH GCC]Relax the probability condition in CE pass when optimizing for code size

2013-07-10 Thread Eric Botcazou
> 2013-03-25  Bin Cheng  
> 
>   * ifcvt.c (ifcvt_after_combine): New static variable.
>   (cheap_bb_rtx_cost_p): Set scale to REG_BR_PROB_BASE when optimizing
>   for size.
>   (rest_of_handle_if_conversion, rest_of_handle_if_after_combine):
>   Clear/set the variable ifcvt_after_combine.

The idea looks sensible.  Some remarks:
 - add an after_combine parameter to if_convert and set the global from within 
this function instead of the pass functions (True, not TRUE, in the comment).
 - explain in the comment why you use optimize_function_for_speed_p instead of 
the 'speed' variable defined just above in cheap_bb_rtx_cost_p,
 - set the 'scale' variable only once in cheap_bb_rtx_cost_p (otherwise this 
is gratuitously confusing) and explain in the comment the reasoning for 
choosing REG_BR_PROB_BASE in the !speed case (I presume it's to void the 
identical scaling applied to the insns of the block).

-- 
Eric Botcazou


[patch,avr] Fix PR57844

2013-07-10 Thread Georg-Johann Lay
The problem with this PR is that -size is used as addend in
avr_prologue_setup_frame instead of truncating it to the mode of the operation.

Fix as obvious.

Ok for trunk and backport?

Johann


PR target/57844
* config/avr/avr.c (avr_prologue_setup_frame): Trunk -size to mode
of my_fp.
Index: config/avr/avr.c
===
--- config/avr/avr.c	(revision 200865)
+++ config/avr/avr.c	(working copy)
@@ -1112,7 +1112,7 @@ avr_prologue_setup_frame (HOST_WIDE_INT
   leaf function and thus X has already been saved.  */
 
   int irq_state = -1;
-  HOST_WIDE_INT size_cfa = size;
+  HOST_WIDE_INT size_cfa = size, neg_size;
   rtx fp_plus_insns, fp, my_fp;
 
   gcc_assert (frame_pointer_needed
@@ -1151,6 +1151,7 @@ avr_prologue_setup_frame (HOST_WIDE_INT
 }
 
   size = trunc_int_for_mode (size, GET_MODE (my_fp));
+  neg_size = trunc_int_for_mode (-size, GET_MODE (my_fp));
 
   /  Method 1: Adjust frame pointer  /
 
@@ -1171,7 +1172,8 @@ avr_prologue_setup_frame (HOST_WIDE_INT
 }
 
   insn = emit_move_insn (my_fp, plus_constant (GET_MODE (my_fp),
-   my_fp, -size));
+   my_fp, neg_size));
+
   if (frame_pointer_needed)
 {
   RTX_FRAME_RELATED_P (insn) = 1;


Preserve label alignment info through dbr

2013-07-10 Thread Eric Botcazou
Hi,

I was a little surprised to find out that dbr can silently drop the alignment 
information for labels computed when the CFG is valid (in compute_alignments). 
The pessimization can be significant for loops when the top label needs to be 
overaligned, as seen on a private port.  Hence the attached patch.

Tested on SPARC/Solaris and SPARC64/Solaris, any objections?


2013-07-10  Eric Botcazou  

* rtl.h (update_alignments): Declare.
* final.c (grow_label_align): New function extracted from...
(shorten_branches): ...here.  Call it.
(update_alignments): New function.
* reorg.c (sibling_labels): New variable.
(get_label_before): Add SIBLING parameter.  If it is non-zero, push
the new label along with it onto the sibling_labels vector.
(fill_simple_delay_slots): Adjust call to get_label_before.
(fill_slots_from_thread): Likewise.
(relax_delay_slots): Likewise.
(make_return_insns): Likewise.
(dbr_schedule): Invoke update_alignment on the sibling_labels vector.


-- 
Eric BotcazouIndex: rtl.h
===
--- rtl.h	(revision 200780)
+++ rtl.h	(working copy)
@@ -2749,6 +2749,7 @@ extern void simplify_using_condition (rt
 
 /* In final.c  */
 extern unsigned int compute_alignments (void);
+extern void update_alignments (vec &);
 extern int asm_str_count (const char *templ);
 
 struct rtl_hooks
Index: final.c
===
--- final.c	(revision 200780)
+++ final.c	(working copy)
@@ -814,7 +814,53 @@ struct rtl_opt_pass pass_compute_alignme
   TODO_verify_rtl_sharing   /* todo_flags_finish */
  }
 };
+
+/* Grow the LABEL_ALIGN array after new labels are created.  */
+
+static void 
+grow_label_align (void)
+{
+  int old = max_labelno;
+  int n_labels;
+  int n_old_labels;
+
+  max_labelno = max_label_num ();
+
+  n_labels = max_labelno - min_labelno + 1;
+  n_old_labels = old - min_labelno + 1;
 
+  label_align = XRESIZEVEC (struct label_alignment, label_align, n_labels);
+
+  /* Range of labels grows monotonically in the function.  Failing here
+ means that the initialization of array got lost.  */
+  gcc_assert (n_old_labels <= n_labels);
+
+  memset (label_align + n_old_labels, 0,
+  (n_labels - n_old_labels) * sizeof (struct label_alignment));
+}
+
+/* Update the already computed alignment information.  LABEL_PAIRS is a vector
+   made up of pairs of labels for which the alignment information of the first
+   element will be copied from that of the second element.  */
+
+void
+update_alignments (vec &label_pairs)
+{
+  unsigned int i = 0;
+  rtx iter, label;
+
+  if (max_labelno != max_label_num ())
+grow_label_align ();
+
+  FOR_EACH_VEC_ELT (label_pairs, i, iter)
+if (i & 1)
+  {
+	LABEL_TO_ALIGNMENT (label) = LABEL_TO_ALIGNMENT (iter);
+	LABEL_TO_MAX_SKIP (label) = LABEL_TO_MAX_SKIP (iter);
+  }
+else
+  label = iter;
+}
 
 /* Make a pass over all insns and compute their actual lengths by shortening
any branches of variable length if possible.  */
@@ -852,25 +898,7 @@ shorten_branches (rtx first)
   uid_shuid = XNEWVEC (int, max_uid);
 
   if (max_labelno != max_label_num ())
-{
-  int old = max_labelno;
-  int n_labels;
-  int n_old_labels;
-
-  max_labelno = max_label_num ();
-
-  n_labels = max_labelno - min_labelno + 1;
-  n_old_labels = old - min_labelno + 1;
-
-  label_align = XRESIZEVEC (struct label_alignment, label_align, n_labels);
-
-  /* Range of labels grows monotonically in the function.  Failing here
- means that the initialization of array got lost.  */
-  gcc_assert (n_old_labels <= n_labels);
-
-  memset (label_align + n_old_labels, 0,
-	  (n_labels - n_old_labels) * sizeof (struct label_alignment));
-}
+grow_label_align ();
 
   /* Initialize label_align and set up uid_shuid to be strictly
  monotonically rising with insn order.  */
Index: reorg.c
===
--- reorg.c	(revision 200780)
+++ reorg.c	(working copy)
@@ -1856,10 +1856,15 @@ update_reg_unused_notes (rtx insn, rtx r
 }
 }
 
-/* Return the label before INSN, or put a new label there.  */
+static vec  sibling_labels;
+
+/* Return the label before INSN, or put a new label there.  If SIBLING is
+   non-zero, it is another label associated with the new label (if any),
+   typically the former target of the jump that will be redirected to
+   the new label.  */
 
 static rtx
-get_label_before (rtx insn)
+get_label_before (rtx insn, rtx sibling)
 {
   rtx label;
 
@@ -1874,6 +1879,11 @@ get_label_before (rtx insn)
   label = gen_label_rtx ();
   emit_label_after (label, prev);
   LABEL_NUSES (label) = 0;
+  if (sibling)
+	{
+	  sibling_labels.safe_push (label);
+	  sibling_labels.safe_push (sibling);
+	}
 }
   return label;
 }
@@

Re: [C++ Patch] PR 57869

2013-07-10 Thread Paolo Carlini

Hi,

On 07/10/2013 02:40 AM, Jason Merrill wrote:

On 07/09/2013 07:46 PM, Paolo Carlini wrote:

Daniel noticed that, per to the resolution of DR195, we shouldn't warn
in c++11 mode, not even with -pedantic, for this kind of
reinterpret_cast (*). Straightforward change tested x86_64-linux, not
sure if we want to do something slightly different for C++98, or
something more.


I think we should apply DR195 to C++98, too.  We might add the warning 
to a new -Wconditionally-supported flag that could later warn about 
other conditionally-supported constructs as well.

Ok. I prepared the below, tested x86_64-linux, the wording is quite terse.

Thanks,
Paolo.


/c-family
2013-07-10  Paolo Carlini  

PR c++/57869
* c.opt: Add Wconditionally-supported.

/cp
2013-07-10  Paolo Carlini  

PR c++/57869
* typeck.c (build_reinterpret_cast_1): With -Wconditionally-supported
warn about casting between pointer-to-function and pointer-to-object.

/gcc
2013-07-10  Paolo Carlini  

PR c++/57869
* doc/invoke.texi: Document -Wconditionally-supported.

/testsuite
2013-07-10  Paolo Carlini  

PR c++/57869
* g++.dg/cpp0x/reinterpret_cast1.C: New.
* g++.dg/warn/Wconditionally-supported-1.C: Likewise.
* g++.dg/conversion/dr195.C: Update.
* g++.dg/expr/cast2.C: Likewise.
Index: c-family/c.opt
===
--- c-family/c.opt  (revision 200867)
+++ c-family/c.opt  (working copy)
@@ -319,6 +319,10 @@ Wcomments
 C ObjC C++ ObjC++ Warning Alias(Wcomment)
 Synonym for -Wcomment
 
+Wconditionally-supported
+C++ ObjC++ Var(warn_conditionally_supported) Warning
+Warn for conditionally-supported constructs
+
 Wconversion
 C ObjC C++ ObjC++ Var(warn_conversion) Warning
 Warn for implicit type conversions that may change a value
Index: cp/typeck.c
===
--- cp/typeck.c (revision 200867)
+++ cp/typeck.c (working copy)
@@ -6722,12 +6722,12 @@ build_reinterpret_cast_1 (tree type, tree expr, bo
   else if ((TYPE_PTRFN_P (type) && TYPE_PTROBV_P (intype))
   || (TYPE_PTRFN_P (intype) && TYPE_PTROBV_P (type)))
 {
-  if (pedantic && (complain & tf_warning))
-   /* Only issue a warning, as we have always supported this
-  where possible, and it is necessary in some cases.  DR 195
-  addresses this issue, but as of 2004/10/26 is still in
-  drafting.  */
-   warning (0, "ISO C++ forbids casting between pointer-to-function and 
pointer-to-object");
+  if (complain & tf_warning)
+   /* C++11 5.2.10 p8 says that "Converting a function pointer to an "
+  object pointer type or vice versa is conditionally-supported."  */
+   warning (OPT_Wconditionally_supported,
+"casting between pointer-to-function and pointer-to-object "
+"is conditionally-supported");
   return fold_if_not_in_template (build_nop (type, expr));
 }
   else if (TREE_CODE (type) == VECTOR_TYPE)
Index: doc/invoke.texi
===
--- doc/invoke.texi (revision 200867)
+++ doc/invoke.texi (working copy)
@@ -237,7 +237,7 @@ Objective-C and Objective-C++ Dialects}.
 -Waggressive-loop-optimizations -Warray-bounds @gol
 -Wno-attributes -Wno-builtin-macro-redefined @gol
 -Wc++-compat -Wc++11-compat -Wcast-align  -Wcast-qual  @gol
--Wchar-subscripts -Wclobbered  -Wcomment @gol
+-Wchar-subscripts -Wclobbered  -Wcomment -Wconditionally-supported  @gol
 -Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wno-deprecated  @gol
 -Wno-deprecated-declarations -Wdisabled-optimization  @gol
 -Wno-div-by-zero -Wdouble-promotion -Wempty-body  -Wenum-compare @gol
@@ -4393,6 +4393,11 @@ programs.
 Warn for variables that might be changed by @samp{longjmp} or
 @samp{vfork}.  This warning is also enabled by @option{-Wextra}.
 
+@item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
+@opindex Wconditionally-supported
+@opindex Wno-conditionally-supported
+Warn for conditionally-supported (C++11 [intro.defs]) constructs.
+
 @item -Wconversion
 @opindex Wconversion
 @opindex Wno-conversion
Index: testsuite/g++.dg/conversion/dr195.C
===
--- testsuite/g++.dg/conversion/dr195.C (revision 200867)
+++ testsuite/g++.dg/conversion/dr195.C (working copy)
@@ -1,11 +1,12 @@
 // Copyright (C) 2004 Free Software Foundation, Inc.
 // Contributed by Nathan Sidwell 20 Oct 2004 
 
-// DR 195 will allow conversions between function and object pointers
-// under some circumstances. It is in drafting, so we don't implement
-// it (yet).
+// DR 195 was about allowing conversions between function and object
+// pointers under some circumstances.  The issue got resolved for C++11,
+// which, in 5.2.10 p8 says that: "Converting a function pointer to an
+// object pointer type

[PATCH, rs6000] Keep TOC register live in TLS lo_sum patterns

2013-07-10 Thread Ulrich Weigand
Hello,

the ppc64 linker performs an optimization to avoid multi-instruction
TOC accesses in some cases:

  /* Multi-instruction sequences that access the TOC can be
 optimized, eg. addis ra,r2,0; addi rb,ra,x;
 to nop;   addi rb,r2,x;  */

For this optimization to be valid, the TOC register r2 has to be live
at the point of the second instruction (addi rb,ra,x), even though
this instruction -on its face- does not use r2.  It is apparently
the responsibility of the compiler to keep r2 live at this point
on any such instruction (identified by using some low-part TOC 
relocation).

There is code in rs6000.md that does this for "normal" accesses to
variables in the TOC.  However, code that accesses TLS-related
information in the TOC (GOT_TLSGD and friends) does *not* ensure
r2 is live.

This usually doesn't matter because r2 tends to live across the
whole function anyway.  However, in the context of some out-of-tree
patches I ran into a situation where this caused a bug.  Since it
would probably be theoretically possible to run into this issue
even with mainline GCC (and in any case fixing the problem doesn't
have any drawbacks), I'd suggest to fix this on mainline.

This patch adds an extra operand to the UNSPEC operands of the
TLS-related lo_sum patterns, used to enforce keeping the TOC
register live.

Tested with no regressions on powerpc64-linux.

OK for mainline?

Bye,
Ulrich


ChangeLog:

* config/rs6000/rs6000.md (""*tls_gd_low"):
Require GOT register as additional operand in UNSPEC.
("*tls_ld_low"): Likewise.
("*tls_got_dtprel_low"): Likewise.
("*tls_got_tprel_low"): Likewise.
("*tls_gd"): Update splitter.
("*tls_ld"): Likewise.
("tls_got_dtprel_"): Likewise.
("tls_got_tprel_"): Likewise.

Index: gcc/config/rs6000/rs6000.md
===
--- gcc/config/rs6000/rs6000.md (revision 200784)
+++ gcc/config/rs6000/rs6000.md (working copy)
@@ -10989,7 +10989,7 @@
(unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
(set (match_dup 0)
(lo_sum:TLSmode (match_dup 3)
-   (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
+   (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))]
   "
 {
   operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
@@ -11012,7 +11012,8 @@
 (define_insn "*tls_gd_low"
   [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
  (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
-   (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
+   (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
+   (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
   UNSPEC_TLSGD)))]
   "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
   "addi %0,%1,%2@got@tlsgd@l"
@@ -11124,7 +11125,7 @@
(unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
(set (match_dup 0)
(lo_sum:TLSmode (match_dup 2)
-   (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
+   (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))]
   "
 {
   operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
@@ -11147,7 +11148,9 @@
 (define_insn "*tls_ld_low"
   [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
  (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
-   (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
+   (unspec:TLSmode [(const_int 0)
+(match_operand:TLSmode 2 "gpc_reg_operand" "b")]
+   UNSPEC_TLSLD)))]
   "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
   "addi %0,%1,%&@got@tlsld@l"
   [(set_attr "length" "4")])
@@ -11219,7 +11222,7 @@
(unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
(set (match_dup 0)
(lo_sum:TLSmode (match_dup 3)
-   (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
+   (unspec:TLSmode [(match_dup 1) (match_dup 2)] 
UNSPEC_TLSGOTDTPREL)))]
   "
 {
   operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
@@ -11242,7 +11245,8 @@
 (define_insn "*tls_got_dtprel_low"
   [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
  (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
-(unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
+(unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
+ (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
 UNSPEC_TLSGOTDTPREL)))]
   "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
   "l %0,%2@got@dtprel@l(%1)"
@@ -11288,7 +11292,7 @@
(unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
(set (match_dup 0)
(lo_sum:TLSmode (match_dup 3)
-   (unspec:TLSmode [(match_dup 2)] UNSPEC

[patch,avr] Fix PR57506: Remove duplicate devices from avr-mcus.def

2013-07-10 Thread Georg-Johann Lay
Several devices are duplicate in avr-mcus.def.

This patch removes the duplicate versions and adds a sanity check to
gen-avr-mmcu-texi.c.

Ok to apply?

Johann

PR target/57506
* config/avr/avr-mcus.def (atmega16hva, atmega16hva2, atmega16hvb)
(atmega16m1, atmega16u4, atmega32a, atmega32c1, atmega32hvb)
(atmega32m1, atmega32u4, atmega32u6, atmega64c1, atmega64m1):
Remove duplicate devices.
* config/avr/gen-avr-mmcu-texi.c (print_mcus): Fail on duplicate MCUs.
* config/avr/t-multilib: Regenerate.
* config/avr/avr-tables.opt: Regenerate.
* doc/avr-mmcu.texi: Regenerate.
Index: doc/avr-mmcu.texi
===
--- doc/avr-mmcu.texi	(revision 200865)
+++ doc/avr-mmcu.texi	(working copy)
@@ -38,7 +38,7 @@
 
 @item avr5
 ``Enhanced'' devices with 16@tie{}KiB up to 64@tie{}KiB of program memory.
-@*@var{mcu}@tie{}= @code{ata5790}, @code{ata5790n}, @code{ata5795}, @code{atmega16}, @code{atmega16a}, @code{atmega16hva}, @code{atmega16hva}, @code{atmega16hva2}, @code{atmega16hva2}, @code{atmega16hvb}, @code{atmega16hvb}, @code{atmega16hvbrevb}, @code{atmega16m1}, @code{atmega16m1}, @code{atmega16u4}, @code{atmega16u4}, @code{atmega161}, @code{atmega162}, @code{atmega163}, @code{atmega164a}, @code{atmega164p}, @code{atmega164pa}, @code{atmega165}, @code{atmega165a}, @code{atmega165p}, @code{atmega165pa}, @code{atmega168}, @code{atmega168a}, @code{atmega168p}, @code{atmega168pa}, @code{atmega169}, @code{atmega169a}, @code{atmega169p}, @code{atmega169pa}, @code{atmega26hvg}, @code{atmega32}, @code{atmega32a}, @code{atmega32a}, @code{atmega32c1}, @code{atmega32c1}, @code{atmega32hvb}, @code{atmega32hvb}, @code{atmega32hvbrevb}, @code{atmega32m1}, @code{atmega32m1}, @code{atmega32u4}, @code{atmega32u4}, @code{atmega32u6}, @code{atmega32u6}, @code{atmega323}, @code{atmega324a}, @code{atmega324p}, @code{atmega324pa}, @code{atmega325}, @code{atmega325a}, @code{atmega325p}, @code{atmega3250}, @code{atmega3250a}, @code{atmega3250p}, @code{atmega3250pa}, @code{atmega328}, @code{atmega328p}, @code{atmega329}, @code{atmega329a}, @code{atmega329p}, @code{atmega329pa}, @code{atmega3290}, @code{atmega3290a}, @code{atmega3290p}, @code{atmega3290pa}, @code{atmega406}, @code{atmega48hvf}, @code{atmega64}, @code{atmega64a}, @code{atmega64c1}, @code{atmega64c1}, @code{atmega64hve}, @code{atmega64m1}, @code{atmega64m1}, @code{atmega64rfa2}, @code{atmega64rfr2}, @code{atmega640}, @code{atmega644}, @code{atmega644a}, @code{atmega644p}, @code{atmega644pa}, @code{atmega645}, @code{atmega645a}, @code{atmega645p}, @code{atmega6450}, @code{atmega6450a}, @code{atmega6450p}, @code{atmega649}, @code{atmega649a}, @code{atmega649p}, @code{atmega6490}, @code{atmega6490a}, @code{atmega6490p}, @code{at90can32}, @code{at90can64}, @code{at90pwm161}, @code{at90pwm216}, @code{at90pwm316}, @code{at90scr100}, @code{at90usb646}, @code{at90usb647}, @code{at94k}, @code{m3000}.
+@*@var{mcu}@tie{}= @code{ata5790}, @code{ata5790n}, @code{ata5795}, @code{atmega16}, @code{atmega16a}, @code{atmega16hva}, @code{atmega16hva2}, @code{atmega16hvb}, @code{atmega16hvbrevb}, @code{atmega16m1}, @code{atmega16u4}, @code{atmega161}, @code{atmega162}, @code{atmega163}, @code{atmega164a}, @code{atmega164p}, @code{atmega164pa}, @code{atmega165}, @code{atmega165a}, @code{atmega165p}, @code{atmega165pa}, @code{atmega168}, @code{atmega168a}, @code{atmega168p}, @code{atmega168pa}, @code{atmega169}, @code{atmega169a}, @code{atmega169p}, @code{atmega169pa}, @code{atmega26hvg}, @code{atmega32}, @code{atmega32a}, @code{atmega32c1}, @code{atmega32hvb}, @code{atmega32hvbrevb}, @code{atmega32m1}, @code{atmega32u4}, @code{atmega32u6}, @code{atmega323}, @code{atmega324a}, @code{atmega324p}, @code{atmega324pa}, @code{atmega325}, @code{atmega325a}, @code{atmega325p}, @code{atmega3250}, @code{atmega3250a}, @code{atmega3250p}, @code{atmega3250pa}, @code{atmega328}, @code{atmega328p}, @code{atmega329}, @code{atmega329a}, @code{atmega329p}, @code{atmega329pa}, @code{atmega3290}, @code{atmega3290a}, @code{atmega3290p}, @code{atmega3290pa}, @code{atmega406}, @code{atmega48hvf}, @code{atmega64}, @code{atmega64a}, @code{atmega64c1}, @code{atmega64hve}, @code{atmega64m1}, @code{atmega64rfa2}, @code{atmega64rfr2}, @code{atmega640}, @code{atmega644}, @code{atmega644a}, @code{atmega644p}, @code{atmega644pa}, @code{atmega645}, @code{atmega645a}, @code{atmega645p}, @code{atmega6450}, @code{atmega6450a}, @code{atmega6450p}, @code{atmega649}, @code{atmega649a}, @code{atmega649p}, @code{atmega6490}, @code{atmega6490a}, @code{atmega6490p}, @code{at90can32}, @code{at90can64}, @code{at90pwm161}, @code{at90pwm216}, @code{at90pwm316}, @code{at90scr100}, @code{at90usb646}, @code{at90usb647}, @code{at94k}, @code{m3000}.
 
 @item avr51
 ``Enhanced'' devices with 128@tie{}KiB of program memory.
Index: config/avr/t-multilib
===
--- conf

Re: [patch,avr] Fix PR57506: Remove duplicate devices from avr-mcus.def

2013-07-10 Thread Denis Chertykov
2013/7/10 Georg-Johann Lay :
> Several devices are duplicate in avr-mcus.def.
>
> This patch removes the duplicate versions and adds a sanity check to
> gen-avr-mmcu-texi.c.
>
> Ok to apply?
>
> Johann
>
> PR target/57506
> * config/avr/avr-mcus.def (atmega16hva, atmega16hva2, atmega16hvb)
> (atmega16m1, atmega16u4, atmega32a, atmega32c1, atmega32hvb)
> (atmega32m1, atmega32u4, atmega32u6, atmega64c1, atmega64m1):
> Remove duplicate devices.
> * config/avr/gen-avr-mmcu-texi.c (print_mcus): Fail on duplicate MCUs.
> * config/avr/t-multilib: Regenerate.
> * config/avr/avr-tables.opt: Regenerate.
> * doc/avr-mmcu.texi: Regenerate.

Please commit.

Denis.


Re: [patch,avr] Fix PR57844

2013-07-10 Thread Denis Chertykov
2013/7/10 Georg-Johann Lay :
> The problem with this PR is that -size is used as addend in
> avr_prologue_setup_frame instead of truncating it to the mode of the 
> operation.
>
> Fix as obvious.
>
> Ok for trunk and backport?
>
> Johann
>
>
> PR target/57844
> * config/avr/avr.c (avr_prologue_setup_frame): Trunk -size to mode
> of my_fp.

Approved.

Denis.


Minor Cygwin patches

2013-07-10 Thread JonY
Hi,

Attached are some minor patches, comments?
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35536

--- origsrc/gcc-4.5.1/libjava/gnu/java/nio/channels/natFileChannelPosix.cc  
2007-04-02 20:05:50.0 -0500
+++ src/gcc-4.5.1/libjava/gnu/java/nio/channels/natFileChannelPosix.cc  
2010-10-27 13:39:34.044718100 -0500
@@ -386,7 +386,7 @@ FileChannelImpl::available (void)
 
 #if defined (FIONREAD)
   r = ::ioctl (fd, FIONREAD, &num);
-  if (r == -1 && errno == ENOTTY)
+  if (r == -1 && (errno == ENOTTY || errno == EINVAL))
 {
   // If the ioctl doesn't work, we don't care.
   r = 0;
--- origsrc/gcc-4.5.0/gcc/testsuite/gcc.target/i386/pr25993.c   2008-02-26 
01:38:34.0 +
+++ src/gcc-4.5.0/gcc/testsuite/gcc.target/i386/pr25993.c   2010-04-25 
16:17:21.703125000 +0100
@@ -1,5 +1,5 @@
 /* { dg-do assemble } */
-/* { dg-skip-if "" { "*-*-darwin*" "*-*-mingw*" } { "*" } { "" } } */
+/* { dg-skip-if "" { "*-*-darwin*" "*-*-mingw*" "*-*-cygwin*" } { "*" } { "" } 
} */
 /* { dg-options "-std=c99 -x assembler-with-cpp" } */
 
 #ifndef __ASSEMBLER__
Accept -pthread and -rdynamic for compatibility with Linux.
Add --large-address-aware, and use --tsaware, only with EXEs.

--- origsrc/gcc-4.7.2/gcc/config.gcc2012-09-12 04:03:54.0 -0500
+++ src/gcc-4.7.2/gcc/config.gcc2013-03-11 03:41:03.674656700 -0500
@@ -1417,7 +1417,7 @@ i[34567]86-*-cygwin*)
xm_file=i386/xm-cygwin.h
tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
target_gtfiles="\$(srcdir)/config/i386/winnt.c"
-   extra_options="${extra_options} i386/cygming.opt"
+   extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt"
extra_objs="winnt.o winnt-stubs.o"
c_target_objs="${c_target_objs} msformat-c.o"
cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
--- origsrc/gcc-4.7.2/gcc/config/i386/cygwin.h  2012-02-13 15:46:38.0 
-0600
+++ src/gcc-4.7.2/gcc/config/i386/cygwin.h  2013-03-06 00:13:25.986558800 
-0600
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3.
 #define EXTRA_OS_CPP_BUILTINS()  /* Nothing.  */
 
 #undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
+#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{pthread: } \
   -D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix \
   %{mwin32:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}} \
   %{!nostdinc:%{!mno-win32:-idirafter ../include/w32api%s -idirafter 
../../include/w32api%s}}\
@@ -49,11 +49,7 @@ along with GCC; see the file COPYING3.
  %{static|static-libgcc:-lgcc -lgcc_eh} \
  %{!static: \
%{!static-libgcc: \
- %{!shared: \
-   %{!shared-libgcc:-lgcc -lgcc_eh} \
-   %{shared-libgcc:-lgcc_s -lgcc} \
-  } \
- %{shared:-lgcc_s -lgcc} \
+ -lgcc_s -lgcc \
 } \
   } "
 #else
@@ -72,6 +72,7 @@ along with GCC; see the file COPYING3.
 #undef LIB_SPEC
 #define LIB_SPEC "\
   %{pg:-lgmon} \
+  %{pthread: } \
   -lcygwin \
   %{mwindows:-lgdi32 -lcomdlg32} \
   -ladvapi32 -lshell32 -luser32 -lkernel32"
@@ -115,7 +116,9 @@ along with GCC; see the file COPYING3.
   %{shared: --shared} %{mdll:--dll} \
   %{static:-Bstatic} %{!static:-Bdynamic} \
   %{shared|mdll: --enable-auto-image-base -e __cygwin_dll_entry@12} \
-  --dll-search-prefix=cyg -tsaware"
+  --dll-search-prefix=cyg \
+  %{rdynamic: --export-all-symbols} \
+  %{!shared: %{!mdll: --large-address-aware --tsaware}}"
 
 /* Binutils does not handle weak symbols from dlls correctly.  For now,
do not use them unnecessarily in gthr-posix.h.  */
--- origsrc/gcc-4.7.2/gcc/config/i386/cygwin.opt1969-12-31 
18:00:00.0 -0600
+++ src/gcc-4.7.2/gcc/config/i386/cygwin.opt2013-03-11 03:36:36.556378400 
-0500
@@ -0,0 +1,27 @@
+; Cygwin-specific options.
+
+; Copyright (C) 2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 3, or (at your option) any later
+; version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING3.  If not see
+; .
+
+pthread
+Driver
+
+rdynamic
+Driver
+
+; Retain blank line above


signature.asc
Description: OpenPGP digital signature


[patch,avr] Fix PR57631: Check ISR's asm name rather than C name

2013-07-10 Thread Georg-Johann Lay
This change has been proposed so that the sanity checking of ISR
(signal,interrupt) functions tests the asm function name if available, not the
C name.

Okay to apply?

Johann

gcc/
PR target/57631
* config/avr/avr.c (avr_set_current_function): Sanity-check signal
name seen by assembler/linker rather if available.

gcc/testsuite/
PR target/57631
* gcc.target/avr/torture/pr57631.c: New test.
Index: config/avr/avr.c
===
--- config/avr/avr.c	(revision 200872)
+++ config/avr/avr.c	(working copy)
@@ -584,7 +584,12 @@ avr_set_current_function (tree decl)
 {
   tree args = TYPE_ARG_TYPES (TREE_TYPE (decl));
   tree ret = TREE_TYPE (TREE_TYPE (decl));
-  const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
+  const char *name;
+
+  name = DECL_ASSEMBLER_NAME_SET_P (decl)
+/* Remove the leading '*' added in set_user_assembler_name.  */
+? 1 + IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))
+: IDENTIFIER_POINTER (DECL_NAME (decl));
 
   /* Silently ignore 'signal' if 'interrupt' is present.  AVR-LibC startet
  using this when it switched from SIGNAL and INTERRUPT to ISR.  */
Index: testsuite/gcc.target/avr/torture/pr57631.c
===
--- testsuite/gcc.target/avr/torture/pr57631.c	(revision 0)
+++ testsuite/gcc.target/avr/torture/pr57631.c	(revision 0)
@@ -0,0 +1,17 @@
+/* PR target/57631 */
+/* { dg-do compile } */
+
+void __attribute__((signal)) func1 (void) __asm ("__vector1");
+void func1  (void)
+{
+}
+
+void __attribute__((signal)) func2 (void)  __asm ("__vecto1");
+void func2  (void) /* { dg-warning "misspelled signal handler" } */
+{
+}
+
+void __attribute__((signal)) __vector_3 (void)  __asm ("__vecto1");
+void __vector_3 (void) /* { dg-warning "misspelled signal handler" } */
+{
+}


List of dead links.

2013-07-10 Thread Ondřej Bílka
On Mon, Jul 08, 2013 at 09:42:14PM +0200, Oleg Endo wrote:
> On Mon, 2013-07-08 at 16:12 +0200, Ondřej Bílka wrote:
> > On Sun, Jul 07, 2013 at 09:57:05PM +0200, Oleg Endo wrote:
> > > On Sun, 2013-07-07 at 19:54 +0200, Georg-Johann Lay wrote:
> > > 
> > > -   http://www.ddj.com/articles/1997/9701/9701o/9701o.htm?topic=algoritms
> > > +   http://www.ddj.com/articles/1997/9701/9701o/9701o.htm?topic=algorithms
> > > 
> > > both links do 404 anyway ;)
> > > 
> > could you find what this was? I need to add another filter not touch
> > html which I will do probably tomorrow.
> 
> It seems the original article is gone.  At least I can't find it easily
> (the patch that added the link is from 2001...).  It's about Fibonacci
> Heaps so there's plenty of material out there on the net.  The paper
> mentioned in the comment can be found rather easily:
> 
> http://www.cs.princeton.edu/courses/archive/fall03/cs528/handouts/fibonacci%20heaps.pdf
> 
> However, maybe it's better to replace the DDJ link with this
> http://en.wikipedia.org/wiki/Fibonacci_heap 
> 
I prefer fix issues one class at time. I added script that checks dead
links by extracting http addresses from sources and checking them by curl -f.
It found:

$ ./stylepp/script/stylepp_warn_dead_link

Dead link: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_closed.html#46
Dead link: http://citeseer.nj.nec.com/15361.html
Dead link: http://dwarf.freestandards.org
Dead link: http://fedora.linux.duke.edu/fc1_x86_64
Dead link: http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01307.html
Dead link: http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01518.html
Dead link: http://gcc.gnu.org/onlinedocs/libstdc++/documentation.html
Dead link: http://rogue.colorado.edu/EPIC7/
Dead link: http://sourcery.mentor.com/public/cxx-abi/exceptions.pdf
Dead link: http://www.beunited.org/articles/jbq/nasm.shtml
Dead link: http://www.netlib.org/specfun/algama
Dead link: http://www.netlib.org/specfun/erf
Dead link: http://www.netlib.org/specfun/gamma

If somebody wants to find replacements for them it would be welcome.


Re: List of dead links.

2013-07-10 Thread Jonathan Wakely
On 10 July 2013 15:00, Ondřej Bílka wrote:
>>
> I prefer fix issues one class at time. I added script that checks dead
> links by extracting http addresses from sources and checking them by curl -f.
> It found:
>
> $ ./stylepp/script/stylepp_warn_dead_link
>
> Dead link: http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_closed.html#46

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#46

> Dead link: http://citeseer.nj.nec.com/15361.html
> Dead link: http://dwarf.freestandards.org

http://www.dwarfstd.org/

> Dead link: http://fedora.linux.duke.edu/fc1_x86_64
> Dead link: http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01307.html
> Dead link: http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01518.html

Strange, I don't know why those messages are missing, they're in the index.

> Dead link: http://gcc.gnu.org/onlinedocs/libstdc++/documentation.html

Where is that link?  It should probably be
http://gcc.gnu.org/onlinedocs/libstdc++/

> Dead link: http://rogue.colorado.edu/EPIC7/
> Dead link: http://sourcery.mentor.com/public/cxx-abi/exceptions.pdf

Probably http://mentorembedded.github.io/cxx-abi/abi-eh.html

> Dead link: http://www.beunited.org/articles/jbq/nasm.shtml
> Dead link: http://www.netlib.org/specfun/algama
> Dead link: http://www.netlib.org/specfun/erf
> Dead link: http://www.netlib.org/specfun/gamma
>
> If somebody wants to find replacements for them it would be welcome.


[PING^2] Re: [PATCH] Caller instrumentation with -finstrument-calls

2013-07-10 Thread Paul_Woegerer
Ping,

The updated patch that I have sent here:
http://gcc.gnu.org/ml/gcc-patches/2013-07/msg7.html
is still pending review/acceptance.

Could someone please have a look.

Many Thanks,
Paul

On Monday 01 July 2013 10:22:02 Woegerer, Paul wrote:
> Hi Andrew,
> 
> On Friday 28 June 2013 09:50:31 Andrew Pinski wrote:
> > On Fri, Jun 28, 2013 at 5:51 AM,   wrote:
> > > Hi,
> > > 
> > > The patch below provides caller instrumentation for GCC.
> > > 
> > > The following new options have been added:
> > > -finstrument-calls
> > > -finstrument-calls-exclude-function-list=SYM,SYM,...
> > > -finstrument-calls-exclude-file-list=FILE,FILE,...
> > > 
> > > These new options behave and appear similar to the existing function
> > > instrumentation options (-finstrument-functions*). I have also added
> > > attribute no_instrument_calls to specify which functions should be
> > > excluded from within the source code. Calls to functions that have
> > > attribute no_instrument_function are also excluded.
> > > 
> > > The effect of the instrumentation causes all calls inside a function
> > > 
> > > to get instrumented using the following hooks:
> > > void __cyg_profile_call_before (void *fn);
> > > void __cyg_profile_call_after  (void *fn);
> > 
> > Can you not use cyg as the prefix rather use gcc or gnu.  cyg prefix
> > for -finstrument-functions is a historical accident as it stands for
> > cygnus but that company no longer exists and we should not be using a
> > company specific prefix inside of GCC anymore.
> 
> Ha, funny. Originally I had the hooks with __gnu_profile_call_* but
> then I changed them to be consistent with the existing __cyg_profile_*
> hooks.
> 
> Anyway, here is the updated patch:
> 
> 
> From 43a1c2fb43e406f8f547dbcde19a60a8c56423a4 Mon Sep 17 00:00:00 2001
> From: Paul Woegerer 
> Date: Mon, 1 Jul 2013 09:15:21 +0200
> Subject: [PATCH] Caller instrumentation with -finstrument-calls.
> 
> 2013-07-01  Paul Woegerer  
> 
>   Caller instrumentation with -finstrument-calls.
>   * gcc/builtins.def: Add call-hooks __gnu_profile_call_before and
>   __gnu_profile_call_after.
>   * gcc/libfuncs.h (enum libfunc_index): Likewise.
>   * gcc/optabs.c (init_optabs): Likewise.
>   * gcc/c-family/c-common.c (no_instrument_calls): Add attribute.
>   (handle_no_instrument_calls_attribute): New.
>   * gcc/common.opt (finstrument-calls): New option.
>   (finstrument-calls-exclude-function-list): Likewise.
>   (finstrument-calls-exclude-file-list): Likewise.
>   * gcc/opts.c (common_handle_option): Handle new options.
>   * gcc/tree.h (tree_function_decl): Add field tree_function_decl.
>   * gcc/c/c-decl.c (merge_decls): Handle tree_function_decl field.
>   * gcc/cp/decl.c (duplicate_decls): Likewise.
>   * gcc/function.c (expand_function_start): Likewise.
>   * gcc/ipa.c: Likewise.
>   * gcc/java/jcf-parse.c: Likewise.
>   * gcc/tree-streamer-in.c: Likewise.
>   * gcc/tree-streamer-out.c: Likewise.
>   (finstrument-calls-exclude-function-list): Likewise.
>   (finstrument-calls-exclude-file-list): Likewise.
>   * gcc/gimplify.c (flag_instrument_calls_exclude_p): New.
>   (addr_expr_for_call_instrumentation): New.
>   (maybe_add_profile_call): New.
>   (gimplify_call_expr): Add call-hooks insertion.
>   (gimplify_modify_expr): Likewise.
>   * gcc/doc/invoke.texi: Added documentation for
>   -finstrument-calls-exclude-function-list and
>   -finstrument-calls-exclude-file-list and
>   -finstrument-calls.
>   * gcc/testsuite/g++.dg/other/instrument_calls-1.C  Added
>regression test for -finstrument-calls.
>   * gcc/testsuite/g++.dg/other/instrument_calls-2.C: Likewise.
>   * gcc/testsuite/g++.dg/other/instrument_calls-3.C: Likewise.
>   * gcc/testsuite/gcc.dg/instrument_calls-1.c: Likewise.
>   * gcc/testsuite/gcc.dg/instrument_calls-2.c: Likewise.
>   * gcc/testsuite/gcc.dg/instrument_calls-3.c: Likewise.
>   * gcc/testsuite/gcc.dg/instrument_calls-4.c: Likewise.
>   * gcc/testsuite/gcc.dg/instrument_calls-5.c: Likewise.
>   * gcc/testsuite/gcc.dg/instrument_calls-6.c: Likewise.
>   * gcc/testsuite/gcc.dg/instrument_calls-7.c: Likewise.
>   * gcc/testsuite/gcc.dg/instrument_calls-8.c: Likewise.
>   * gcc/testsuite/gcc.dg/instrument_calls-9.c: Likewise.
> 
> diff --git a/gcc/builtins.def b/gcc/builtins.def
> index 9b55b1f..0c2a6b2 100644
> --- a/gcc/builtins.def
> +++ b/gcc/builtins.def
> @@ -795,6 +795,11 @@ DEF_BUILTIN (BUILT_IN_PROFILE_FUNC_ENTER, 
> "__cyg_profile_func_enter", BUILT_IN_N
>  DEF_BUILTIN (BUILT_IN_PROFILE_FUNC_EXIT, "__cyg_profile_func_exit", 
> BUILT_IN_NORMAL, BT_FN_VOID_PTR_PTR, BT_LAST,
>false, false, false, ATTR_NULL, true, true)
>  
> +DEF_BUILTIN (BUILT_IN_PROFILE_CALL_BEFORE, "__gnu_profile_call_before", 
> BUILT_IN_NORMAL, BT_FN_VOID_PTR, BT_LAST,
> +  false, false, false, ATTR_NULL, t

[PING][PING][PATCH] for for c/PR57541

2013-07-10 Thread Iyer, Balaji V
Did anyone get a chance to look at this? If so, is this OK for trunk? It is a 
relatively minor change...

Thanks,


-Balaji V. Iyer.

> -Original Message-
> From: Iyer, Balaji V
> Sent: Tuesday, July 02, 2013 1:07 PM
> To: gcc-patches@gcc.gnu.org
> Cc: r...@redhat.com
> Subject: FW: [PING][PATCH] for for c/PR57541
> 
> Hello everyone,
>   Is this Patch OK for trunk?
> 
> -Balaji V. Iyer.
> 
> > -Original Message-
> > From: Iyer, Balaji V
> > Sent: Monday, June 17, 2013 8:10 AM
> > To: gcc-patches@gcc.gnu.org
> > Subject: [PING][PATCH] for for c/PR57541
> >
> > Hello Everyone,
> > Is this patch OK for trunk?
> >
> > Thanks,
> >
> > Balaji V. Iyer.
> >
> > > -Original Message-
> > > From: Iyer, Balaji V
> > > Sent: Wednesday, June 12, 2013 1:22 PM
> > > To: gcc-patches@gcc.gnu.org
> > > Cc: anna.m.tikhon...@gmail.com
> > > Subject: [PATCH] for for c/PR57541
> > >
> > > Hello Everyone,
> > >   Attach, please find a patch that will fix the issues in C/PR57541.
> > > The issue reported was that the parameters passed into the builtin
> > > array notation reduction functions were not checked correctly. This
> > > patch
> > should fix that issue.
> > > It is tested on x86 and x86_64 and it seem to pass all the tests. I
> > > have also included a testsuite.
> > >
> > > Here are the ChangeLog entries:
> > >
> > > gcc/c/ChangeLog
> > > 2013-06-12  Balaji V. Iyer  
> > >
> > > * c-array-notation.c (fix_builtin_array_notation_fn): Added a 
> > > call to
> > > valid_no_reduce_fn_params_p and valid_reduce_fn_params_p.
> > > (build_array_notation_expr): Added a check for capturing the 
> > > return
> > > value (i.e. void) of __sec_reduce_mutating function.
> > >
> > >
> > > gcc/c-family/ChangeLog:
> > > 2013-06-12  Balaji V. Iyer  
> > >
> > > * array-notation-common.c (valid_reduce_fn_params_p): New 
> > > function.
> > > (valid_no_reduce_fn_params_p): Likewise.
> > > * c-common.h (valid_reduce_fn_params_p): Added a new prototype.
> > > (valid_no_reduce_fn_params_p): Likewise.
> > >
> > > gcc/testsuite/ChangeLog
> > > 2013-06-12  Balaji V. Iyer  
> > >
> > > PR c/57541
> > > * c-c++-common/cilk-plus/AN/pr57541-2.c: New test.
> > > * c-c++-common/cilk-plus/AN/rank_mismatch2.c: Fixed a bug by
> replacing
> > > a comma with an operation.
> > >
> > >
> > > Thanks,
> > >
> > > Balaji V. Iyer.
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
old mode 100644
new mode 100755
index 3d8f68f..52a58a6
Binary files a/gcc/c-family/ChangeLog and b/gcc/c-family/ChangeLog differ
diff --git a/gcc/c-family/array-notation-common.c 
b/gcc/c-family/array-notation-common.c
old mode 100644
new mode 100755
index 489b67c..6c1c7e2
--- a/gcc/c-family/array-notation-common.c
+++ b/gcc/c-family/array-notation-common.c
@@ -560,3 +560,125 @@ find_correct_array_notation_type (tree op)
 } 
   return return_type;
 }
+
+/* Returns true if the function call in BUILTIN_FN (of type CALL_EXPR) if the
+   number of parameters for the array notation reduction functions are
+   correct.  */
+
+bool
+valid_no_reduce_fn_params_p (tree builtin_fn)
+{
+  switch (is_cilkplus_reduce_builtin (CALL_EXPR_FN (builtin_fn)))
+{
+case BUILT_IN_CILKPLUS_SEC_REDUCE_ADD:
+case BUILT_IN_CILKPLUS_SEC_REDUCE_MUL:
+case BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_ZERO:
+case BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_ZERO:
+case BUILT_IN_CILKPLUS_SEC_REDUCE_MAX:
+case BUILT_IN_CILKPLUS_SEC_REDUCE_MIN:
+case BUILT_IN_CILKPLUS_SEC_REDUCE_MIN_IND:
+case BUILT_IN_CILKPLUS_SEC_REDUCE_MAX_IND:
+case BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_NONZERO:
+case BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_NONZERO:
+  if (call_expr_nargs (builtin_fn) != 1)
+   {
+ error_at (EXPR_LOCATION (builtin_fn),
+   "builtin function %qE can only have one argument",
+   CALL_EXPR_FN (builtin_fn));
+ return false;
+   }
+  break;
+case BUILT_IN_CILKPLUS_SEC_REDUCE:
+case BUILT_IN_CILKPLUS_SEC_REDUCE_MUTATING:
+  if (call_expr_nargs (builtin_fn) != 3)
+   {
+ error_at (EXPR_LOCATION (builtin_fn),
+   "builtin function %qE must have 3 arguments",
+   CALL_EXPR_FN (builtin_fn));
+ return false;
+   }
+  break;
+default:
+  /* If it is not a builtin function, then no reason for us do any checking
+here.  */
+  return true;
+}
+  return true;
+}
+
+/* Returns true if the parameters of BUILTIN_FN (array notation builtin
+   function): IDENTITY_VALUE and FUNC_PARM are valid.  */
+
+bool
+valid_reduce_fn_params_p (tree builtin_fn, tree identity_value, tree func_parm)
+{
+  switch (is_cilkplus_reduce_builtin (CALL_EXPR_FN (builtin_fn)))
+{
+case BUILT_IN_CILKPLUS_SEC_REDUCE_ADD:
+case BUILT_IN_CILKPLUS_SEC_REDUCE_MUL:
+case BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_ZERO:
+case BUILT_IN_CILKPLUS_SEC_REDUC

Re: List of dead links.

2013-07-10 Thread David Malcolm
On Wed, 2013-07-10 at 16:00 +0200, Ondřej Bílka wrote:

> Dead link: http://fedora.linux.duke.edu/fc1_x86_64

FWIW, this link occurs in historical notes at the top of these files:
  zlib/contrib/inflate86/inffas86.c
  zlib/contrib/masmx64/inffas8664.c
dated Dec-29-2003 describing specific testing done at that time, and
thus although the link is dead, it seems wrong to me to go changing it
(also, given that it's an embedded copy of a 3rd-party library, this
would be more for upstream zlib).

Hope this is helpful
Dave



Re: List of dead links.

2013-07-10 Thread Jonathan Wakely
On 10 July 2013 15:47, David Malcolm wrote:
> On Wed, 2013-07-10 at 16:00 +0200, Ondřej Bílka wrote:
>
>> Dead link: http://fedora.linux.duke.edu/fc1_x86_64
>
> FWIW, this link occurs in historical notes at the top of these files:
>   zlib/contrib/inflate86/inffas86.c
>   zlib/contrib/masmx64/inffas8664.c
> dated Dec-29-2003 describing specific testing done at that time, and
> thus although the link is dead, it seems wrong to me to go changing it
> (also, given that it's an embedded copy of a 3rd-party library, this
> would be more for upstream zlib).
>
> Hope this is helpful

Thanks.  Ondřej, as stated a few times now, anything in zlib,
boehm-gc, etc. is maintained outside the GCC project.  Do you have any
way to filter out certain directories from being checked by your
scripts?


[PATCH] Define _REENTRANT with -pthread on aarch64-linux

2013-07-10 Thread Andreas Schwab
This is expected by some software (SWI Prolog checks for it).

Andreas.

* config/aarch64/aarch64-linux.h (CPP_SPEC): Define.

diff --git a/gcc/config/aarch64/aarch64-linux.h 
b/gcc/config/aarch64/aarch64-linux.h
index e914ed2..83efad4 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -23,6 +23,8 @@
 
 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64.so.1"
 
+#define CPP_SPEC "%{pthread:-D_REENTRANT}"
+
 #define LINUX_TARGET_LINK_SPEC  "%{h*} \
%{static:-Bstatic}  \
%{shared:-shared}   \
-- 
1.8.3.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Re: List of dead links.

2013-07-10 Thread Ondřej Bílka
On Wed, Jul 10, 2013 at 04:01:54PM +0100, Jonathan Wakely wrote:
> On 10 July 2013 15:47, David Malcolm wrote:
> > On Wed, 2013-07-10 at 16:00 +0200, Ondřej Bílka wrote:
> >
> >> Dead link: http://fedora.linux.duke.edu/fc1_x86_64
> >
> > FWIW, this link occurs in historical notes at the top of these files:
> >   zlib/contrib/inflate86/inffas86.c
> >   zlib/contrib/masmx64/inffas8664.c
> > dated Dec-29-2003 describing specific testing done at that time, and
> > thus although the link is dead, it seems wrong to me to go changing it
> > (also, given that it's an embedded copy of a 3rd-party library, this
> > would be more for upstream zlib).
> >
> > Hope this is helpful
> 
> Thanks.  Ondřej, as stated a few times now, anything in zlib,
> boehm-gc, etc. is maintained outside the GCC project.  Do you have any
> way to filter out certain directories from being checked by your
> scripts?

I have (place .indent.off file to directory) but I do not know which ones 
except these are external. Closest what I could find is
http://gcc.gnu.org/onlinedocs/gccint/Top-Level.html#Top-Level

I added boehm-gc,zlib and gcc/testsuite. Are there others?


Re: [c++-concepts] requires expression semantics

2013-07-10 Thread Andrew Sutton
>> I ran through every test in the is_convertible unit test with
>> __is_convertible. There are 2 cases it doesn't address. The conversion
>> of a function type (int()) to its reference type (int(&)()),
>
>
> I looked into this a bit more; it seemed odd to consider any conversion from
> int() since there are no prvalues of function type.  The is_convertible
> trait is defined in terms of a conversion from an xvalue of the first type,
> so your __is_convertible_to trait should wrap type1 in an rvalue reference.
> That seems to give the correct result.


Wrapping with an rvalue reference doesn't always yield the right
result. In particular, in suppresses the checks for user-defined
conversions since the FROM type is not a class type any more.

I tried implementing this as if we had actually synthesized the
result-type conversion described by the standard (from create()
to To), but I couldn't quite make it work. Somehow the rvalue
reference expression was being propagated into the conversion
functions, and (again) failing for user-defined conversion.

Eventually I ended up with a solution that (I think) conforms to the
intent of the specification, which is to transform type1 into
something that could plausibly be the result of create().
Basically, I just wrap function types with an rvalue reference, and
passing everything else straight through.


> I disagree.  can_convert is not documented as only considering standard
> conversions, so it ought to handle user-defined conversions as well.  My
> preference would be to rename the current function and any needed uses to
> can_convert_standard, and give the name can_convert the intuitive meaning.


That's a good idea. I changed every existing use of can_convert to
can_convert_standard for the time being. That will preserve the
existing behavior, and we can determine which of the existing uses can
include user-defined conversions later.

Andrew


reqexpr-4.patch
Description: Binary data


Re: MIPS elimate trap-if-zero instruction if possible for divisions

2013-07-10 Thread Graham Stott
Hi Jeff, Richard,

Not sure if that working.

I created some rtl using TRAP_IF to represent the TEQ and emiited via an 
expander 

The TRAP_IF rtl make ait all the way though the rtl optimizers which are run 
after expand
even though it should be possible to determine is false.


(insn 7 3 20 2 (set (reg:SI 2 $2 [201])
    (const_int 27 [0x1b])) bug.c:67 289 {*movsi_internal}
 (expr_list:REG_EQUIV (const_int 27 [0x1b])
    (nil)))

(insn 20 7 21 2 (trap_if (eq:SI (reg:SI 2 $2 [201])
    (const_int 0 [0]))
    (const_int 7 [0x7])) bug.c:68 8 {*conditional_trapNsi_if_zero}
 (nil))

I grepped the RTL code for any code handling TRAP_IF that looked like it might 
remove the TRAP_IF but
only found some code is final_scan which only applied to CC0 backends. 

Is using a conditional trap (TRAP_IF)  the right way to go?

Graham



Re: [PATCH] Allow raw-string literals in macro arguments and deferred pragmas (PR preprocessor/57824)

2013-07-10 Thread Jakub Jelinek
On Wed, Jul 10, 2013 at 02:32:07AM -0400, Jason Merrill wrote:
> On 07/05/2013 11:19 AM, Jakub Jelinek wrote:
> >Seems for deferred_pragmas it just works
> 
> Can we encounter a newline in a deferred pragma?

Yes, that is the OpenMP testcase in the patch.

> >and for parsing of arguments
> >also if there is something in the current buffer (otherwise would
> >that just mean and of say include? I think raw strings shouldn't be allowed
> >to flow from end of include file to another file).
> 
> Agreed: "A source file shall not end in a partial preprocessing token".
> 
> OK.

Thanks.

Jakub


[ping] [PATCH] Fix pr57637

2013-07-10 Thread Zhenqiang Chen
Ping?

Thanks!
-Zhenqiang

On 5 July 2013 17:37, Zhenqiang Chen  wrote:
> On 5 July 2013 16:18, Jakub Jelinek  wrote:
>> On Fri, Jul 05, 2013 at 04:11:00PM +0800, Zhenqiang Chen wrote:
>>> +   FOR_BB_INSNS(bb, x)
>>
>> Just style nits:
>> Missing space between (.  Also, please don't use uppercase names
>> for labels.
>>
>> Jakub
>
> Thanks for the comments. Update it as:
>
> diff --git a/gcc/function.c b/gcc/function.c
> index 3e33fc7..0d15db4 100644
> --- a/gcc/function.c
> +++ b/gcc/function.c
> @@ -5524,12 +5524,40 @@ move_insn_for_shrink_wrap (basic_block bb, rtx insn,
>   SET_REGNO_REG_SET (live_in, i);
> }
>
> +  /* DF_LR_BB_INFO (bb)->def does not cover the DF_REF_PARTIAL and
> +DF_REF_CONDITIONAL def.  So recheck the DF_INSN_DEFS.  */
> +  if (next_block)
> +   {
> + rtx x;
> + df_ref *def_rec;
> +
> + FOR_BB_INSNS (bb, x)
> +   {
> + if (!NONDEBUG_INSN_P (x))
> +   continue;
> +
> + for (def_rec = DF_INSN_DEFS (x); *def_rec; def_rec++)
> +   {
> + df_ref def = *def_rec;
> + unsigned int regno = DF_REF_REGNO (def);
> +
> + for (i = dregno; i < end_dregno; i++)
> +   if (i == regno)
> + goto move_insn_done;
> + for (i = sregno; i < end_sregno; i++)
> +   if (i == regno)
> + goto move_insn_done;
> +   }
> +   }
> +   }
> +
>/* If we don't need to add the move to BB, look for a single
>  successor block.  */
>if (next_block)
> next_block = next_block_for_reg (next_block, dregno, end_dregno);
>  }
>while (next_block);
> +move_insn_done:
>
>/* BB now defines DEST.  It only uses the parts of DEST that overlap SRC
>   (next loop).  */


Re: [C++ Patch] PR 57869

2013-07-10 Thread Jason Merrill

OK, thanks.

Jason


Re: [PATCH] Define _REENTRANT with -pthread on aarch64-linux

2013-07-10 Thread Marcus Shawcroft
On 10 July 2013 16:06, Andreas Schwab  wrote:
> This is expected by some software (SWI Prolog checks for it).
>
> Andreas.

OK, Thank you.

... this time copying in gcc-patches from an account that won't get bounced...

/Marcus


Re: PING Fix ununsed variables before my patch adding missing -Werror

2013-07-10 Thread Eric Botcazou
> ChangeLog
> 03-07-2013  graham.stott  graham.st...@btinternet.com
> * c-familly/array_notation_comon.c (length_mismatch_expr_p): Delete
> unused varables l_length and l_node

Missing blank line in all your ChangeLog entries, and the above one is in the 
wrong ChangeLog file, it should be moved to c-family/ChangeLog as:

2013-07-08  Graham Stott  

* array-notation-common.c (length_mismatch_in_expr_p): Delete unused
variables l_length and l_node.


-- 
Eric Botcazou


Re: List of dead links.

2013-07-10 Thread Jonathan Wakely
On 10 July 2013 16:22, Ondřej Bílka wrote:
>> Thanks.  Ondřej, as stated a few times now, anything in zlib,
>> boehm-gc, etc. is maintained outside the GCC project.  Do you have any
>> way to filter out certain directories from being checked by your
>> scripts?
>
> I have (place .indent.off file to directory) but I do not know which ones
> except these are external. Closest what I could find is
> http://gcc.gnu.org/onlinedocs/gccint/Top-Level.html#Top-Level
>
> I added boehm-gc,zlib and gcc/testsuite. Are there others?

Joseph listed some more at http://gcc.gnu.org/ml/gcc/2013-07/msg00119.html


Re: PING Fix ununsed variables before my patch adding missing -Werror

2013-07-10 Thread Graham Stott
Erric,

Thanks I'll these errors

Graham



- Original Message -
From: Eric Botcazou 
To: Graham Stott 
Cc: gcc-patches@gcc.gnu.org
Sent: Wednesday, 10 July 2013, 17:26
Subject: Re: PING Fix ununsed variables before my patch adding missing -Werror

> ChangeLog
>         03-07-2013  graham.stott  graham.st...@btinternet.com
>         * c-familly/array_notation_comon.c (length_mismatch_expr_p): Delete
> unused varables l_length and l_node

Missing blank line in all your ChangeLog entries, and the above one is in the 
wrong ChangeLog file, it should be moved to c-family/ChangeLog as:

2013-07-08  Graham Stott  

    * array-notation-common.c (length_mismatch_in_expr_p): Delete unused
    variables l_length and l_node.


-- 
Eric Botcazou



Re: [patch,avr] Fix PR57631: Check ISR's asm name rather than C name

2013-07-10 Thread Denis Chertykov
2013/7/10 Georg-Johann Lay :
> This change has been proposed so that the sanity checking of ISR
> (signal,interrupt) functions tests the asm function name if available, not the
> C name.
>
> Okay to apply?
>
> Johann
>
> gcc/
> PR target/57631
> * config/avr/avr.c (avr_set_current_function): Sanity-check signal
> name seen by assembler/linker rather if available.
>
> gcc/testsuite/
> PR target/57631
> * gcc.target/avr/torture/pr57631.c: New test.

Approved.

Denis.


[C++ testcase, committed] PR 57874

2013-07-10 Thread Paolo Carlini

Hi,

committed to mainline.

Thanks,
Paolo.

///
2013-07-10  Paolo Carlini  

PR c++/57874
* g++.dg/cpp0x/sfinae48.C: New.
Index: g++.dg/cpp0x/sfinae48.C
===
--- g++.dg/cpp0x/sfinae48.C (revision 0)
+++ g++.dg/cpp0x/sfinae48.C (working copy)
@@ -0,0 +1,21 @@
+// PR c++/57874
+// { dg-do compile { target c++11 } }
+
+namespace NX
+{
+  struct X {};
+  void foo(X) {}
+}
+
+namespace NY
+{
+  struct Y {};
+}
+
+template
+auto ADLfoo(T&&) -> decltype((foo(T{}), short()));
+
+char ADLfoo(...);
+
+static_assert(sizeof(ADLfoo(NY::Y{})) == 1, "");
+static_assert(sizeof(ADLfoo(NX::X{})) == 2, "");


Re: [gomp4] Compiler side of the cancellation support

2013-07-10 Thread Jakub Jelinek
On Tue, Jul 09, 2013 at 10:12:30AM -0700, Richard Henderson wrote:
> > Queuing this patch until we have a library implementation.
> 
> I've committed the patch, so that I can more easily work on the library
> implementation.

Ok, thanks.

> There was one minor patch conflict that needed resolving.

In expand_omp_single, right?  Yeah, the
http://gcc.gnu.org/ml/gcc-patches/2013-07/msg00139.html
patch touched the line immediately above what the cancellation patch
changed.

Jakub


Re: [PATCH, rs6000] Keep TOC register live in TLS lo_sum patterns

2013-07-10 Thread David Edelsohn
On Wed, Jul 10, 2013 at 7:08 AM, Ulrich Weigand  wrote:
> Hello,
>
> the ppc64 linker performs an optimization to avoid multi-instruction
> TOC accesses in some cases:
>
>   /* Multi-instruction sequences that access the TOC can be
>  optimized, eg. addis ra,r2,0; addi rb,ra,x;
>  to nop;   addi rb,r2,x;  */
>
> For this optimization to be valid, the TOC register r2 has to be live
> at the point of the second instruction (addi rb,ra,x), even though
> this instruction -on its face- does not use r2.  It is apparently
> the responsibility of the compiler to keep r2 live at this point
> on any such instruction (identified by using some low-part TOC
> relocation).
>
> There is code in rs6000.md that does this for "normal" accesses to
> variables in the TOC.  However, code that accesses TLS-related
> information in the TOC (GOT_TLSGD and friends) does *not* ensure
> r2 is live.
>
> This usually doesn't matter because r2 tends to live across the
> whole function anyway.  However, in the context of some out-of-tree
> patches I ran into a situation where this caused a bug.  Since it
> would probably be theoretically possible to run into this issue
> even with mainline GCC (and in any case fixing the problem doesn't
> have any drawbacks), I'd suggest to fix this on mainline.
>
> This patch adds an extra operand to the UNSPEC operands of the
> TLS-related lo_sum patterns, used to enforce keeping the TOC
> register live.
>
> Tested with no regressions on powerpc64-linux.
>
> OK for mainline?
>
> Bye,
> Ulrich
>
>
> ChangeLog:
>
> * config/rs6000/rs6000.md (""*tls_gd_low"):
> Require GOT register as additional operand in UNSPEC.
> ("*tls_ld_low"): Likewise.
> ("*tls_got_dtprel_low"): Likewise.
> ("*tls_got_tprel_low"): Likewise.
> ("*tls_gd"): Update splitter.
> ("*tls_ld"): Likewise.
> ("tls_got_dtprel_"): Likewise.
> ("tls_got_tprel_"): Likewise.

This patch is okay.

Thanks, David


Re: [PATCH] PR57792: Bootstrap darwin13 or later with --with-sysroot to find SDK

2013-07-10 Thread Mike Stump
On Jul 4, 2013, at 7:27 PM, Jack Howarth  wrote:
>  The attached patch eliminates the problem of the SDK being removed from / in 
> darwin13
> and later by appending --with-sysroot=\"`xcrun --show-sdk-path`\" to 
> host_configargs
> in the top-level configure for those cases . Bootstrap tested on 
> x86_64-apple-darwin13. 
> Okay for gcc trunk and gcc-4_8-branch?

Ok.

Thanks.

If you could try a build of the software from src, that'd be nice.

gcc/trunk:
Committed revision 200886.
Committed revision 200890.

src:
Checking in ChangeLog;
/cvs/src/src/ChangeLog,v  <--  ChangeLog
new revision: 1.1074; previous revision: 1.1073
done
Checking in configure;
/cvs/src/src/configure,v  <--  configure
new revision: 1.447; previous revision: 1.446
done
Checking in configure.ac;
/cvs/src/src/configure.ac,v  <--  configure.ac
new revision: 1.190; previous revision: 1.189
done

gcc/branches/gcc-4_8-branch:
Committed revision 200889.


Remove stray text on @hook TARGET_CANONICALIZE_COMPARISON in tm.texi.in

2013-07-10 Thread Joseph S. Myers
I noticed that the documentation of TARGET_CANONICALIZE_COMPARISON in 
tm.texi.in had stray text after the hook name on the @hook line, which 
became stray text after the prototype in the @deftypefn line in tm.texi.  
I've committed this patch to fix this.

Index: doc/tm.texi
===
--- doc/tm.texi (revision 200890)
+++ doc/tm.texi (working copy)
@@ -6040,7 +6040,7 @@
 in @file{@var{machine}-modes.def}.
 @end defmac
 
-@deftypefn {Target Hook} void TARGET_CANONICALIZE_COMPARISON (int *@var{code}, 
rtx *@var{op0}, rtx *@var{op1}, bool @var{op0_preserve_value}) (@var{code}, 
@var{op0}, @var{op1}, @var{op0_preserve_value})
+@deftypefn {Target Hook} void TARGET_CANONICALIZE_COMPARISON (int *@var{code}, 
rtx *@var{op0}, rtx *@var{op1}, bool @var{op0_preserve_value})
 On some machines not all possible comparisons are defined, but you can
 convert an invalid comparison into a valid one.  For example, the Alpha
 does not have a @code{GT} comparison, but you can use an @code{LT}
Index: doc/tm.texi.in
===
--- doc/tm.texi.in  (revision 200890)
+++ doc/tm.texi.in  (working copy)
@@ -5940,7 +5940,7 @@
 in @file{@var{machine}-modes.def}.
 @end defmac
 
-@hook TARGET_CANONICALIZE_COMPARISON (@var{code}, @var{op0}, @var{op1}, 
@var{op0_preserve_value})
+@hook TARGET_CANONICALIZE_COMPARISON
 On some machines not all possible comparisons are defined, but you can
 convert an invalid comparison into a valid one.  For example, the Alpha
 does not have a @code{GT} comparison, but you can use an @code{LT}
Index: ChangeLog
===
--- ChangeLog   (revision 200890)
+++ ChangeLog   (working copy)
@@ -1,3 +1,9 @@
+2013-07-10  Joseph Myers  
+
+   * doc/tm.texi.in (TARGET_CANONICALIZE_COMPARISON): Remove stray
+   text on @hook line.
+   * doc/tm.texi: Regenerate.
+
 2013-07-10  Paolo Carlini  
 
PR c++/57869

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


[C++ testcase, committed] PR 57827

2013-07-10 Thread Paolo Carlini

Hi,

committed to mainline.

Thanks,
Paolo.

/
2013-07-10  Paolo Carlini  

PR c++/57827
* g++.dg/cpp0x/constexpr-ice7.C: New.
Index: g++.dg/cpp0x/constexpr-ice7.C
===
--- g++.dg/cpp0x/constexpr-ice7.C   (revision 0)
+++ g++.dg/cpp0x/constexpr-ice7.C   (working copy)
@@ -0,0 +1,15 @@
+// PR c++/57827
+// { dg-do compile { target c++11 } }
+
+struct C
+{
+  constexpr int fun (int x)
+  {
+return x + 1;
+  }
+
+  int a = 2;
+  int b = fun(a);
+};
+
+C c;


Re: [PATCH] Fix raw-string handling (PR preprocessor/57620)

2013-07-10 Thread Jakub Jelinek
On Wed, Jul 10, 2013 at 02:22:56AM -0400, Jason Merrill wrote:
> It seems undesirable to go from one to four separate copies of the
> note-handling code.  Could we instead handle the different states of
> prefix, body and suffix parsing in local variables and just have one
> loop over the characters/notes in the input?

So something like this instead?  This is one loop handling the phase1/phase2
reversion and 3 phases where we parse the raw_prefix, the actual raw string
and after seen ) trying to match d-chars against raw_prefix (if not
successful, we switch to phase RAW_STR again but keep looking for ),
if seen we switch back to RAW_STR_SUFFIX phase.

With this make check RUNTESTFLAGS=dg.exp=raw-string* passes, but perhaps
I'll need to play with gcov and add some new testcases, e.g. ones
I have in mind are R"??(??)??"; which wouldn't work correctly if we didn't
stop consuming notes after seeing ??X other than ??/, also something to
catch when we have say R"?(x)??)?" because then first char of the trigraph
matches against raw_prefix, but second char isn't the expected ", yet the
last character of trigraph ) should start another round of checking against
raw_prefix.

2013-07-10  Jakub Jelinek  

PR preprocessor/57620
* lex.c (lex_raw_string): Undo phase1 and phase2 transformations
between R" and final " rather than only in between R"del( and )del".

* c-c++-common/raw-string-2.c (s12, u12, U12, L12): Remove.
(main): Don't test {s,u,U,L}12.
* c-c++-common/raw-string-13.c: New test.
* c-c++-common/raw-string-14.c: New test.
* c-c++-common/raw-string-15.c: New test.
* c-c++-common/raw-string-16.c: New test.

--- libcpp/lex.c.jj 2013-07-10 18:50:45.229759934 +0200
+++ libcpp/lex.c2013-07-11 01:20:41.864103963 +0200
@@ -1373,11 +1373,16 @@ static void
 lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base,
const uchar *cur)
 {
-  const uchar *raw_prefix;
-  unsigned int raw_prefix_len = 0;
+  uchar raw_prefix[17];
+  const uchar *orig_base;
+  unsigned int raw_prefix_len = 0, raw_suffix_len = 0;
+  enum raw_str_phase { RAW_STR_PREFIX, RAW_STR, RAW_STR_SUFFIX };
+  raw_str_phase phase = RAW_STR_PREFIX;
   enum cpp_ttype type;
   size_t total_len = 0;
   _cpp_buff *first_buff = NULL, *last_buff = NULL;
+  _cpp_buff *last_seen_buff = NULL;
+  size_t last_seen_len = 0, suffix_start = 0, raw_prefix_start;
   _cpp_line_note *note = &pfile->buffer->notes[pfile->buffer->cur_note];
 
   type = (*base == 'L' ? CPP_WSTRING :
@@ -1385,57 +1390,6 @@ lex_raw_string (cpp_reader *pfile, cpp_t
  *base == 'u' ? (base[1] == '8' ? CPP_UTF8STRING : CPP_STRING16)
  : CPP_STRING);
 
-  raw_prefix = cur + 1;
-  while (raw_prefix_len < 16)
-{
-  switch (raw_prefix[raw_prefix_len])
-   {
-   case ' ': case '(': case ')': case '\\': case '\t':
-   case '\v': case '\f': case '\n': default:
- break;
-   /* Basic source charset except the above chars.  */
-   case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-   case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
-   case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
-   case 's': case 't': case 'u': case 'v': case 'w': case 'x':
-   case 'y': case 'z':
-   case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-   case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
-   case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
-   case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
-   case 'Y': case 'Z':
-   case '0': case '1': case '2': case '3': case '4': case '5':
-   case '6': case '7': case '8': case '9':
-   case '_': case '{': case '}': case '#': case '[': case ']':
-   case '<': case '>': case '%': case ':': case ';': case '.':
-   case '?': case '*': case '+': case '-': case '/': case '^':
-   case '&': case '|': case '~': case '!': case '=': case ',':
-   case '"': case '\'':
- raw_prefix_len++;
- continue;
-   }
-  break;
-}
-
-  if (raw_prefix[raw_prefix_len] != '(')
-{
-  int col = CPP_BUF_COLUMN (pfile->buffer, raw_prefix + raw_prefix_len)
-   + 1;
-  if (raw_prefix_len == 16)
-   cpp_error_with_line (pfile, CPP_DL_ERROR, token->src_loc, col,
-"raw string delimiter longer than 16 characters");
-  else
-   cpp_error_with_line (pfile, CPP_DL_ERROR, token->src_loc, col,
-"invalid character '%c' in raw string delimiter",
-(int) raw_prefix[raw_prefix_len]);
-  pfile->buffer->cur = raw_prefix - 1;
-  create_literal (pfile, token, base, raw_prefix - 1 - base, CPP_OTHER);
-  return;
-}
-
-  cur = raw_prefix + raw_prefix_len + 1;
-  for (;;)
-{
 #define BUF_APPEND(STR,LEN)\
   do {   

[GOOGLE] record compiler options before any compilation

2013-07-10 Thread Dehao Chen
This fix is need if you want to collect AutoFDO profile on
AutoFDO+LIPO optimized binary.

Testing on going.

OK for google branches?

Thanks,
Dehao

Index: gcc/toplev.c
===
--- gcc/toplev.c (revision 200855)
+++ gcc/toplev.c (working copy)
@@ -1960,9 +1960,9 @@

   timevar_stop (TV_PHASE_SETUP);

-  compile_file ();
   if (flag_record_compilation_info_in_elf)
 write_compilation_info_to_asm ();
+  compile_file ();
 }
   else
 {


Re: [GOOGLE] record compiler options before any compilation

2013-07-10 Thread Xinliang David Li
Ok after testing.

David

On Wed, Jul 10, 2013 at 4:59 PM, Dehao Chen  wrote:
> This fix is need if you want to collect AutoFDO profile on
> AutoFDO+LIPO optimized binary.
>
> Testing on going.
>
> OK for google branches?
>
> Thanks,
> Dehao
>
> Index: gcc/toplev.c
> ===
> --- gcc/toplev.c (revision 200855)
> +++ gcc/toplev.c (working copy)
> @@ -1960,9 +1960,9 @@
>
>timevar_stop (TV_PHASE_SETUP);
>
> -  compile_file ();
>if (flag_record_compilation_info_in_elf)
>  write_compilation_info_to_asm ();
> +  compile_file ();
>  }
>else
>  {


Re: [PATCH] PR57792: Bootstrap darwin13 or later with --with-sysroot to find SDK

2013-07-10 Thread Jack Howarth
On Wed, Jul 10, 2013 at 02:24:48PM -0700, Mike Stump wrote:
> On Jul 4, 2013, at 7:27 PM, Jack Howarth  wrote:
> >  The attached patch eliminates the problem of the SDK being removed from / 
> > in darwin13
> > and later by appending --with-sysroot=\"`xcrun --show-sdk-path`\" to 
> > host_configargs
> > in the top-level configure for those cases . Bootstrap tested on 
> > x86_64-apple-darwin13. 
> > Okay for gcc trunk and gcc-4_8-branch?
> 
> Ok.
> 
> Thanks.
> 
> If you could try a build of the software from src, that'd be nice.

Current gcc trunk now builds fine on darwin13. Thanks for the commit.
 Jack

> 
> gcc/trunk:
> Committed revision 200886.
> Committed revision 200890.
> 
> src:
> Checking in ChangeLog;
> /cvs/src/src/ChangeLog,v  <--  ChangeLog
> new revision: 1.1074; previous revision: 1.1073
> done
> Checking in configure;
> /cvs/src/src/configure,v  <--  configure
> new revision: 1.447; previous revision: 1.446
> done
> Checking in configure.ac;
> /cvs/src/src/configure.ac,v  <--  configure.ac
> new revision: 1.190; previous revision: 1.189
> done
> 
> gcc/branches/gcc-4_8-branch:
> Committed revision 200889.


Patch to switch optional reloads off

2013-07-10 Thread Vladimir Makarov
I got three PRs about optional reloads patch which I committed to the 
trunk on Friday.


Sorry, I can not work on these PRs this week.  So I decided to switch 
optional reloads off temporarily.  I'll return to the PRs next week.


The patch was successfully bootstrapped on x86-64.

Committed as rev. 200899.

2013-07-10  Vladimir Makarov  

* lra-constraints.c (curr_insn_transform): Switch off optional
reloads.

Index: lra-constraints.c
===
--- lra-constraints.c   (revision 200896)
+++ lra-constraints.c   (working copy)
@@ -3211,7 +3211,7 @@ curr_insn_transform (void)
 reg, we might improve the code through inheritance.  If
 it does not get a hard register we coalesce memory/memory
 moves later.  Ignore move insns to avoid cycling.  */
- if (! lra_simple_p
+ if (0 && ! lra_simple_p
  && lra_undo_inheritance_iter < LRA_MAX_INHERITANCE_PASSES
  && goal_alt[i] != NO_REGS && REG_P (op)
  && (regno = REGNO (op)) >= FIRST_PSEUDO_REGISTER


Re: [PATCH] Fix illegal cast to rtx (*insn_gen_fn) (rtx, ...)

2013-07-10 Thread Stefan Kristiansson
On Wed, Jul 10, 2013 at 09:18:53AM +0200, Andreas Schwab wrote:
> 
> I don't think there is a need to conditionalize this on
> HAVE_DESIGNATED_UNION_INITIALIZERS.  All function pointers are alike, so
> it should be good enough to cast on assignment and use the right
> alternative on call.

You mean something like this?

gcc/recog.h:
@@ -298,7 +297,21 @@
 insn_output_fn function;
   } output;
 #endif
-  const insn_gen_fn genfun;
+  union {
+rtx (*argc0)   (void);
+rtx (*argc1)   (rtx);
+rtx (*argc2)   (rtx, rtx);
+rtx (*argc3)   (rtx, rtx, rtx);
+rtx (*argc4)   (rtx, rtx, rtx, rtx);
+rtx (*argc5)   (rtx, rtx, rtx, rtx, rtx);
+rtx (*argc6)   (rtx, rtx, rtx, rtx, rtx, rtx);
+rtx (*argc7)   (rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+rtx (*argc8)   (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+rtx (*argc9)   (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+rtx (*argc10)  (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+rtx (*argc11)  (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+  } genfun;
+
   const struct insn_operand_data *const operand;
 
   const char n_generator_args;

gcc/genoutput.c:
@@ -404,9 +404,9 @@
}
 
   if (d->name && d->name[0] != '*')
-   printf ("(insn_gen_fn) gen_%s,\n", d->name);
+   printf ("{ (rtx (*) (void)) gen_%s },\n", d->name);
   else
-   printf ("0,\n");
+   printf ("{ 0 },\n");
 
   printf ("&operand_data[%d],\n", d->operand_number);
   printf ("%d,\n", d->n_generator_args);

Fair enough, that makes the printing routine a bit more clean and
removes some code duplication in the declaration.

Stefan