Re: [patch i386]: Fix sibcall failures caused by allowing constant memories

2014-06-01 Thread Uros Bizjak
On Sat, May 31, 2014 at 2:27 PM, Kai Tietz  wrote:

> I resend patch within new thread.
> Recent fallout about sibcall was caused by using 'm' constraint for
> sibcalls.  By this wrongly combines happened on reload-pass. That
> patch introduces new constraint 'B' for sibcall_memory_operand.
>
> ChangeLog
>
> 2014-05-31  Kai Tietz  
>
> * constrains.md (define_constrain): New 'B' constraint.

Please make this a two-letter constraint (perhaps "Bs"). We are
already short in single-letter constraints.

I plan to change "z" and "w" @internal constraints to "Bz" and "Bw" to
return these two letters.

Uros.


Re: [PATCH, Fortran] PR61234: -Wuse-no-only

2014-06-01 Thread Dominique Dhumieres
> I think it is really weird if a coding style warning is included in -Wall.

I fully agree. In top of that the patch looks like a blind enforcement of this
coding style.

What is the rationale of

+  SUBROUTINE S2
+ USE foo, ONLY: bar ! { dg-bogus "has no ONLY qualifier" }
+  END SUBROUTINE

?

Cheers,

Dominique


Re: [PATCH, sched] Cleanup and improve multipass_dfa_lookahead_guard

2014-06-01 Thread Andreas Schwab
Maxim Kuvyrkov  writes:

> @@ -7535,28 +7530,24 @@ ia64_variable_issue (FILE *dump ATTRIBUTE_UNUSED,
> can be chosen.  */
>  
>  static int
> -ia64_first_cycle_multipass_dfa_lookahead_guard (rtx insn)
> +ia64_first_cycle_multipass_dfa_lookahead_guard (rtx insn, int ready_index)
>  {
>gcc_assert (insn && INSN_P (insn));
> -  return ((!reload_completed
> -|| !safe_group_barrier_needed (insn))
> -   && ia64_first_cycle_multipass_dfa_lookahead_guard_spec (insn)
> -   && (!mflag_sched_mem_insns_hard_limit
> -   || !is_load_p (insn)
> -   || mem_ops_in_group[current_cycle % 4] < ia64_max_memory_insns));
> -}
>  
> -/* We are choosing insn from the ready queue.  Return nonzero if INSN
> -   can be chosen.  */
> +  /* Size of ALAT is 32.  As far as we perform conservative
> + data speculation, we keep ALAT half-empty.  */
> +  if ((TODO_SPEC (insn) & BEGIN_DATA) && pending_data_specs >= 16)
> +return ready_index == 0 ? -1 : 1;

$ gcc/xgcc -B gcc/ ../gcc/testsuite/gcc.c-torture/execute/pr51581-1.c 
-fno-diagnostics-show-caret -fdiagnostics-color=never -w -O3 
-fomit-frame-pointer -funroll-loops -c
../gcc/testsuite/gcc.c-torture/execute/pr51581-1.c: In function ‘f1’:
../gcc/testsuite/gcc.c-torture/execute/pr51581-1.c:15:1: internal compiler 
error: in operator[], at vec.h:736
0x414455af vec<_haifa_insn_data, va_heap, 
vl_embed>::operator[](unsigned int)
../../gcc/vec.h:736
0x414455af vec<_haifa_insn_data, va_heap, vl_ptr>::operator[](unsigned 
int)
../../gcc/vec.h:1202
0x414455af ia64_first_cycle_multipass_dfa_lookahead_guard
../../gcc/config/ia64/ia64.c:7539

Andreas.

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


[PATCH, AARCH64] Enable fuse-caller-save for AARCH64

2014-06-01 Thread Tom de Vries

Richard,

This patch:
- adds the for TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS required
  clobbers in CALL_INSN_FUNCTION_USAGE,
- sets TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS to true, which enables
  the fuse-caller-save optimisation, and
- adds an aarch64 fuse-caller-save test-case.

Build and tested on aarch64-linux-gnu.

OK for trunk?

Thanks,
- Tom

2014-06-01  Tom de Vries  

	* config/aarch64/aarch64-protos.h (aarch64_emit_call_insn): Declare.
	* config/aarch64/aarch64.c
	(TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS): Redefine as true.
	(aarch64_emit_call_insn): New function.
	(aarch64_load_symref_appropriately): Use aarch64_emit_call_insn instead
	of emit_call_insn.
	* config/aarch64/aarch64.md (define_expand "call_internal")
	(define_expand "call_value_internal", define_expand "sibcall_internal")
	(define_expand "sibcall_value_internal"): New.
	(define_expand "call", define_expand "call_value")
	(define_expand "sibcall", define_expand "sibcall_value"): Use internal
	expand variant and aarch64_emit_call_insn.

	* gcc.target/aarch64/fuse-caller-save.c: New test.
---
 gcc/config/aarch64/aarch64-protos.h|  1 +
 gcc/config/aarch64/aarch64.c   | 17 ++-
 gcc/config/aarch64/aarch64.md  | 52 +-
 .../gcc.target/aarch64/fuse-caller-save.c  | 25 +++
 4 files changed, 92 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/fuse-caller-save.c

diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 68d488d..d3580d3 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -244,6 +244,7 @@ void aarch64_init_cumulative_args (CUMULATIVE_ARGS *, const_tree, rtx,
 void aarch64_init_expanders (void);
 void aarch64_print_operand (FILE *, rtx, char);
 void aarch64_print_operand_address (FILE *, rtx);
+bool aarch64_emit_call_insn (rtx);
 
 /* Initialize builtins for SIMD intrinsics.  */
 void init_aarch64_simd_builtins (void);
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index f69457a..4f33a3e 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -695,7 +695,7 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm,
 	rtx result = gen_rtx_REG (Pmode, R0_REGNUM);
 
 	start_sequence ();
-	emit_call_insn (gen_tlsgd_small (result, imm));
+	aarch64_emit_call_insn (gen_tlsgd_small (result, imm));
 	insns = get_insns ();
 	end_sequence ();
 
@@ -3401,6 +3401,18 @@ aarch64_fixed_condition_code_regs (unsigned int *p1, unsigned int *p2)
   return true;
 }
 
+/* Emit call insn with PAT and do aarch64-specific handling.  */
+
+bool
+aarch64_emit_call_insn (rtx pat)
+{
+  rtx insn = emit_call_insn (pat);
+
+  rtx *fusage = &CALL_INSN_FUNCTION_USAGE (insn);
+  clobber_reg (fusage, gen_rtx_REG (word_mode, IP0_REGNUM));
+  clobber_reg (fusage, gen_rtx_REG (word_mode, IP1_REGNUM));
+}
+
 enum machine_mode
 aarch64_select_cc_mode (RTX_CODE code, rtx x, rtx y)
 {
@@ -9581,6 +9593,9 @@ aarch64_modes_tieable_p (enum machine_mode mode1, enum machine_mode mode2)
 #undef TARGET_FLAGS_REGNUM
 #define TARGET_FLAGS_REGNUM CC_REGNUM
 
+#undef TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
+#define TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS true
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-aarch64.h"
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index fec2ea8..aeccd25 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -420,6 +420,12 @@
 ;; Subroutine calls and sibcalls
 ;; ---
 
+(define_expand "call_internal"
+  [(parallel [(call (match_operand 0 "memory_operand" "")
+		(match_operand 1 "general_operand" ""))
+	  (use (match_operand 2 "" ""))
+	  (clobber (reg:DI LR_REGNUM))])])
+
 (define_expand "call"
   [(parallel [(call (match_operand 0 "memory_operand" "")
 		(match_operand 1 "general_operand" ""))
@@ -428,7 +434,7 @@
   ""
   "
   {
-rtx callee;
+rtx callee, pat;
 
 /* In an untyped call, we can get NULL for operand 2.  */
 if (operands[2] == NULL)
@@ -442,6 +448,10 @@
 	? aarch64_is_long_call_p (callee)
 	: !REG_P (callee))
   XEXP (operands[0], 0) = force_reg (Pmode, callee);
+
+pat = gen_call_internal (operands[0], operands[1], operands[2]);
+aarch64_emit_call_insn (pat);
+DONE;
   }"
 )
 
@@ -466,6 +476,13 @@
   [(set_attr "type" "call")]
 )
 
+(define_expand "call_value_internal"
+  [(parallel [(set (match_operand 0 "" "")
+		   (call (match_operand 1 "memory_operand" "")
+			 (match_operand 2 "general_operand" "")))
+	  (use (match_operand 3 "" ""))
+	  (clobber (reg:DI LR_REGNUM))])])
+
 (define_expand "call_value"
   [(parallel [(set (match_operand 0 "" "")
 		   (call (match_operand 1 "memory_operand" "")
@@ -475,7 +492,7 @@
   ""
   "
   {
-rtx callee;
+

Re: [AARCH64, PATCH] Fix ICE in aarch64_float_const_representable_p

2014-06-01 Thread Tom de Vries

On 30-05-14 10:20, Ramana Radhakrishnan wrote:

On Fri, May 30, 2014 at 9:14 AM, Tom de Vries  wrote:

Marcus,

when building for aarch64-linux-gnu with --enable-checking=yes,rtl, I run
into the following error:
...
In file included from src/libgcc/libgcc2.c:56:0:
src/libgcc/libgcc2.c: In function ‘__floattisf’:
src/libgcc/libgcc2.h:200:20: internal compiler error: RTL check: expected
code 'const_double' and not mode 'VOID', have code 'const_double' and mode
'VOID' in aarch64_float_const_representable_p, at
config/aarch64/aarch64.c:8481
  #define __NDW(a,b) __ ## a ## ti ## b
 ^
src/libgcc/libgcc2.h:293:21: note: in expansion of macro ‘__NDW’
  #define __floatdisf __NDW(float,sf)
  ^
src/libgcc/libgcc2.c:1569:14: note: in expansion of macro ‘__floatdisf’
  #define FUNC __floatdisf
   ^
src/libgcc/libgcc2.c:1579:1: note: in expansion of macro ‘FUNC’
  FUNC (DWtype u)
  ^
0xc1a278 rtl_check_failed_code_mode(rtx_def const*, rtx_code, machine_mode,
bool, char const*, int, char const*)
 src/gcc/rtl.c:833
0x1062b7b aarch64_float_const_representable_p(rtx_def*)
 src/gcc/config/aarch64/aarch64.c:8481
0x1052ae2 aarch64_rtx_costs
 src/gcc/config/aarch64/aarch64.c:5003
0x1059a9c aarch64_rtx_costs_wrapper
 src/gcc/config/aarch64/aarch64.c:5804
0xc38f1a rtx_cost(rtx_def*, rtx_code, int, bool)
 src/gcc/rtlanal.c:3878
0xb159a9 avoid_expensive_constant
 src/gcc/optabs.c:1389
0xb15ca9 expand_binop_directly
 src/gcc/optabs.c:1441
0xb161e7 expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*,
int, optab_methods)
 src/gcc/optabs.c:1568
0x87f27f expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
 src/gcc/expr.c:9200
0x87fe4b expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
 src/gcc/expr.c:9388
0x879534 expand_expr_real(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
 src/gcc/expr.c:7921
0x79a720 expand_normal
 src/gcc/expr.h:471
0x79cdb3 do_jump_by_parts_greater
 src/gcc/dojump.c:741
0x79b682 do_jump_1(tree_code, tree_node*, tree_node*, rtx_def*, rtx_def*,
int)
 src/gcc/dojump.c:280
0x79a8ce jumpifnot_1(tree_code, tree_node*, tree_node*, rtx_def*, int)
 src/gcc/dojump.c:138
0x700de4 expand_gimple_cond
 src/gcc/cfgexpand.c:2145
0x70ed7f expand_gimple_basic_block
 src/gcc/cfgexpand.c:5063
0x71189c execute
 src/gcc/cfgexpand.c:5803
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
...

We assert here during REAL_VALUE_FROM_CONST_DOUBLE because x has VOIDmode,
which means it has integer rather than floating point type:
...
bool
aarch64_float_const_representable_p (rtx x)
{
   /* This represents our current view of how many bits
  make up the mantissa.  */
   int point_pos = 2 * HOST_BITS_PER_WIDE_INT - 1;
   int exponent;
   unsigned HOST_WIDE_INT mantissa, mask;
   REAL_VALUE_TYPE r, m;
   bool fail;

   if (!CONST_DOUBLE_P (x))
 return false;

   REAL_VALUE_FROM_CONST_DOUBLE (r, x);
...

Attached patch fixes the ICE by handling the case that x is VOIDmode, and
allows me to complete the build.



IIUC it would be better to shift the AArch64 port to
TARGET_SUPPORTS_WIDE_INT and not worry about x being VOIDmode at all.
In this case we should not have any const_double's containing
integers.

I have a couple of patches in testing that did this but with all the
other breakages in AArch64 and ARM land in the past couple of weeks I
have been unable to submit this.



I'd say it's still a good idea to fix build-breakers.

Now build and reg-tested on aarch64-linux-gnu.

OK for trunk?

Thanks,
- Tom


regards
Ramana


OK for trunk if build and test succeeds?

I think the call site in aarch64_rtx_costs may need a separate fix.

Thanks,
- Tom




[PATCH GCC]Add 'force-dwarf-lexical-blocks' command line option

2014-06-01 Thread Herman, Andrei

Hi,

Currently GCC only emits DWARF debug information (DW_TAG_lexical_block 
DIEs) for compound statements containing significant local declarations.

However, code coverage tools that process the DWARF debug information to
implement block/path coverage need more complete lexical block information.

This patch adds the necessary functionality under the control of a new
command line argument: -fforce-dwarf-lexical-blocks.

When this flag is set, a DW_TAG_lexical_block DIE will be emitted for 
every function body, loop body, switch body, case statement, if-then and 
if-else statement, even if the body is a single statement.
Likewise, a lexical block will be emitted for the first label of a 
labeled statement. This block ends at the end of the current lexical 
scope, or when a break, continue, goto or return statement is 
encountered at the same lexical scope level.
Consequently, any case in a switch statement that does not flow through 
to the next case, will have its own dwarf lexical block.


The complete change proposal contains 3 patches (attached first 2):
  1.  Add command line option -fforce-dwarf-lexical-blocks
  2.  Use of flag_force_dwarf_blocks in C.

Attached are the proposed ChangeLog additions, named according to the 
directory each one belongs to.


A third patch, extending the proposed functionality to C++ will be 
submitted in a separate message.


NOTE: This is a second submit, with changes made according to 
maintainer's sugestions.


All check-c and check-c++ tests have been run for unix target.
The only test that failed with the -fforce-dwarf-lexical-blocks set
was:
FAIL: gcc.dg/debug/dwarf2/inline2.c scan-assembler-times \\(DIE 
\\([^\n]*\\) DW_TAG_lexical_block 6

as expected.

Best regards,
Andrei Herman
Mentor Graphics Corporation
Israel branch

>From 6dd5796f04ca249e8e59026208e90e7619534a80 Mon Sep 17 00:00:00 2001
From: Andrei Herman 
Date: Sun, 1 Jun 2014 11:13:09 +0300
Subject: [PATCH 1/2] Add command line option 
-fforce-dwarf-lexical-blocks.

* gcc/c-family/c.opt: Add -fforce-dwarf-lexical-blocks flag.
* gcc/c-family/c-opts.c (c_common_post_options): Limit its use
to dwarf4.
* gcc/doc/invoke.texi: Document the new option.

Signed-off-by: Andrei Herman 
---
 gcc/c-family/c-opts.c |   13 +
 gcc/c-family/c.opt|4 
 gcc/doc/invoke.texi   |   12 
 3 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 29e9a35..7c9dbfc 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -936,6 +936,19 @@ c_common_post_options (const char **pfilename)
 #endif
 }
 
+  /* The -fforce-dwarf-lexical-blocks option is only relevant when debug
+ info is in DWARF4 format */
+  if (flag_force_dwarf_blocks) {
+if (write_symbols != DWARF2_DEBUG)
+  flag_force_dwarf_blocks = 0;
+if (write_symbols == DWARF2_DEBUG && dwarf_version < 4) {
+  inform (input_location,
+  "-fforce-dwarf-lexical-blocks is only supported with "
+  "DWARF4 debug format");
+  flag_force_dwarf_blocks = 0;
+}
+  }
+
   if (flag_preprocess_only)
 {
   /* Open the output now.  We must do so even if flag_no_output is
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index c586e65..b66389e 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -960,6 +960,10 @@ ffor-scope
 C++ ObjC++ Var(flag_new_for_scope) Init(1)
 Scope of for-init-statement variables is local to the loop
 
+fforce-dwarf-lexical-blocks
+C C++ Var(flag_force_dwarf_blocks)
+Force generation of lexical blocks in dwarf output
+
 ffreestanding
 C ObjC C++ ObjC++
 Do not assume that standard C libraries and \"main\" exist
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 9475594..5bf154a 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -333,6 +333,7 @@ Objective-C and Objective-C++ Dialects}.
 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
 -fenable-@var{kind}-@var{pass} @gol
 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
+-fforce-dwarf-lexical-blocks @gol
 -fdebug-types-section -fmem-report-wpa @gol
 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
 -fopt-info @gol
@@ -5200,6 +5201,17 @@ normally emits debugging information for classes because 
using this
 option increases the size of debugging information by as much as a
 factor of two.
 
+@item -fforce-dwarf-lexical-blocks
+Produce debug information (a DW_TAG_lexical_block) for every function
+body, loop body, switch body, case statement, if-then and if-else statement,
+even if the body is a single statement.  Likewise, a lexical block will be
+emitted for the first label of a statement.  This block ends at the end of the
+current lexical scope, or when a break, continue, goto or return statement is
+encountered at the same lexical scope level.  This option is usefull for
+coverage tools that utilize the dwarf debug in

Re: [patch i386]: Fix sibcall failures caused by allowing constant memories

2014-06-01 Thread Kai Tietz
2014-06-01 9:28 GMT+02:00 Uros Bizjak :
>
> Please make this a two-letter constraint (perhaps "Bs"). We are
> already short in single-letter constraints.

Sure, I did.  I committed patch at revision 22.

Kai


[PATCH, ARM] Enable fuse-caller-save for ARM

2014-06-01 Thread Tom de Vries

Richard,

This patch:
- adds the for TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS required
  clobbers in CALL_INSN_FUNCTION_USAGE,
- sets TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS to true, which enables
  the fuse-caller-save optimisation, and
- adds an arm fuse-caller-save test-case.

Build and tested on arm-linux-gnueabi.

OK for trunk?

Thanks,
- Tom
2014-06-01  Radovan Obradovic  
Tom de Vries  

	* config/arm/arm-protos.h (arm_emit_call_insn): Add bool parameter.
	* config/arm/arm.c (TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS):
	Redefine to true.
	(arm_emit_call_insn): Add and use sibcall parameter.  Add IP and CC
	clobbers to CALL_INSN_FUNCTION_USAGE.
	(define_expand "sibcall_internal")
	(define_expand "sibcall_value_internal"): New.
	(define_expand "call", define_expand "call_value"): Add argument to
	arm_emit_call_insn.
	(define_expand "sibcall"): Use sibcall_internal and arm_emit_call_insn.
	(define_expand "sibcall_value"): Use sibcall_value_internal and
	arm_emit_call_insn.

	* gcc.target/arm/fuse-caller-save.c: New test.
---
 gcc/config/arm/arm-protos.h |  2 +-
 gcc/config/arm/arm.c| 16 -
 gcc/config/arm/arm.md   | 30 +++--
 gcc/testsuite/gcc.target/arm/fuse-caller-save.c | 26 +
 4 files changed, 70 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/arm/fuse-caller-save.c

diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index 74645ee..524fd83 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -126,7 +126,7 @@ extern int arm_const_double_inline_cost (rtx);
 extern bool arm_const_double_by_parts (rtx);
 extern bool arm_const_double_by_immediates (rtx);
 extern const char *fp_immediate_constant (rtx);
-extern void arm_emit_call_insn (rtx, rtx);
+extern void arm_emit_call_insn (rtx, rtx, bool);
 extern const char *output_call (rtx *);
 extern const char *output_call_mem (rtx *);
 void arm_emit_movpair (rtx, rtx);
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 1117bd4..34e0977 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -679,6 +679,9 @@ static const struct attribute_spec arm_attribute_table[] =
 #undef TARGET_CONST_NOT_OK_FOR_DEBUG_P
 #define TARGET_CONST_NOT_OK_FOR_DEBUG_P arm_const_not_ok_for_debug_p
 
+#undef TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
+#define TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS true
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Obstack for minipool constant handling.  */
@@ -17603,7 +17606,7 @@ vfp_emit_fstmd (int base_reg, int count)
the call target.  */
 
 void
-arm_emit_call_insn (rtx pat, rtx addr)
+arm_emit_call_insn (rtx pat, rtx addr, bool sibcall)
 {
   rtx insn;
 
@@ -17614,6 +17617,7 @@ arm_emit_call_insn (rtx pat, rtx addr)
  to the instruction's CALL_INSN_FUNCTION_USAGE.  */
   if (TARGET_VXWORKS_RTP
   && flag_pic
+  && !sibcall
   && GET_CODE (addr) == SYMBOL_REF
   && (SYMBOL_REF_DECL (addr)
 	  ? !targetm.binds_local_p (SYMBOL_REF_DECL (addr))
@@ -17622,6 +17626,16 @@ arm_emit_call_insn (rtx pat, rtx addr)
   require_pic_register ();
   use_reg (&CALL_INSN_FUNCTION_USAGE (insn), cfun->machine->pic_reg);
 }
+
+  if (TARGET_AAPCS_BASED)
+{
+  /* For AAPCS, IP and CC can be clobbered by veneers inserted by the
+	 linker.  We need to add these to allow
+	 arm_call_fusage_contains_non_callee_clobbers to return true.  */
+  rtx *fusage = &CALL_INSN_FUNCTION_USAGE (insn);
+  clobber_reg (fusage, gen_rtx_REG (word_mode, IP_REGNUM));
+  clobber_reg (fusage, gen_rtx_REG (word_mode, CC_REGNUM));
+}
 }
 
 /* Output a 'call' insn.  */
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 75d0541..1209730 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -9090,7 +9090,7 @@
   XEXP (operands[0], 0) = force_reg (Pmode, callee);
 
 pat = gen_call_internal (operands[0], operands[1], operands[2]);
-arm_emit_call_insn (pat, XEXP (operands[0], 0));
+arm_emit_call_insn (pat, XEXP (operands[0], 0), false);
 DONE;
   }"
 )
@@ -9200,7 +9200,7 @@
 
 pat = gen_call_value_internal (operands[0], operands[1],
    operands[2], operands[3]);
-arm_emit_call_insn (pat, XEXP (operands[1], 0));
+arm_emit_call_insn (pat, XEXP (operands[1], 0), false);
 DONE;
   }"
 )
@@ -9350,6 +9350,12 @@
(set_attr "type" "call")]
 )
 
+(define_expand "sibcall_internal"
+  [(parallel [(call (match_operand 0 "memory_operand" "")
+		(match_operand 1 "general_operand" ""))
+	  (return)
+	  (use (match_operand 2 "" ""))])])
+
 ;; We may also be able to do sibcalls for Thumb, but it's much harder...
 (define_expand "sibcall"
   [(parallel [(call (match_operand 0 "memory_operand" "")
@@ -9359,6 +9365,8 @@
   "TARGET_32BIT"
   "
   {
+rtx pat;
+
 if ((!REG_P (XEXP (operands[0], 0))
 	 && GE

Re: [C++11, C++14 PATCH 3/3] Support for SD-6: SG10 Feature Test Recommendations - libstdc++

2014-06-01 Thread Jonathan Wakely

On 31/05/14 08:47 -0400, Ed Smith-Rowland wrote:

This is the libstdc++ and libstdc++ testsuite part.

Apologies for not sending this to libstdc++.


This time you didn't CC gcc-patches.

All libstdc++ patches need to go to gcc-patches and libstdc++, it's
not complicated :-)



Index: include/std/mutex
===
--- include/std/mutex   (revision 211078)
+++ include/std/mutex   (working copy)
@@ -35,6 +35,9 @@
# include 
#else

+// For backwards compatibility of SD-6.


This comment could be more accurate, doesn't the current version of
SD-6 specify exactly this? So it would be more accurate say it's for
conformance (not backwards compatibility), but note that it's also
defined in  because that's more useful. A note in
 would make sense too.


+#define __cpp_lib_shared_mutex 201304
+
#include 
#include 
#include 
Index: include/std/shared_mutex
===
--- include/std/shared_mutex(revision 211078)
+++ include/std/shared_mutex(working copy)
@@ -52,6 +52,9 @@
   */

#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+
+#define __cpp_lib_shared_mutex 201402


As Marc noted for the constexpr macro, this is defined twice. Please
only do so conditionally, or use #undef first.



[patch] libstdc++/61374 fix string_view conversion and update to latest draft

2014-06-01 Thread Jonathan Wakely

Tested x86_64-linux, committed to trunk.

This should probably go on the 4.9 branch too, although we could leave
the old default cosntructor semantics and just fix the conversion
operator.

commit a10c692b32082fa5cf00f2cdc92d44ffa79e3d43
Author: Jonathan Wakely 
Date:   Sun Jun 1 14:19:07 2014 +0100

	PR libstdc++/61374
	* include/experimental/string_view (operator basic_string): Correct
	order of arguments.
	(to_string): Replace with member function.
	Add inline specifiers. Remove unused header. Remove _S_empty_rep and
	allow _M_str to be null.
	* testsuite/experimental/string_view/cons/char/1.cc: Adjust to new
	default constructor semantics.
	* testsuite/experimental/string_view/cons/wchar_t/1.cc: Likewise.
	* testsuite/experimental/string_view/operations/copy/char/1.cc: Fix
	copyright dates. Remove unused header.
	* testsuite/experimental/string_view/operations/copy/wchar_t/1.cc:
	Likewise.
	* testsuite/experimental/string_view/operations/data/char/1.cc:
	Fix copyright dates. Adjust to new default constructor semantics.
	* testsuite/experimental/string_view/operations/data/wchar_t/1.cc:
	Likewise.
	* testsuite/experimental/string_view/operations/to_string/1.cc: New.

diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view
index 6b6588b..49f46af 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -39,7 +39,6 @@
 # include 
 #else
 
-#include 
 #include 
 #include 
 
@@ -66,18 +65,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*_CharT*_M_str
*size_t _M_len
*  @endcode
-   *
-   *  A basic_string_view represents an empty string with a static constexpr
-   *  length one string:
-   *
-   *  @code
-   *static constexpr value_type _S_empty_str[1]{0};
-   *  @endcode
*/
-  template>
+  template>
 class basic_string_view
 {
-
 public:
 
   // types
@@ -99,7 +90,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   constexpr
   basic_string_view() noexcept
-  : _M_len{0}, _M_str{_S_empty_str}
+  : _M_len{0}, _M_str{nullptr}
   { }
 
   constexpr basic_string_view(const basic_string_view&) noexcept = default;
@@ -112,12 +103,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   constexpr basic_string_view(const _CharT* __str)
   : _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
-	_M_str{__str == nullptr ? _S_empty_str : __str}
+	_M_str{__str}
   { }
 
   constexpr basic_string_view(const _CharT* __str, size_type __len)
-  : _M_len{__str == nullptr ? 0 :__len},
-_M_str{__str == nullptr ? _S_empty_str : __str}
+  : _M_len{__len},
+_M_str{__str}
   { }
 
   basic_string_view&
@@ -143,19 +134,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   const_reverse_iterator
   rbegin() const noexcept
-  { return std::reverse_iterator(this->end()); }
+  { return const_reverse_iterator(this->end()); }
 
   const_reverse_iterator
   rend() const noexcept
-  { return std::reverse_iterator(this->begin()); }
+  { return const_reverse_iterator(this->begin()); }
 
   const_reverse_iterator
   crbegin() const noexcept
-  { return std::reverse_iterator(this->end()); }
+  { return const_reverse_iterator(this->end()); }
 
   const_reverse_iterator
   crend() const noexcept
-  { return std::reverse_iterator(this->begin()); }
+  { return const_reverse_iterator(this->begin()); }
 
   // [string.view.capacity], capacity
 
@@ -169,8 +160,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   constexpr size_type
   max_size() const noexcept
-  { return ((npos - sizeof(size_type) - sizeof(void*))
-		/ sizeof(value_type) / 4); }
+  {
+	return (npos - sizeof(size_type) - sizeof(void*))
+		/ sizeof(value_type) / 4;
+  }
 
   constexpr bool
   empty() const noexcept
@@ -195,7 +188,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	 "(which is %zu) >= this->size() "
 	 "(which is %zu)"),
 	 __pos, this->size()),
-		_S_empty_str[0]);
+		*this->_M_str);
   }
 
   constexpr const _CharT&
@@ -219,11 +212,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   { return this->_M_str; }
 
   // [string.view.modifiers], modifiers:
+
   void
   clear() noexcept
   {
 	this->_M_len = 0;
-	this->_M_str = _S_empty_str;
+	this->_M_str = nullptr;
   }
 
   void
@@ -251,8 +245,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template
 explicit operator basic_string<_CharT, _Traits, _Allocator>() const
 {
-	  return basic_string<_CharT, _Traits, _Allocator>
-	(this->_M_len, this->_M_str);
+	  return { this->_M_str, this->_M_len };
+	}
+
+  template>
+	basic_string<_CharT, _Traits, _Allocator>
+	to_string(const _Allocator& __alloc = _Allocator()) const
+	{
+	  return { this->_M_str, this->_M_len, __alloc };
 	}
 
   size_type
@@ -431,8 +431,6 @@ _G

Re: [patch] libstdc++/61374 fix string_view conversion and update to latest draft

2014-06-01 Thread Daniel Krügler
2014-06-01 19:24 GMT+02:00 Jonathan Wakely :
> Tested x86_64-linux, committed to trunk.
>
> This should probably go on the 4.9 branch too, although we could leave
> the old default cosntructor semantics and just fix the conversion
> operator.

Looking at the comparison functions of basic_string_view I noticed
that these are not constexpr (nor seem to be other functions such as
find()).

- Daniel


Re: [patch] libstdc++/61374 fix string_view conversion and update to latest draft

2014-06-01 Thread Marc Glisse

On Sun, 1 Jun 2014, Daniel Krügler wrote:


2014-06-01 19:24 GMT+02:00 Jonathan Wakely :

Tested x86_64-linux, committed to trunk.

This should probably go on the 4.9 branch too, although we could leave
the old default cosntructor semantics and just fix the conversion
operator.


Looking at the comparison functions of basic_string_view I noticed
that these are not constexpr (nor seem to be other functions such as
find()).


We may want to wait until the compiler supports C++14 constexpr, trying to 
implement it with C++11 would be doable but not so useful in my opinion.


--
Marc Glisse


[PATCH, testsuite]: Properly escape brackets in gcc.target/i386/sibcall-X.c scan strings

2014-06-01 Thread Uros Bizjak
Hello!

2014-06-01  Uros Bizjak  

* gcc.target/i386/sibcall-2.c (dg-final): Properly escape '[' and ']'
in scan-assembler-not string.
* gcc.target/i386/sibcall-3.c (dg-final): Ditto.
* gcc.target/i386/sibcall-4.c (dg-final): Ditto.
* gcc.target/i386/sibcall-6.c (dg-final): Ditto.

Tested on x86_64-pc-linux-gnu {,-m32} and committed to mainline SVN.

Uros.
Index: gcc.target/i386/sibcall-2.c
===
--- gcc.target/i386/sibcall-2.c (revision 22)
+++ gcc.target/i386/sibcall-2.c (working copy)
@@ -13,4 +13,4 @@
   return (a < 0 ? doo1 : doo2) (a);
 }
 
-/* { dg-final { scan-assembler-not "call[ \t]*.%eax" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*.%eax" } } */
Index: gcc.target/i386/sibcall-3.c
===
--- gcc.target/i386/sibcall-3.c (revision 22)
+++ gcc.target/i386/sibcall-3.c (working copy)
@@ -13,4 +13,4 @@
   return foo (a);
 }
 
-/* { dg-final { scan-assembler-not "jmp[ \t]*.%eax" } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*.%eax" } } */
Index: gcc.target/i386/sibcall-4.c
===
--- gcc.target/i386/sibcall-4.c (revision 22)
+++ gcc.target/i386/sibcall-4.c (working copy)
@@ -12,4 +12,4 @@
   dispatch[offset](offset);
 }
 
-/* { dg-final { scan-assembler-not "jmp[ \t]*.%eax" } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*.%eax" } } */
Index: gcc.target/i386/sibcall-6.c
===
--- gcc.target/i386/sibcall-6.c (revision 22)
+++ gcc.target/i386/sibcall-6.c (working copy)
@@ -34,4 +34,4 @@
   if (postorder_func)
 (*postorder_func) (loop_node);
 }
-/* { dg-final { scan-assembler "jmp[ \t]*.%eax" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*.%eax" } } */


Re: [MIPS] Add sbasic supoert ffor MSA (SIMD)

2014-06-01 Thread Richard Sandiford
Hi Graham,

Thanks for the patch.  I agree with what Richard and Joseph said.  Also...

I think it'd be better to keep the p5600 bits separate and wait until
the main p5600 patch has gone in.  It looks like it uses a different
naming scheme for the insn reservations.

Graham Stott  writes:
> +(define_constraint "Un31"
> +  "@internal
> +   A replicated vector const in which the replicated value is negative
> +   integer number in range [-31,0]."
> +  (and (match_code "const_vector")
> +   (match_test "mips_const_vector_same_int_p (op, mode, -31, 0)")))
> +
> +(define_constraint "Up31"
> +  "@internal
> +   A replicated vector const in which the replicated value is positive
> +   integer number in range [0,31]."
> +  (and (match_code "const_vector")
> +   (match_test "mips_const_vector_same_int_p (op, mode, 0, 31)")))

The convention so far (and followed by the other constraints in the patch)
is for the number to be a bit count rather than a limit.  So "Unv5" and
"Uuv5" would probably be better ("u" for "unsigned").

> +;; Same as MODE128.  Used by vcond to iterate two modes.
> +(define_mode_iterator MSA_2 [V2DF V4SF V2DI V4SI V8HI V16QI])

"Same as MSA".

> +;; This attribute is used to form the MODE for reg_or_0_operand
> +;; constraint.
> +(define_mode_attr REGOR0
> +  [(V2DF "DF")
> +   (V4SF "SF")
> +   (V2DI "DI")
> +   (V4SI "SI")
> +   (V8HI "SI")
> +   (V16QI "SI")])

I still don't really like this part.  It's used only for two rvalues
and in both cases I think should be using UNITMODE instead.  If necessary,
we should take a lowpart subreg _before_ calling the gen_* routine.
As well as (IMO) being cleaner, it will tell the rtl optimisers that
bits above the unit mode are "don't care".

> +(define_expand "vec_extract"
> +  [(match_operand: 0 "register_operand")
> +   (match_operand:IMSA 1 "register_operand")
> +   (match_operand 2 "const_int_operand")]
> +  "ISA_HAS_MSA"
> +{
> +  gcc_assert (UINTVAL (operands[2]) < GET_MODE_NUNITS (mode));

Why not:

(define_expand "vec_extract"
  [(match_operand: 0 "register_operand")
   (match_operand:IMSA 1 "register_operand")
   (match_operand 2 "const__operand")]
  "ISA_HAS_MSA"
{
...
}

without the assert?

> +  rtx dest1 = gen_reg_rtx (SImode);
> +  emit_insn (gen_msa_copy_s_ (dest1, operands[1], operands[2]));
> +  emit_move_insn (operands[0],
> +   gen_lowpart (mode, dest1));

Why not just make copy_s assign directly in UNITMODE?

> +(define_expand "vec_extract"
> +  [(match_operand: 0 "register_operand")
> +   (match_operand:FMSA 1 "register_operand")
> +   (match_operand 2 "const_int_operand")]
> +  "ISA_HAS_MSA"
> +{
> +  rtx temp;
> +  HOST_WIDE_INT val = UINTVAL (operands[2]);
> +
> +  gcc_assert (val < GET_MODE_NUNITS (mode));

Looks like const__operand would be better than an assert
here too.  Several other cases later; won't list them all.

> +  /* We need to do the SLDI operation in V16QImode and adjust
> +   * operand[2] accordingly.  */

No "*" at the beginning of the second line.

> +  rtx op2b  = GEN_INT (val * GET_MODE_SIZE (mode));

Should only be one space before "=".

> +  rtx res = gen_reg_rtx (mode);
> +  rtx temp1 = gen_reg_rtx (mode);
> +  rtx temp2 = gen_reg_rtx (mode);
> +  rtx xres = gen_reg_rtx (mode);
> +  rtx xop1 = gen_reg_rtx (mode);
> +  rtx xop2 = gen_reg_rtx (mode);
> +
> +  mips_expand_msa_vcond (res, true_val, false_val,
> +  GET_CODE (operands[3]), operands[4], operands[5]);
> +  // Results in -1 or 0 so need to convert this to correct result for the
> +  // correct true/false given by operands[1]/operands[2] repectively.
> +  emit_move_insn (xres, res);
> +  if (operands[1] != true_val)
> + {
> +   emit_move_insn (xop1, operands[1]);
> +   emit_insn (gen_and3 (temp1, xres, xop1));
> + }
> +  else
> + emit_move_insn (temp1, xres);

Should only create xop1 and xop2 if they're needed (i.e. in the
"if" arms), otherwise the register number goes to waste.  Why is
the temporary needed though?  The predicates require a register_operand
or true_val, so can't you use operands[1] directly?

> +  emit_move_insn (temp2, CONSTM1_RTX (mode));
> +  emit_insn (gen_xor3 (temp2, xres, temp2));

Since there's a NOR instruction, I think we should have a (not ...)
pattern and use that instead of this sequence.

> +  if (operands[2] != false_val)
> + {
> +   emit_move_insn (xop2, operands[2]);
> +   emit_insn (gen_and3 (temp2, temp2, xop2));
> + }
> +  emit_insn (gen_ior3 (xres, temp1, temp2));
> +  emit_move_insn (operands[0], xres);

Same comment about needing xop2 here.

> +(define_expand "vcond"
> +  [(set (match_operand:MSA_2 0 "register_operand")
> + (if_then_else:MSA_2
> +   (match_operator 3 ""
> + [(match_operand:MSA 4 "register_operand")
> +  (match_operand:MSA 5 "register_operand")])
> +   (match_operand:MSA_2 1 "reg_or_m1_oper

[PATCH, i386]: Rename two @internal constraints

2014-06-01 Thread Uros Bizjak
Hello!

This change renames two @internal constraints to free two letters.

2014-06-01  Uros Bizjak  

* config/i386/constraints.md (Bw): Rename from 'w'.
(Bz): Rename from 'z'.
* config/i386/i386.md: Change 'w' to 'Bw' and 'z' to 'Bz' globally.

Tested on x86_64-linux-gnu {,-m32}  and committed to mainline.

Uros.
Index: config/i386/constraints.md
===
--- config/i386/constraints.md  (revision 22)
+++ config/i386/constraints.md  (working copy)
@@ -19,7 +19,7 @@
 
 ;;; Unused letters:
 ;;;   H
-;;;   h j
+;;;   h jw  z
 
 ;; Integer register constraints.
 ;; It is not necessary to define 'r' here.
@@ -91,6 +91,9 @@
 (define_register_constraint "x" "TARGET_SSE ? SSE_REGS : NO_REGS"
  "Any SSE register.")
 
+(define_register_constraint "v" "TARGET_SSE ? ALL_SSE_REGS : NO_REGS"
+ "Any EVEX encodable SSE register (@code{%xmm0-%xmm31}).")
+
 ;; We use the Y prefix to denote any number of conditional register sets:
 ;;  z  First SSE register.
 ;;  i  SSE2 inter-unit moves to SSE register enabled
@@ -144,8 +147,10 @@
  "(ix86_fpmath & FPMATH_387) ? FLOAT_REGS : NO_REGS"
  "@internal Any x87 register when 80387 FP arithmetic is enabled.")
 
-;; We use the B prefix to denote any number of internal memory operands:
-;;  s  Sibling memory operand.
+;; We use the B prefix to denote any number of internal operands:
+;;  s  Sibcall memory operand, not valid for TARGET_X32
+;;  w  Call memory operand, not valid for TARGET_X32
+;;  z  Constant call address operand.
 
 (define_constraint "Bs"
   "@internal Sibcall memory operand."
@@ -152,18 +157,15 @@
   (and (not (match_test "TARGET_X32"))
(match_operand 0 "sibcall_memory_operand")))
 
-(define_register_constraint "v" "TARGET_SSE ? ALL_SSE_REGS : NO_REGS"
- "Any EVEX encodable SSE register (@code{%xmm0-%xmm31}).")
+(define_constraint "Bw"
+  "@internal Call memory operand."
+  (and (not (match_test "TARGET_X32"))
+   (match_operand 0 "memory_operand")))
 
-(define_constraint "z"
+(define_constraint "Bz"
   "@internal Constant call address operand."
   (match_operand 0 "constant_call_address_operand"))
 
-(define_constraint "w"
-  "@internal Call memory operand."
-  (and (not (match_test "TARGET_X32"))
-   (match_operand 0 "memory_operand")))
-
 ;; Integer constant constraints.
 (define_constraint "I"
   "Integer constant in the range 0 @dots{} 31, for 32-bit shifts."
Index: config/i386/i386.md
===
--- config/i386/i386.md (revision 22)
+++ config/i386/i386.md (working copy)
@@ -11182,7 +11182,7 @@
 })
 
 (define_insn "*indirect_jump"
-  [(set (pc) (match_operand:W 0 "indirect_branch_operand" "rw"))]
+  [(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))]
   ""
   "jmp\t%A0"
   [(set_attr "type" "ibr")
@@ -11230,7 +11230,7 @@
 })
 
 (define_insn "*tablejump_1"
-  [(set (pc) (match_operand:W 0 "indirect_branch_operand" "rw"))
+  [(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))
(use (label_ref (match_operand 1)))]
   ""
   "jmp\t%A0"
@@ -11360,7 +11360,7 @@
 })
 
 (define_insn "*call"
-  [(call (mem:QI (match_operand:W 0 "call_insn_operand" "zw"))
+  [(call (mem:QI (match_operand:W 0 "call_insn_operand" "BwBz"))
 (match_operand 1))]
   "!SIBLING_CALL_P (insn)"
   "* return ix86_output_call_insn (insn, operands[0]);"
@@ -11368,7 +11368,7 @@
 
 (define_insn "*call_rex64_ms_sysv"
   [(match_parallel 2 "call_rex64_ms_sysv_operation"
-[(call (mem:QI (match_operand:DI 0 "call_insn_operand" "rzw"))
+[(call (mem:QI (match_operand:DI 0 "call_insn_operand" "rBwBz"))
   (match_operand 1))
  (unspec [(const_int 0)] UNSPEC_MS_TO_SYSV_CALL)])]
   "TARGET_64BIT && !SIBLING_CALL_P (insn)"
@@ -11376,7 +11376,7 @@
   [(set_attr "type" "call")])
 
 (define_insn "*sibcall"
-  [(call (mem:QI (match_operand:W 0 "sibcall_insn_operand" "UzBs"))
+  [(call (mem:QI (match_operand:W 0 "sibcall_insn_operand" "UBsBz"))
 (match_operand 1))]
   "SIBLING_CALL_P (insn)"
   "* return ix86_output_call_insn (insn, operands[0]);"
@@ -11396,7 +11396,7 @@
 })
 
 (define_insn "*call_pop"
-  [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lzm"))
+  [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lmBz"))
 (match_operand 1))
(set (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
@@ -11406,7 +11406,7 @@
   [(set_attr "type" "call")])
 
 (define_insn "*sibcall_pop"
-  [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "UzBs"))
+  [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "UBsBz"))
 (match_operand 1))
(set (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
@@ -11443,7 +11443,7 @@
 
 (define_insn "*call_value"
   [(set (match_operand 0)
-   (call (mem:QI (match_operand:W 1 "call_insn_operand" "zw"))
+   (call (mem:QI (match_operand:W 1 "call_insn_operand" "BwBz"))
  (match_operand 2

[PATCH, testsuite]: Fixes for recent ia32 testsuite failures

2014-06-01 Thread Uros Bizjak
Hello!

Plus a more modern dg-do target selector instead of dg-require-effective-target.

2014-06-01  Uros Bizjak  

* gcc.target/i386/sibcall-2.c: Xfail dg-final scan-assembler-not,
not compilation.
* gcc.target/i386/sibcall-4.c: Ditto.
* gcc.target/i386/fuse-caller-save.c: Add -mregparm=1 for ia32 target.

Tested on x86_64-pc-linux-gnu {,-m32} and committed to mainline SVN.

Uros.
Index: fuse-caller-save.c
===
--- fuse-caller-save.c  (revision 22)
+++ fuse-caller-save.c  (working copy)
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fuse-caller-save" } */
+/* { dg-additional-options "-mregparm=1" { target ia32 } } */
+
 /* Testing -fuse-caller-save optimization option.  */
 
 static int __attribute__((noinline))
Index: sibcall-1.c
===
--- sibcall-1.c (revision 22)
+++ sibcall-1.c (working copy)
@@ -1,5 +1,4 @@
-/* { dg-do compile } */
-/* { dg-require-effective-target ia32 } */
+/* { dg-do compile { target ia32 } } */
 /* { dg-options "-O2" } */
 
 extern int (*foo)(int);
Index: sibcall-2.c
===
--- sibcall-2.c (revision 28)
+++ sibcall-2.c (working copy)
@@ -1,5 +1,4 @@
-/* { dg-do compile { xfail { *-*-* } } } */
-/* { dg-require-effective-target ia32 } */
+/* { dg-do compile { target ia32 } } */
 /* { dg-options "-O2" } */
 
 extern int doo1 (int);
@@ -13,4 +12,4 @@
   return (a < 0 ? doo1 : doo2) (a);
 }
 
-/* { dg-final { scan-assembler-not "call\[ \t\]*.%eax" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*.%eax" { xfail *-*-* } } } */
Index: sibcall-3.c
===
--- sibcall-3.c (revision 28)
+++ sibcall-3.c (working copy)
@@ -1,5 +1,4 @@
-/* { dg-do compile } */
-/* { dg-require-effective-target ia32 } */
+/* { dg-do compile { target ia32 } } */
 /* { dg-options "-O2" } */
 
 extern 
Index: sibcall-4.c
===
--- sibcall-4.c (revision 28)
+++ sibcall-4.c (working copy)
@@ -1,6 +1,5 @@
 /* Testcase for PR target/46219.  */
-/* { dg-do compile { xfail { *-*-* } } } */
-/* { dg-require-effective-target ia32 } */
+/* { dg-do compile  { target ia32 } } */
 /* { dg-options "-O2" } */
 
 typedef void (*dispatch_t)(long offset);
@@ -12,4 +11,4 @@
   dispatch[offset](offset);
 }
 
-/* { dg-final { scan-assembler-not "jmp\[ \t\]*.%eax" } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*.%eax" { xfail *-*-* } } } */
Index: sibcall-5.c
===
--- sibcall-5.c (revision 22)
+++ sibcall-5.c (working copy)
@@ -1,6 +1,5 @@
 /* Check that indirect sibcalls understand regparm.  */
-/* { dg-do run } */
-/* { dg-require-effective-target ia32 } */
+/* { dg-do run { target ia32 } } */
 /* { dg-options "-O2" } */
 
 extern void abort (void);
Index: sibcall-6.c
===
--- sibcall-6.c (revision 28)
+++ sibcall-6.c (working copy)
@@ -1,5 +1,4 @@
-/* { dg-do compile } */
-/* { dg-require-effective-target ia32 } */
+/* { dg-do compile { target ia32 } } */
 /* { dg-options "-O2" } */
 
 typedef void *ira_loop_tree_node_t;


[patch] simplify

2014-06-01 Thread Jonathan Wakely

2014-06-01  Jonathan Wakely  

* include/bits/uses_allocator.h (__uses_allocator_helper): Simplify.
(__uses_allocator_arg): Remove unused type.
(__uses_alloc0): Turn into a trivial type.
(__uses_alloc): Add missing template parameter in primary template.
(__uses_alloc_impl): Rename to __uses_alloc_t.

Tested x86_64-linux, committed to trunk.

commit da76587f882eb9656b164b3ad25091fe41ef60ad
Author: Jonathan Wakely 
Date:   Sun Jun 1 22:33:52 2014 +0100

	* include/bits/uses_allocator.h (__uses_allocator_helper): Simplify.
	(__uses_allocator_arg): Remove unused type.
	(__uses_alloc0): Turn into a trivial type.
	(__uses_alloc): Add missing template parameter in primary template.
	(__uses_alloc_impl): Rename to __uses_alloc_t.

diff --git a/libstdc++-v3/include/bits/uses_allocator.h b/libstdc++-v3/include/bits/uses_allocator.h
index 10131c0..7281508 100644
--- a/libstdc++-v3/include/bits/uses_allocator.h
+++ b/libstdc++-v3/include/bits/uses_allocator.h
@@ -45,35 +45,33 @@ _GLIBCXX_HAS_NESTED_TYPE(allocator_type)
   template::value>
 struct __uses_allocator_helper
-: public false_type { };
+: false_type { };
 
   template
 struct __uses_allocator_helper<_Tp, _Alloc, true>
-: public integral_constant::value>
+: is_convertible<_Alloc, typename _Tp::allocator_type>::type
 { };
 
   /// [allocator.uses.trait]
   template
 struct uses_allocator
-: public integral_constant::value>
+: __uses_allocator_helper<_Tp, _Alloc>::type
 { };
 
-  template
-struct __uses_allocator_arg
-: is_constructible<_Tp, _Alloc, _Args...>
-{ static_assert( uses_allocator<_Tp, _Alloc>::value, "uses allocator" ); };
-
   struct __uses_alloc_base { };
+
   struct __uses_alloc0 : __uses_alloc_base
-  { struct _Anything { _Anything(...) { } } _M_a; };
+  {
+struct _Sink { void operator=(const void*) { } } _M_a;
+  };
+
   template
 struct __uses_alloc1 : __uses_alloc_base { const _Alloc* _M_a; };
+
   template
 struct __uses_alloc2 : __uses_alloc_base { const _Alloc* _M_a; };
 
-  template
+  template
 struct __uses_alloc;
 
   template
@@ -89,15 +87,14 @@ _GLIBCXX_HAS_NESTED_TYPE(allocator_type)
 : __uses_alloc0 { };
 
   template
-struct __uses_alloc_impl
-: __uses_alloc::value, _Tp,  _Alloc, _Args...>
-{ };
+using __uses_alloc_t =
+  __uses_alloc::value, _Tp, _Alloc, _Args...>;
 
   template
-__uses_alloc_impl<_Tp, _Alloc, _Args...>
+inline __uses_alloc_t<_Tp, _Alloc, _Args...>
 __use_alloc(const _Alloc& __a)
 {
-  __uses_alloc_impl<_Tp, _Alloc, _Args...> __ret;
+  __uses_alloc_t<_Tp, _Alloc, _Args...> __ret;
   __ret._M_a = &__a;
   return __ret;
 }


Re: [patch] simplify

2014-06-01 Thread Daniel Krügler
2014-06-02 0:35 GMT+02:00 Jonathan Wakely :
> 2014-06-01  Jonathan Wakely  
>
> * include/bits/uses_allocator.h (__uses_allocator_helper): Simplify.
> (__uses_allocator_arg): Remove unused type.
> (__uses_alloc0): Turn into a trivial type.
> (__uses_alloc): Add missing template parameter in primary template.
> (__uses_alloc_impl): Rename to __uses_alloc_t.

Some of the changes remove the explicit access-specifier (public) from
base classes, such as

: public false_type
=>
: false_type

In the affected examples this does not introduce a change of meaning
(because the classes are declared as structs), but my understanding
had been in the past that base class access specifiers should always
been provided in gcc code bases to make the code robust against
potential refactoring.

Is this simply an incorrect understanding of mine that is not based by
the gcc coding styles? I thought that Paolo taught me the
"explicit-access-style", but I might err.

- Daniel


Re: [patch] simplify

2014-06-01 Thread Jonathan Wakely

On 02/06/14 00:46 +0200, Daniel Krügler wrote:

Some of the changes remove the explicit access-specifier (public) from
base classes, such as

: public false_type
=>
: false_type

In the affected examples this does not introduce a change of meaning
(because the classes are declared as structs), but my understanding
had been in the past that base class access specifiers should always
been provided in gcc code bases to make the code robust against
potential refactoring.

Is this simply an incorrect understanding of mine that is not based by
the gcc coding styles? I thought that Paolo taught me the
"explicit-access-style", but I might err.


I consider them to be redundant clutter, but I didn't realise we had
such a rule, so I'm happy to put the access-specifiers back.



Re: [patch] simplify

2014-06-01 Thread Daniel Krügler
2014-06-02 0:50 GMT+02:00 Jonathan Wakely :
> On 02/06/14 00:46 +0200, Daniel Krügler wrote:
>>
>> Some of the changes remove the explicit access-specifier (public) from
>> base classes, such as
>>
>> : public false_type
>> =>
>> : false_type
>>
>> In the affected examples this does not introduce a change of meaning
>> (because the classes are declared as structs), but my understanding
>> had been in the past that base class access specifiers should always
>> been provided in gcc code bases to make the code robust against
>> potential refactoring.
>>
>> Is this simply an incorrect understanding of mine that is not based by
>> the gcc coding styles? I thought that Paolo taught me the
>> "explicit-access-style", but I might err.
>
> I consider them to be redundant clutter, but I didn't realise we had
> such a rule, so I'm happy to put the access-specifiers back.

My formulation was intentionally tentative, because I never searched
for that coding rule. Maybe Paolo could help to clarify.

- Daniel


Re: [patch] simplify

2014-06-01 Thread Paolo Carlini

Hi,

On 06/02/2014 12:52 AM, Daniel Krügler wrote:
My formulation was intentionally tentative, because I never searched 
for that coding rule. Maybe Paolo could help to clarify. 
As far as I remember, we never explicitly discussed that coding rule, 
it's largely an historical accident. Thus I would not object to not 
using it (as long as we are consistent...)


Paolo.



Re: [PATCH] Do not build libsanitizer also for powerpc*-*-linux*

2014-06-01 Thread Konstantin Serebryany
On Sat, May 31, 2014 at 11:53 PM, Peter Bergner  wrote:
> On Fri, 2014-05-30 at 15:49 +0200, Jakub Jelinek wrote:
>> On Fri, May 30, 2014 at 08:09:22AM -0500, Peter Bergner wrote:
>> > On Thu, 2014-05-29 at 14:07 -0500, Peter Bergner wrote:
>> > > On Wed, 2014-05-28 at 09:36 +0200, Thomas Schwinge wrote:
>> > > > This is being discussed in the thread at
>> > > > .  Until that
>> > > > has been resolved, I do agree to check in the following patch (and have
>> > > > successfully tested it, but cannot formally approve it for commit; thus
>> > > > copying the libsanitizer maintainers):
>> > >
>> > > The re-enablement patch was submitted to the llvm mailing list here:
>> > >
>> > >   
>> > > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140526/219249.html
>> > >
>> > > Once that is committed and merged into gcc, we can re-enable building
>> > > libsanitizer for powerpc*-linux.
>> >
>> > Ok, it was committed upstream as revision 209879.  Kostya, can we get
>> > this merged into gcc trunk and powerpc*-linux re-enabled again?  Thanks.
>>
>> I've cherry-picked the two upstream commits and after testing on
>> x86_64-linux/i686-linux committed to trunk.
>
> Great, thanks!  I bootstrapped and ran the asan testsuite.  I'm now seeing
> lots of FAILs due to:
>
>   ASan runtime does not come first in initial library list; you should either
>   link runtime to your application or manually preload it with LD_PRELOAD.
>
> ...which Paolo mentioned in the other thread that he is hitting this too.
> There was some discussion on what to do, but has there been a decision on
> how to fix this yet?  Or is it fixed upstream and we just need to merge
> that fix too?
Yuri needs to send the patch to llvm-commits.
>
> Peter
>
>


[PATCH] Fix logic for detection of zero initializer (PR c/53119)

2014-06-01 Thread S. Gilles
This patch addresses PR 53119 (-Wmissing-braces wrongly warns about
universal zero initializer {0}). As a result, initializations in C of
the form struct foo a = { 0 }; will not trigger warnings from
-Wmissing-braces or -Wmissing-field-initializers.

The detection for constructor_zeroinit has been changed. Instead of
examining constructor_elements, which gives false negatives, each
element is now examined as it is processed. The warning for missing
braces is then moved to pop_init_level, where it can benefit from
constructor_zeroinit.

Bootstrapped and regtested on x86_64 linux, with added test case. If
this is approved, could someone commit it for me, as I do not have
access?

S. Gilles

2014-06-01  S. Gilles  

gcc/ChangeLog:
PR c/53119
c/
* c-typeck.c (push_init_level, process_init_element,
pop_init_level): Correct check for zero initialization, move
missing brace warning to respect zero initialization.

* gcc.dg/pr53119.c: New testcase.

Index: gcc/c/c-typeck.c
===
--- gcc/c/c-typeck.c(revision 211081)
+++ gcc/c/c-typeck.c(working copy)
@@ -74,9 +74,9 @@
if expr.original_code == SIZEOF_EXPR.  */
 tree c_last_sizeof_arg;
 
-/* Nonzero if we've already printed a "missing braces around initializer"
-   message within this initializer.  */
-static int missing_braces_mentioned;
+/* Nonzero if we might need to print a "missing braces around
+   initializer" message within this initializer.  */
+static int found_missing_braces;
 
 static int require_constant_value;
 static int require_constant_elements;
@@ -6858,6 +6858,9 @@
 /* 1 if this constructor is erroneous so far.  */
 static int constructor_erroneous;
 
+/* 1 if this constructor is the universal zero initializer { 0 } */
+static int constructor_zeroinit;
+
 /* Structure for managing pending initializer elements, organized as an
AVL tree.  */
 
@@ -7019,7 +7022,7 @@
   constructor_stack = 0;
   constructor_range_stack = 0;
 
-  missing_braces_mentioned = 0;
+  found_missing_braces = 0;
 
   spelling_base = 0;
   spelling_size = 0;
@@ -7114,6 +7117,7 @@
   constructor_type = type;
   constructor_incremental = 1;
   constructor_designated = 0;
+  constructor_zeroinit = 1;
   designator_depth = 0;
   designator_erroneous = 0;
 
@@ -7317,12 +7321,8 @@
set_nonincremental_init (braced_init_obstack);
 }
 
-  if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned)
-{
-  missing_braces_mentioned = 1;
-  warning_init (input_location, OPT_Wmissing_braces,
-   "missing braces around initializer");
-}
+  if (implicit == 1)
+  found_missing_braces = 1;
 
   if (TREE_CODE (constructor_type) == RECORD_TYPE
   || TREE_CODE (constructor_type) == UNION_TYPE)
@@ -7455,6 +7455,14 @@
}
 }
 
+  /* Warn when some structs are initialized with direct aggregation.  */
+  if (!implicit && found_missing_braces && warn_missing_braces
+  && !constructor_zeroinit)
+{
+  warning_init (input_location, OPT_Wmissing_braces,
+   "missing braces around initializer");
+}
+
   /* Warn when some struct elements are implicitly initialized to zero.  */
   if (warn_missing_field_initializers
   && constructor_type
@@ -7461,10 +7469,6 @@
   && TREE_CODE (constructor_type) == RECORD_TYPE
   && constructor_unfilled_fields)
 {
-   bool constructor_zeroinit =
-(vec_safe_length (constructor_elements) == 1
- && integer_zerop ((*constructor_elements)[0].value));
-
/* Do not warn for flexible array members or zero-length arrays.  */
while (constructor_unfilled_fields
   && (!DECL_SIZE (constructor_unfilled_fields)
@@ -8594,6 +8598,11 @@
   designator_depth = 0;
   designator_erroneous = 0;
 
+  if (!implicit && value.value && !integer_zerop (value.value))
+{
+  constructor_zeroinit = 0;
+}
+
   /* Handle superfluous braces around string cst as in
  char x[] = {"foo"}; */
   if (string_flag
Index: gcc/testsuite/gcc.dg/pr53119.c
===
--- gcc/testsuite/gcc.dg/pr53119.c  (revision 0)
+++ gcc/testsuite/gcc.dg/pr53119.c  (working copy)
@@ -0,0 +1,29 @@
+
+/* { dg-do compile } */
+
+/* { dg-options "-Wmissing-braces -Wmissing-field-initializers" } */
+
+struct a {
+int x;
+int y;
+};
+
+struct b {
+struct a w;
+struct a z;
+};
+
+int main (void)
+{
+struct a az = { 0 };
+struct a anz = { 1 };   /* { dg-warning "missing initializer for" } */
+
+struct b bz = { 0 };
+struct b bnz = { 1, 2, 3, 4 };  /* { dg-warning "missing braces" }  */
+
+struct b extra = { 0, 0 };
+
+return 0;
+}
+
+/* { dg-excess-errors "note" } */


RE: [PATCH, Fortran] PR61234: -Wuse-no-only

2014-06-01 Thread VandeVondele Joost
> What is the rationale of
>
> +  SUBROUTINE S2
> + USE foo, ONLY: bar ! { dg-bogus "has no ONLY qualifier" }
> +  END SUBROUTINE

This explicitly tests that no bogus error message is issued for a use statement 
that has an only qualifier ?

Re: [PATCH] Do not build libsanitizer also for powerpc*-*-linux*

2014-06-01 Thread Yury Gribov

There was some discussion on what to do, but has there been a decision on
how to fix this yet?  Or is it fixed upstream and we just need to merge
that fix too?

Yuri needs to send the patch to llvm-commits.


I think I already did that: D3911

-Y


RE: [PATCH, Fortan] fix initialization of flag_errno_math and flag_associative_math

2014-06-01 Thread VandeVondele Joost
> Why do you want -fno-math-errno to be the default for gfortran?

because it was with rth's commit? This makes sense also because errno is a 
variable that is defined for C, and not accessible from Fortran. Why would you 
want -fmath-errno to be the default ?

>  if (flag_associative_math == -1)
>flag_associative_math = (!flag_trapping_math && !flag_signed_zeros);

> Why this is not working is beyond my understanding, but I am not sure that 
> your fix is the right one.

while the details of the option handling are rather opaque to me to, at the 
point of reaching this statement, flag_associative_math currently equals 0 or 1 
even if the user didn't specify the flag. I believe as set by 
common_handle_option. With my patch, the value of -1 is seen when the user did 
not specify the flag explicitly.

Note that the go frontend uses a similar approach for errno.

Joost



Re: [PATCH] Do not build libsanitizer also for powerpc*-*-linux*

2014-06-01 Thread Yury Gribov
Looks like now function does not return anything for ARM case? I'd say 
we should replace this pc = ... with return like all other cases, the 
code is just asking for trouble.


--- libsanitizer/sanitizer_common/sanitizer_stacktrace.cc   (revision 
209878)
+++ libsanitizer/sanitizer_common/sanitizer_stacktrace.cc   (revision 
209879)
@@ -18,11 +18,13 @@
  namespace __sanitizer {

  uptr StackTrace::GetPreviousInstructionPc(uptr pc) {
-#ifdef __arm__
+#if defined(__arm__)
// Cancel Thumb bit.
pc = pc & (~1);
-#endif
-#if defined(__sparc__)
+#elif defined(__powerpc__) || defined(__powerpc64__)
+  // PCs are always 4 byte aligned.
+  return pc - 4;
+#elif defined(__sparc__)
return pc - 8;
  #else
return pc - 1;



[C/C++ PATCH] Add -Wlogical-not-parentheses (PR c/49706)

2014-06-01 Thread Marek Polacek
PR61271 showed that this warning, recently added to clang, is quite
useful and detected several reckless cases in the GCC codebase.
This patch adds this warning even for GCC.  Due to PR61271,
it's not a part of -Wall, that would break the bootstrap, but
after that is fixed, I think we want this warning be a part of
-Wall or -Wextra.

It's possible to suppress the warning by enclosing the LHS
in parentheses.  This proved to be hard to achieve in the C++
FE, so I had to go all the way up to parser...  Jason, does the
"bool parenthesized_not_lhs_warn" line looks reasonable?

Also for C++, I think we don't want this warning to trigger when the
operator (==, !=, >, <, <=, >=) is overloaded.  But I admit
I haven't even tried that, and I don't know how to detect overloaded
operators except DECL_OVERLOADED_OPERATOR_P.

Regtested/bootstrapped on x86_64-unknown-linux-gnu, ok for trunk?

2014-06-02  Marek Polacek  

PR c/49706
* doc/invoke.texi: Document -Wlogical-not-parentheses.
c-family/
* c-common.c (warn_logical_not_parentheses): New function.
* c-common.h (warn_logical_not_parentheses): Declare.
* c.opt (Wlogical-not-parentheses): New option.
c/
* c-typeck.c (parser_build_binary_op): Warn when logical not is used
on the left hand side operand of a comparison. 
cp/
* parser.c (cp_parser_binary_expression): Warn when logical not is
used on the left hand side operand of a comparison.
testsuite/
* c-c++-common/pr49706.c: New test.

diff --git gcc/c-family/c-common.c gcc/c-family/c-common.c
index 6ec14fc..650afaf 100644
--- gcc/c-family/c-common.c
+++ gcc/c-family/c-common.c
@@ -1722,6 +1722,25 @@ warn_logical_operator (location_t location, enum 
tree_code code, tree type,
 }
 }
 
+/* Warn about logical not used on the left hand side operand of a comparison.
+   This function assumes that the LHS is inside of TRUTH_NOT_EXPR.
+   Do not warn if the LHS or RHS is of a boolean or a vector type.  */
+
+void
+warn_logical_not_parentheses (location_t location, enum tree_code code,
+ tree lhs, tree rhs)
+{
+  if (TREE_CODE_CLASS (code) != tcc_comparison
+  || TREE_CODE (TREE_TYPE (lhs)) == BOOLEAN_TYPE
+  || TREE_CODE (TREE_TYPE (rhs)) == BOOLEAN_TYPE
+  || VECTOR_TYPE_P (TREE_TYPE (lhs))
+  || VECTOR_TYPE_P (TREE_TYPE (rhs)))
+return;
+
+  warning_at (location, OPT_Wlogical_not_parentheses,
+ "logical not is only applied to the left hand side of "
+ "comparison");
+}
 
 /* Warn if EXP contains any computations whose results are not used.
Return true if a warning is printed; false otherwise.  LOCUS is the
diff --git gcc/c-family/c-common.h gcc/c-family/c-common.h
index 0d34004..83d5dee 100644
--- gcc/c-family/c-common.h
+++ gcc/c-family/c-common.h
@@ -772,6 +772,8 @@ extern void overflow_warning (location_t, tree);
 extern bool warn_if_unused_value (const_tree, location_t);
 extern void warn_logical_operator (location_t, enum tree_code, tree,
   enum tree_code, tree, enum tree_code, tree);
+extern void warn_logical_not_parentheses (location_t, enum tree_code, tree,
+ tree);
 extern void check_main_parameter_types (tree decl);
 extern bool c_determine_visibility (tree);
 extern bool vector_types_compatible_elements_p (tree, tree);
diff --git gcc/c-family/c.opt gcc/c-family/c.opt
index c586e65..d51c890 100644
--- gcc/c-family/c.opt
+++ gcc/c-family/c.opt
@@ -490,6 +490,10 @@ Wlogical-op
 C ObjC C++ ObjC++ Var(warn_logical_op) Init(0) Warning 
 Warn when a logical operator is suspiciously always evaluating to true or false
 
+Wlogical-not-parentheses
+C ObjC C++ ObjC++ Var(warn_logical_not_paren) Warning
+Warn when logical not is used on the left hand side operand of a comparison
+
 Wlong-long
 C ObjC C++ ObjC++ Var(warn_long_long) Init(-1) Warning
 Do not warn about using \"long long\" when -pedantic
diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c
index 6ca584b..f3b142f 100644
--- gcc/c/c-typeck.c
+++ gcc/c/c-typeck.c
@@ -3401,6 +3401,11 @@ parser_build_binary_op (location_t location, enum 
tree_code code,
 warn_logical_operator (location, code, TREE_TYPE (result.value),
   code1, arg1.value, code2, arg2.value);
 
+  if (warn_logical_not_paren
+  && code1 == TRUTH_NOT_EXPR
+  && TREE_CODE (arg1.value) == EQ_EXPR)
+warn_logical_not_parentheses (location, code, arg1.value, arg2.value);
+
   /* Warn about comparisons against string literals, with the exception
  of testing for equality or inequality of a string literal with NULL.  */
   if (code == EQ_EXPR || code == NE_EXPR)
diff --git gcc/cp/parser.c gcc/cp/parser.c
index 2591ae5..1ced05a 100644
--- gcc/cp/parser.c
+++ gcc/cp/parser.c
@@ -7883,6 +7883,8 @@ cp_parser_binary_expression (cp_parser* parser, bool 
cast_p,
   enum tree_code rhs_type;
   enum cp_parser_prec new_prec, lookahead_prec;
   tree overloa

Re: [C PATCH] Don't reject valid code with _Alignas (PR c/61053)

2014-06-01 Thread Marek Polacek
Ping.

On Sun, May 25, 2014 at 11:30:51AM +0200, Marek Polacek wrote:
> On Mon, May 05, 2014 at 10:27:03PM +0200, Marek Polacek wrote:
> > In this PR the issue is that we reject (valid) code such as
> > _Alignas (long long) long long foo;
> > with -m32, because we trip this condition:
> > 
> >alignas_align = 1U << declspecs->align_log;
> >if (alignas_align < TYPE_ALIGN_UNIT (type))
> >  {
> >if (name)
> >  error_at (loc, "%<_Alignas%> specifiers cannot reduce "
> >"alignment of %qE", name);
> > 
> > and error later on, since alignas_align is 4 (correct, see PR52023 for
> > why), but TYPE_ALIGN_UNIT of long long is 8.  I think TYPE_ALIGN_UNIT
> > is wrong here as that won't give us minimal alignment required.
> > In c_sizeof_or_alignof_type we already have the code to compute such
> > minimal alignment so I just moved the code to a separate function
> > and used that instead of TYPE_ALIGN_UNIT.
> > 
> > Note that the test is run only on i?86 and x86_64, because we can't (?)
> > easily determine which target requires what alignment.
> > 
> > Regtested/bootstrapped on x86_64-unknown-linux-gnu and
> > powerpc64-unknown-linux-gnu, ok for trunk?
> 
> Can I backport this one to 4.9?

Marek