Re: [Fortran-Dev] Update SIZE/SHAPE and extent handling

2013-05-06 Thread Tobias Burnus

Tobias Burnus wrote:
Build and regtested on x86-64-gnu-linux. I intent to commit the patch 
soon.


Committed as Rev. 198623 + merged trunk into the branch (Rev. 198624).

Tobias


Re: [PATCH, i386]: Fix PR 57106, -fcompare-debug failure with -O2 -fschedule-insns -funroll-all-loops

2013-05-06 Thread Yuri Rumyantsev
Uros,

The fix looks good to me.

Best regards.
Yuri.

2013/5/3 Uros Bizjak ubiz...@gmail.com:
 Hello!

 Apparently, the wrong insn is used when adding insn dependencies. The
 last index gets updated to the found !NONDEBUG_INSN. Use first_arg
 that points to the right insn instead.

 2013-05-03  Uros Bizjak  ubiz...@gmail.com

 PR target/57106
 * config/i386/i386.c (add_parameter_dependencies): Add dependence
 between first_arg and insn, not last and insn.

 testsuite/ChangeLog:

 2013-05-03  Uros Bizjak  ubiz...@gmail.com

 * gcc.target/i386/pr57106.c: New test.

 Tested on x86_64-pc-linux-gnu {,-m32}. I will wait for Intel guys to
 check this patch with -fschedule-insns on their codes.

 Uros.


Re: C++/v3 PATCH to add/throw std::bad_array_new_length

2013-05-06 Thread Florian Weimer

On 05/03/2013 10:24 PM, Jason Merrill wrote:

Last year Florian fixed the compiler to detect overflow in array new
size calculations and pass (size_t)-1 in that case.  But C++11 specifies
that in case of overflow the program throws std::bad_array_new_length
(http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#624), so
I've adjusted the checking code accordingly.


Nice, this is simpler than expected.  However, it makes the call sites 
even more bloated.



This patch also adds the type to libsupc++, and several exports to
libstdc++.


There's also overflow checking inside __cxa_vec_new[23].  At this point, 
we don't know if the caller was compiled in C++11 mode.  But for C++03 
code, throwing a subclass of std::bad_alloc probably won't hurt.


I noticed you use throw() in the declaration of 
std::bad_array_new_length and _GLIBCXX_USE_NOEXCEPT in the definition, 
which seems rather odd.  I'm surprised that this even compiles.


--
Florian Weimer / Red Hat Product Security Team


[ping] Introduce #pragma GCC diagnostic off

2013-05-06 Thread Eric Botcazou
It's at http://gcc.gnu.org/ml/gcc-patches/2013-04/msg01149.html

Thanks in advance.

-- 
Eric Botcazou


Re: [PATCH, wwwdocs] Fix PR 50642

2013-05-06 Thread Shakthi Kannan
Hi,

I am re-submitting the patch to use html.css from the update_web_docs_svn 
script present in the maintainer-scripts folder. The smallexample attributes 
are defined to use a medium font size with a light blue background for 
readability and clarity.

2013-05-06 Shakthi Kannan skan...@redhat.com

PR wwwdocs/50642
* maintainer-scripts/update_web_docs_svn: Use --css-include with makeinfo.
* gcc/doc/include/html.css: New CSS file for HTML docs.

---
 gcc/doc/include/html.css   | 6 ++
 maintainer-scripts/update_web_docs_svn | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)
 create mode 100644 gcc/doc/include/html.css

diff --git a/gcc/doc/include/html.css b/gcc/doc/include/html.css
new file mode 100644
index 000..6cc0284
--- /dev/null
+++ b/gcc/doc/include/html.css
@@ -0,0 +1,6 @@
+pre.smallexample { 
+font-family: sans-serif; 
+font-size: medium; 
+padding: 4px; 
+background: #f2f2f9 
+}
\ No newline at end of file
diff --git a/maintainer-scripts/update_web_docs_svn 
b/maintainer-scripts/update_web_docs_svn
index cfc33c4..2cea078 100755
--- a/maintainer-scripts/update_web_docs_svn
+++ b/maintainer-scripts/update_web_docs_svn
@@ -36,6 +36,8 @@ WWWBASE=/www/gcc/htdocs
 WWWBASE_PREFORMATTED=/www/gcc/htdocs-preformatted
 WWWPREPROCESS='/www/gcc/bin/preprocess -r'
 
+HTMLCSS=gcc/doc/include/html.css
+
 # Process options -rrelease and -ddirectory
 RELEASE=
 SUBDIR=
@@ -164,7 +166,7 @@ for file in $MANUALS; do
 if [ $file = gnat_ugn_unw ]; then
   includes=$includes -I gcc/gcc/ada
 fi
-makeinfo --html $includes -o ${file} ${filename}
+makeinfo --css-include=../$HTMLCSS --html $includes -o ${file} ${filename}
 tar cf ${file}-html.tar ${file}/*.html
 texi2dvi $includes -o ${file}.dvi ${filename} /dev/null /dev/null  
dvips -o ${file}.ps ${file}.dvi
 texi2pdf $includes -o ${file}.pdf ${filename} /dev/null
-- 
1.7.11.7


Re: [RFA][PATCH] Fix tree-optimization/57124

2013-05-06 Thread Richard Biener
On Fri, May 3, 2013 at 10:46 PM, Jeff Law l...@redhat.com wrote:
 On 05/02/2013 01:55 AM, Richard Biener wrote:

 On Wed, May 1, 2013 at 10:26 PM, Jeff Law l...@redhat.com wrote:


 range_fits_type_p erroneously returns true in cases where the range has
 overflowed.  So for example, we might have a range [0, +INF(OVF)] and
 conclude the range fits in an unsigned type.

 This in turn can cause VRP to rewrite a conditional in an unsafe way as
 seen
 by the testcase.

 Bootstrapped and regression tested on x86_64-unknown-linux-gnu.

 OK for the trunk?


 Hmm, actually when [0, +INF(OVF)] appears then it says that the
 range is [0, +INF], but we relied on that no undefined overflow happened
 when computing it.

 So in fact the value must fit, otherwise the program invoked undefined
 behavior.

 Which means you should at most _warn_, not disable the transform.

 In fact the testcase is invalid:

x1 = *p1;
x2 = (int) x1;
x3 = x2 * 65536;

 performs 65531 * 65536 which overflows in type int.

 You probably should disable the transform with -fno-strict-overflow,
 that is, make sure the testcase works at -O1 -ftree-vrp for example.

 I'll check the inputs going into the code in 254.gap; the sequence in the
 testcase is effectively the computation that's going awry in 254.gap.

Thanks - it's not the first time that GCC hits undefined C code in SPEC CPU.
Generally we make sure that a workaround exists, like -fno-strict-overflow.

Richard.

 Jeff


Re: [PATCH] Fix thinko in SLSR that caused x86 bootstrap failure

2013-05-06 Thread Richard Biener
On Sun, May 5, 2013 at 10:45 PM, Bill Schmidt
wschm...@linux.vnet.ibm.com wrote:
 When creating a phi-adjustment along an incoming edge, where the related
 argument should use the hidden basis directly, I created a situation
 where we double-count the subsequent adjustment based on the candidate's
 index.  The candidate's index shouldn't be taken into account at all for
 the edge adjustment; it will be handled in relation to the created phi
 basis.  This patch fixes that thinko.

 I disabled processing of conditional candidates (and associated tests)
 on Friday night to allow x86 targets to bootstrap cleanly.  This patch
 also reinstates the disabled code.

 Bootstrapped and tested on powerpc-unknown-linux-gnu and
 i686-pc-linux-gnu with no new regressions.  Ok for trunk?

Ok.

Thanks,
Richard.

 Thanks,
 Bill



 gcc:

 2013-05-05  Bill Schmidt  wschm...@linux.vnet.ibm.com

 * gimple-ssa-strength-reduction.c (slsr_process_phi): Re-enable.
 (find_candidates_in_block): Re-enable slsr_process_phi.
 (create_phi_basis): Fix double counting of candidate adjustment.

 gcc/testsuite:

 2013-05-05  Bill Schmidt  wschm...@linux.vnet.ibm.com

 * gcc.dg/tree-ssa/slsr-32.c: Re-enable.
 * gcc.dg/tree-ssa/slsr-33.c: Likewise.
 * gcc.dg/tree-ssa/slsr-34.c: Likewise.
 * gcc.dg/tree-ssa/slsr-35.c: Likewise.
 * gcc.dg/tree-ssa/slsr-36.c: Likewise.
 * gcc.dg/tree-ssa/slsr-37.c: Likewise.
 * gcc.dg/tree-ssa/slsr-38.c: Likewise.


 Index: gcc/testsuite/gcc.dg/tree-ssa/slsr-32.c
 ===
 --- gcc/testsuite/gcc.dg/tree-ssa/slsr-32.c (revision 198611)
 +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-32.c (working copy)
 @@ -3,7 +3,6 @@

  /* { dg-do compile } */
  /* { dg-options -O3 -fdump-tree-optimized } */
 -/* { dg-skip-if  { *-*-* } } */

  int
  f (int s, int c, int i)
 Index: gcc/testsuite/gcc.dg/tree-ssa/slsr-33.c
 ===
 --- gcc/testsuite/gcc.dg/tree-ssa/slsr-33.c (revision 198611)
 +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-33.c (working copy)
 @@ -3,7 +3,6 @@

  /* { dg-do compile } */
  /* { dg-options -O3 -fdump-tree-optimized } */
 -/* { dg-skip-if  { *-*-* } } */

  int
  f (int c, int i)
 Index: gcc/testsuite/gcc.dg/tree-ssa/slsr-34.c
 ===
 --- gcc/testsuite/gcc.dg/tree-ssa/slsr-34.c (revision 198611)
 +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-34.c (working copy)
 @@ -3,7 +3,6 @@

  /* { dg-do compile } */
  /* { dg-options -O3 -fdump-tree-optimized } */
 -/* { dg-skip-if  { *-*-* } } */

  extern void
  g (void);
 Index: gcc/testsuite/gcc.dg/tree-ssa/slsr-35.c
 ===
 --- gcc/testsuite/gcc.dg/tree-ssa/slsr-35.c (revision 198611)
 +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-35.c (working copy)
 @@ -4,7 +4,6 @@

  /* { dg-do compile } */
  /* { dg-options -O3 -fdump-tree-optimized } */
 -/* { dg-skip-if  { *-*-* } } */

  int
  f (int c, int i)
 Index: gcc/testsuite/gcc.dg/tree-ssa/slsr-36.c
 ===
 --- gcc/testsuite/gcc.dg/tree-ssa/slsr-36.c (revision 198611)
 +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-36.c (working copy)
 @@ -4,7 +4,6 @@

  /* { dg-do compile } */
  /* { dg-options -O3 -fdump-tree-optimized } */
 -/* { dg-skip-if  { *-*-* } } */

  int
  f (int s, int c, int i)
 Index: gcc/testsuite/gcc.dg/tree-ssa/slsr-37.c
 ===
 --- gcc/testsuite/gcc.dg/tree-ssa/slsr-37.c (revision 198611)
 +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-37.c (working copy)
 @@ -4,7 +4,6 @@

  /* { dg-do compile } */
  /* { dg-options -O3 -fdump-tree-optimized } */
 -/* { dg-skip-if  { *-*-* } } */

  int
  f (int s, int c, int i)
 Index: gcc/testsuite/gcc.dg/tree-ssa/slsr-38.c
 ===
 --- gcc/testsuite/gcc.dg/tree-ssa/slsr-38.c (revision 198611)
 +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-38.c (working copy)
 @@ -4,7 +4,6 @@

  /* { dg-do compile } */
  /* { dg-options -O3 -fdump-tree-optimized } */
 -/* { dg-skip-if  { *-*-* } } */

  int
  f (int c, int i)
 Index: gcc/gimple-ssa-strength-reduction.c
 ===
 --- gcc/gimple-ssa-strength-reduction.c (revision 198611)
 +++ gcc/gimple-ssa-strength-reduction.c (working copy)
 @@ -657,9 +657,6 @@ add_cand_for_stmt (gimple gs, slsr_cand_t c)
*slot = c;
  }

 -// FORNOW: Disable conditional candidate processing until bootstrap
 -// issue can be sorted out for i686-pc-linux-gnu.
 -#if 0
  /* Given PHI which contains a phi statement, determine whether it
 satisfies all the requirements of a phi candidate.  If so, create
 a candidate.  Note that a CAND_PHI never has a basis itself, but
 

[C++] Missing save_expr in vector-scalar ops

2013-05-06 Thread Marc Glisse

Hello,

this patch is extracted from
http://gcc.gnu.org/ml/gcc-patches/2013-04/msg00783.html

When I copied this code from the C front-end and removed c_fully_fold, I 
apparently also removed the save_expr, so I am putting it back in. I added 
it after convert while the C front-end has it before convert, I can put it 
before if you prefer.


Bootstrap+testsuite on x86_64-linux-gnu.
(I believe it should also be backported to 4.8)

2013-05-06  Marc Glisse  marc.gli...@inria.fr

gcc/cp/
* typeck.c (cp_build_binary_op): Call save_expr before
build_vector_from_val.

gcc/testsuite/
* c-c++-common/vector-scalar-2.c: New testcase.

--
Marc GlisseIndex: gcc/testsuite/c-c++-common/vector-scalar-2.c
===
--- gcc/testsuite/c-c++-common/vector-scalar-2.c(revision 0)
+++ gcc/testsuite/c-c++-common/vector-scalar-2.c(revision 0)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options -fdump-tree-gimple } */
+
+typedef int veci __attribute__ ((vector_size (4 * sizeof (int;
+
+int c;
+
+void f (veci *a)
+{
+  *a = *a + ++c;
+}
+
+/* { dg-final { scan-tree-dump-times  \\\+ 1 1 gimple } } */
+/* { dg-final { cleanup-tree-dump gimple } } */

Property changes on: gcc/testsuite/c-c++-common/vector-scalar-2.c
___
Added: svn:keywords
   + Author Date Id Revision URL
Added: svn:eol-style
   + native

Index: gcc/cp/typeck.c
===
--- gcc/cp/typeck.c (revision 198624)
+++ gcc/cp/typeck.c (working copy)
@@ -3966,29 +3966,31 @@ cp_build_binary_op (location_t location,
   enum stv_conv convert_flag = scalar_to_vector (location, code, op0, op1,
 complain  tf_error);
 
   switch (convert_flag)
 {
   case stv_error:
 return error_mark_node;
   case stv_firstarg:
 {
   op0 = convert (TREE_TYPE (type1), op0);
+ op0 = save_expr (op0);
   op0 = build_vector_from_val (type1, op0);
   type0 = TREE_TYPE (op0);
   code0 = TREE_CODE (type0);
   converted = 1;
   break;
 }
   case stv_secondarg:
 {
   op1 = convert (TREE_TYPE (type0), op1);
+ op1 = save_expr (op1);
   op1 = build_vector_from_val (type0, op1);
   type1 = TREE_TYPE (op1);
   code1 = TREE_CODE (type1);
   converted = 1;
   break;
 }
   default:
 break;
 }
 }


[Patch: RL78] Fix interrupt handling for G10 target

2013-05-06 Thread Vinay Kumar. G
Hi, 

This patch fixes G10 target support for interrupt functions in the recently 
submitted patch, Improve interrupt function generation
http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00011.html

The G10 target does not support the sel rbn insn as it has only bank 0.
Conditions have been added to check for this.

Tested with rl78-elf target simulator.

Regards,
Vinay Kumar
vina...@kpitcummins.com

gcc/ChangeLog
2013-05-06  Vinay Kumar vina...@kpitcummins.com

* config/rl78/rl78.c (rl78_expand_prologue): G10 target
  support added.
(rl78_expand_epilogue): G10 target support added.
 

--- rl78.c.org  2013-05-06 12:25:05.0 +0530
+++ rl78.c  2013-05-06 12:51:29.0 +0530
@@ -1020,7 +1020,7 @@ rl78_expand_prologue (void)
   if (rl78_is_naked_func ())
   return;
 
-  rb = is_interrupt_func (cfun-decl) ? -1 : 0;
+  rb = (is_interrupt_func (cfun-decl)  !TARGET_G10)? -1 : 0;
   if (!cfun-machine-computed)
 rl78_compute_frame_info ();
 
@@ -1049,7 +1049,7 @@ rl78_expand_prologue (void)
   }
 
   /* Interrupt functions use rb3 instead of rb0.  */
-  if (is_interrupt_func (cfun-decl))
+  if (is_interrupt_func (cfun-decl)  !TARGET_G10)
 {
   if (rb != 3)
emit_insn (gen_sel_rb (GEN_INT (3)));
@@ -1089,7 +1089,7 @@ rl78_expand_epilogue (void)
   if (rl78_is_naked_func ())
 return;
 
-  rb = is_interrupt_func (cfun-decl) ? 3 : 0;
+  rb = (is_interrupt_func (cfun-decl)  !TARGET_G10) ? 3 : 0;
 
   if (frame_pointer_needed)
 {




Re: C++/v3 PATCH to add/throw std::bad_array_new_length

2013-05-06 Thread Jason Merrill

On 05/06/2013 05:46 AM, Florian Weimer wrote:

Nice, this is simpler than expected.  However, it makes the call sites
even more bloated.


Hmm, perhaps the checking should be wrapped in an inline function, so 
that the inliner can decide whether or not to expand it at the call site...



This patch also adds the type to libsupc++, and several exports to
libstdc++.


There's also overflow checking inside __cxa_vec_new[23].  At this point,
we don't know if the caller was compiled in C++11 mode.  But for C++03
code, throwing a subclass of std::bad_alloc probably won't hurt.


And we never use __cxa_vec_new* anyway, they're only there because the 
ABI requires them.



I noticed you use throw() in the declaration of
std::bad_array_new_length and _GLIBCXX_USE_NOEXCEPT in the definition,
which seems rather odd.  I'm surprised that this even compiles.


15.4 [except.spec]/3:

Two exception-specifications are compatible if:
— both are non-throwing (see below), regardless of their form
...

Jason



Re: C++/v3 PATCH to add/throw std::bad_array_new_length

2013-05-06 Thread Florian Weimer

On 05/06/2013 02:39 PM, Jason Merrill wrote:

On 05/06/2013 05:46 AM, Florian Weimer wrote:

Nice, this is simpler than expected.  However, it makes the call sites
even more bloated.


Hmm, perhaps the checking should be wrapped in an inline function, so
that the inliner can decide whether or not to expand it at the call site...


Or we could call __cxa_vec_new[23] and rely on the check there (in most 
cases—for new T[a][b], we'd still need a separate overflow check).



This patch also adds the type to libsupc++, and several exports to
libstdc++.


There's also overflow checking inside __cxa_vec_new[23].  At this point,
we don't know if the caller was compiled in C++11 mode.  But for C++03
code, throwing a subclass of std::bad_alloc probably won't hurt.


And we never use __cxa_vec_new* anyway, they're only there because the
ABI requires them.


EDG-derived compilers will call it, so we should fix it as well.


I noticed you use throw() in the declaration of
std::bad_array_new_length and _GLIBCXX_USE_NOEXCEPT in the definition,
which seems rather odd.  I'm surprised that this even compiles.


15.4 [except.spec]/3:

Two exception-specifications are compatible if:
— both are non-throwing (see below), regardless of their form
...


Thanks, I suspected as much.

--
Florian Weimer / Red Hat Product Security Team


[C++ Patch] PR 57183

2013-05-06 Thread Paolo Carlini

Hi,

the issue is that we -Wunused-variable warn for:

const auto PI_3 = 3.1415926F;

The reason is that TREE_READONLY is not set (d instead r in the .o). 
In turn, that's because the first and only time 
cp_apply_type_quals_to_decl is called, at the end of grokdeclarator, 
nothing happens because the type is not complete yet. It seems to me 
that we have to handle this case similarly to templates, thus call again 
cp_apply_type_quals_to_decl after do_auto_deduction.


The below passes testing on x86_64-linux. Ok for mainline and branch?

Thanks,
Paolo.

/
/cp
2013-05-06  Paolo Carlini  paolo.carl...@oracle.com

PR c++/57183
* decl.c (cp_finish_decl): After do_auto_deduction copy the
qualifers with cp_apply_type_quals_to_decl.

/testsuite
2013-05-06  Paolo Carlini  paolo.carl...@oracle.com

PR c++/57183
* g++.dg/cpp0x/auto38.C: New.
Index: cp/decl.c
===
--- cp/decl.c   (revision 198625)
+++ cp/decl.c   (working copy)
@@ -6147,6 +6147,7 @@ cp_finish_decl (tree decl, tree init, bool init_co
   auto_node);
   if (type == error_mark_node)
return;
+  cp_apply_type_quals_to_decl (cp_type_quals (type), decl);
 }
 
   if (!ensure_literal_type_for_constexpr_object (decl))
Index: testsuite/g++.dg/cpp0x/auto38.C
===
--- testsuite/g++.dg/cpp0x/auto38.C (revision 0)
+++ testsuite/g++.dg/cpp0x/auto38.C (working copy)
@@ -0,0 +1,8 @@
+// PR c++/57183
+// { dg-do compile { target c++11 } }
+// { dg-options -Wunused-variable }
+
+constexpr float PI_0 = 3.1415926F;
+constexpr auto PI_1 = 3.1415926F;
+const float PI_2 = 3.1415926F;
+const auto PI_3 = 3.1415926F;


Re: [PATCH] Use indentation in gtype.state to show nested structure

2013-05-06 Thread David Malcolm
On Mon, 2013-05-06 at 07:56 +0300, Laurynas Biveinis wrote:
[...snip...]

 The patch is OK with some minor formatting errors fixed:

[...snip...]

Thanks for reviewing this.  BTW, is there an automated tool for checking
for formatting issues like this in patches?  (contrib/check_GNU_style.sh
didn't complain about these.

I'm attaching a patch which (I believe) fixes the formatting errors,
along with fixing a comment that check_GNU_style.sh complained about
(and updating the date in the ChangeLog, fwiw).

BTW, I'm a new contributor to GCC and I don't have commit rights to SVN.
[I believe the copyright assignment requirements are covered by an
agreement the FSF has with my employer (Red Hat)].

Thanks again
Dave

commit 528a1c122c049d0d0ea12d819b63c59310edc7f2
Author: David Malcolm dmalc...@redhat.com
Date:   Fri May 3 18:22:38 2013 -0400

Use indentation when generating gtype.state to show nested structure

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cafda6e..c5631b4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,43 @@
+2013-05-06  David Malcolm  dmalc...@redhat.com
+
+	* gengtype-state.c: (indent_amount): New variable,
+	(had_recent_newline): likewise
+	(write_new_line): New function
+	(write_any_indent): likewise
+	(write_open_paren): likewise
+	(write_close_paren): likewise
+	(write_state_fileloc): Use the new functions above to write
+	indentation into the gtype.state output file to visually represent
+	the hierarchical structure of the list structures
+	(write_state_fields): ditto
+	(write_state_a_string): ditto
+	(write_state_string_option): ditto
+	(write_state_type_option): ditto
+	(write_state_nested_option): ditto
+	(write_state_option): ditto
+	(write_state_options): ditto
+	(write_state_lang_bitmap): ditto
+	(write_state_version): ditto
+	(write_state_scalar_type): ditto
+	(write_state_string_type): ditto
+	(write_state_undefined_type): ditto
+	(write_state_struct_union_type): ditto
+	(write_state_user_struct_type): ditto
+	(write_state_lang_struct_type): ditto
+	(write_state_param_struct_type): ditto
+	(write_state_pointer_type): ditto
+	(write_state_array_type): ditto
+	(write_state_gc_used): ditto
+	(write_state_type): ditto
+	(write_state_pair): ditto
+	(write_state_typedefs): ditto
+	(write_state_structures): ditto
+	(write_state_param_structs): ditto
+	(write_state_variables): ditto
+	(write_state_variables): ditto
+	(write_state_files_list): ditto
+	(write_state_languages): ditto
+
 2013-05-02  David Malcolm  dmalc...@redhat.com
 
 	* testsuite/gcc.dg/plugin/one_time_plugin.c (one_pass_gate): example
diff --git a/gcc/gengtype-state.c b/gcc/gengtype-state.c
index 6092dad..33149d1 100644
--- a/gcc/gengtype-state.c
+++ b/gcc/gengtype-state.c
@@ -141,6 +141,57 @@ static long state_bol = 0;	/* offset of beginning of line */
 /* Counter of written types.  */
 static int state_written_type_count = 0;
 
+static int indent_amount = 0;
+static int had_recent_newline = 0;
+
+static void
+write_new_line (void)
+{
+  /* Don't add a newline if we've just had one.  */
+  if (!had_recent_newline)
+{
+  fprintf (state_file, \n);
+  had_recent_newline = 1;
+}
+}
+
+/*
+  If we've just had a newline, write the indentation amount,
+  potentially modified.
+
+  The modifier exists to support code that writes strings with leading
+  space (e.g  foo) which might occur within a line, or could be the first
+  thing on a line.  By passing a modifier of -1, when such a string is the
+  first thing on a line, the modifier swallows the leading space into the
+  indentation, and all the fields line up correctly.
+*/
+static void
+write_any_indent (int modifier)
+{
+  int i;
+  if (had_recent_newline)
+for (i = 0; i  indent_amount + modifier; i++)
+  fprintf (state_file,  );
+  had_recent_newline = 0;
+}
+
+static void
+write_open_paren (const char *tag)
+{
+  write_new_line ();
+  write_any_indent (0);
+  fprintf (state_file, (!%s , tag);
+  indent_amount++;
+}
+
+static void
+write_close_paren (void)
+{
+  indent_amount--;
+  write_any_indent (0);
+  fprintf (state_file, ));
+  write_new_line ();
+}
 
 /* Fatal error messages when reading the state.  They are extremely
unlikely, and only appear when this gengtype-state.c file is buggy,
@@ -565,16 +616,16 @@ write_state_fileloc (struct fileloc *floc)
   srcrelpath = get_file_srcdir_relative_path (floc-file);
   if (srcrelpath != NULL)
 	{
-	  fprintf (state_file, \n(!srcfileloc );
+	  write_open_paren (srcfileloc);
 	  write_state_a_string (srcrelpath);
 	}
   else
 	{
-	  fprintf (state_file, \n(!fileloc );
+	  write_open_paren (fileloc);
 	  write_state_a_string (get_input_file_name (floc-file));
 	}
   fprintf (state_file,  %d, floc-line);
-  fprintf (state_file, )\n);
+  write_close_paren (); /* (!srcfileloc or (!fileloc */
 }
   else
 fprintf (state_file, nil );
@@ -586,10 +637,11 @@ write_state_fields (pair_p fields)
 {
   int nbfields = pair_list_length (fields);
   int nbpairs = 

Re: [PATCH] Fix array sizes created by Java FE (PR libgcj/57074)

2013-05-06 Thread Tom Tromey
 Jakub == Jakub Jelinek ja...@redhat.com writes:

Jakub 2013-05-04  Jakub Jelinek  ja...@redhat.com
Jakub  PR libgcj/57074
Jakub  * class.c (emit_symbol_table): Use array type of the
Jakub  right size for the_syms_decl and its DECL_INITIAL, instead
Jakub  of symbols_array_type.  Set TREE_TYPE (the_syms_decl) to it.
Jakub  (emit_assertion_table): Use array type of the right size
Jakub  for table_decl and its DECL_INITIAL.

This is fine with me if it works.
The current code was always cheating here.

Tom


[gomp4] #pragma omp declare simd (aka OpenMP elemental functions) parsing

2013-05-06 Thread Jakub Jelinek
On Tue, Apr 30, 2013 at 10:35:21AM -0400, Jason Merrill wrote:
 On 04/29/2013 02:32 PM, Jakub Jelinek wrote:
 Should I copy the parser-omp_declare_simd_clauses vector pointer
 say into cp_declarator structure so that grokfndecl could grab it from
 there?
 
 That sounds good.
 
 Also, for the attributes I wonder if it wouldn't be better to
 finally replace the PARM_DECLs in the clauses say with parameter indexes,
 because otherwise it might be difficult to adjust those during instantiation
 etc.
 
 Yes, that will probably be easier to deal with.

Ok, here is a complete patch for C++ FE only support of the #pragma omp
declare simd parsing.

The info is stored as omp declare simd attribute with an argument
which is either NULL_TREE (barebone #pragma omp declare simd) or
list of OMP_CLAUSEs).  Tested on x86_64-linux, any comments on this
before I commit it to the gomp4 branch?  Like, isn't it too invasive to the
C++ FE?

2013-05-06  Jakub Jelinek  ja...@redhat.com

* tree.c (omp_declare_simd_clauses_equal): New function.
(attribute_value_equal): Call it for -fopenmp if
TREE_VALUE of the attributes are both OMP_CLAUSEs.
* tree.h (omp_declare_simd_clauses_equal): Declare.
c-family/
* c-common.c (c_common_attribute_table): Add omp declare simd
attribute.
(handle_omp_declare_simd_attribute): New function.
* c-common.h (c_omp_declare_simd_clauses_to_numbers,
c_omp_declare_simd_clauses_to_decls): Declare.
* c-omp.c (c_omp_declare_simd_clause_cmp,
c_omp_declare_simd_clauses_to_numbers,
c_omp_declare_simd_clauses_to_decls): New functions.
cp/
* cp-tree.h (start_decl, start_function, grokmethod, grokfield): Add
omp_declare_simd_clauses argument.
(finish_omp_declare_simd): Declare.
* decl2.c (grokfield): Add omp_declare_simd_clauses argument,
pass it through to grokdeclarator.
(grokbitfield): Adjust grokdeclarator caller.
(is_late_template_attribute): Return true for omp declare simd
attribute.
(cp_check_const_attributes): Don't check TREE_VALUE of arg if
arg isn't a TREE_LIST.
* decl.c (shadow_tag, groktypename): Adjust grokdeclarator callers.
(start_decl, start_function, grokmethod): Add omp_declare_simd_clauses
argument, pass it through to grokdeclarator.
(grokfndecl): Add omp_declare_simd_clauses argument, call
finish_omp_declare_simd if non-NULL.
(grokdeclarator): Add omp_declare_simd_clauses argument, pass it
through to grokfndecl.
* decl.h (grokdeclarator): Add omp_declare_simd_clauses argument.
* pt.c (apply_late_template_attributes): Handle omp declare simd
attribute specially.
(tsubst_omp_clauses): Add declare_simd argument, don't call
finish_omp_clauses if it is set.  Handle OpenMP 4.0 clauses.
(tsubst_expr): Adjust tsubst_omp_clauses callers.
* semantics.c (finish_omp_clauses): Diagnose inbranch notinbranch.
(finish_omp_declare_simd): New function.
* parser.h (struct cp_parser): Add omp_declare_simd_clauses field.
* parser.c (cp_ensure_no_omp_declare_simd,
cp_finish_omp_declare_simd): New functions.
(enum pragma_context): Add pragma_member and pragma_objc_icode.
(cp_parser_trait_expr, cp_parser_conversion_type_id,
cp_parser_template_parameter, cp_parser_explicit_instantiation,
cp_parser_enum_specifier, cp_parser_parameter_declaration_list,
cp_parser_exception_declaration, cp_parser_sizeof_operand,
cp_parser_objc_method_tail_params_opt,
cp_parser_objc_try_catch_finally_statement): Adjust grokdeclarator
callers.
(cp_parser_lambda_declarator_opt): Adjust grokmethod caller.
(cp_parser_condition): Adjust start_decl caller.
(cp_parser_linkage_specification, cp_parser_namespace_definition,
cp_parser_class_specifier_1): Call cp_ensure_no_omp_declare_simd.
(cp_parser_alias_declaration): Adjust grokfield and start_decl
callers.
(cp_parser_init_declarator, cp_parser_member_declaration,
cp_parser_function_definition_from_specifiers_and_declarator,
cp_parser_save_member_function_body): Call
cp_finish_omp_declare_simd, pass parser-omp_declare_simd_clauses
to start_decl, grokfield, start_function or grokmethod.
(cp_parser_member_specification_opt): Pass pragma_member instead
of pragma_external to cp_parser_pragma.
(cp_parser_objc_interstitial_code): Pass pragma_objc_icode instead
of pragma_external to cp_parser_pragma.
(cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration): Adjust
grokfield caller.
(cp_parser_omp_var_list_no_open): If parser-omp_declare_simd_clauses,
just cp_parser_identifier the argument names.
(cp_parser_omp_all_clauses): Don't call finish_omp_clauses for
  

[PATCH] Fix PR57185

2013-05-06 Thread Richard Biener

This fixes an anonymous SSA name issue.

Bootstrapped and tested on x86_64-unknonw-linux-gnu, applied.

Richard.

2013-05-06  Richard Biener  rguent...@suse.de

PR tree-optimization/57185
* tree-parloops.c (add_field_for_reduction): Handle anonymous
SSA names properly.

* gcc.dg/autopar/pr57185.c: New testcase.

Index: gcc/tree-parloops.c
===
*** gcc/tree-parloops.c (revision 198625)
--- gcc/tree-parloops.c (working copy)
*** add_field_for_reduction (reduction_info
*** 964,972 
  {
  
struct reduction_info *const red = *slot;
!   tree var = SSA_NAME_VAR (gimple_assign_lhs (red-reduc_stmt));
!   tree field = build_decl (gimple_location (red-reduc_stmt),
!  FIELD_DECL, DECL_NAME (var), TREE_TYPE (var));
  
insert_field_into_struct (type, field);
  
--- 964,972 
  {
  
struct reduction_info *const red = *slot;
!   tree var = gimple_assign_lhs (red-reduc_stmt);
!   tree field = build_decl (gimple_location (red-reduc_stmt), FIELD_DECL,
!  SSA_NAME_IDENTIFIER (var), TREE_TYPE (var));
  
insert_field_into_struct (type, field);
  
Index: gcc/testsuite/gcc.dg/autopar/pr57185.c
===
*** gcc/testsuite/gcc.dg/autopar/pr57185.c  (revision 0)
--- gcc/testsuite/gcc.dg/autopar/pr57185.c  (working copy)
***
*** 0 
--- 1,29 
+ /* { dg-do compile } */
+ /* { dg-options -O3 -ftree-parallelize-loops=2 -fipa-pta } */
+ 
+ int a, b;
+ int *d;
+ void f(void)
+ {
+   int c;
+   b %= 1;
+ 
+   if(1 - (b  1))
+ {
+   int *q = 0;
+ 
+   if(a)
+   {
+ c = 0;
+ lbl:
+ for(*d; *d; ++*d)
+   if(c ? : a ? : (c = 1) ? : 0)
+ *q = 1;
+ return;
+   }
+ 
+   q = (int *)1;
+ }
+   goto lbl;
+ }
+ 


Re: [PATCH] Fix PR bootstrap/57154 (issue9179043)

2013-05-06 Thread Jeff Law

On 05/03/2013 04:46 PM, Teresa Johnson wrote:

On Fri, May 3, 2013 at 12:48 PM, Teresa Johnson tejohn...@google.com wrote:

Yes it will ICE on failure. What is the guideline on c.torture vs gcc.dg?

I don't think there's any general guidelines.

c-torture was an older framework that was considerably less expressive 
in terms of control of flags, testing for specific messages, etc.  But 
c-torture had the advantage that it iterates through a (predefined) list 
of options, testing each one individually while gcc.dg ran each test a 
single time.


A many years ago parts of the older c-torture framework were revamped to 
utilize the gcc.dg framework *but* they kept the ability to run the 
tests with a variety of options.


Based on my experience I tend to prefer the torture framework as it 
gives coverage across a wider variety of options and that's proven 
useful through the years.  For this particular test the increase in 
coverage is marginal, hence my comment No objection to it being in 
gcc.dg though.


jeff



Re: [PATCH] Fix latent bug in RTL GCSE/PRE (PR57159)

2013-05-06 Thread Jeff Law

On 05/05/2013 04:18 AM, Steven Bosscher wrote:

On Fri, May 3, 2013 at 3:10 PM, Julian Brown wrote:

 gcc/
 * gcse.c (compute_ld_motion_mems): Invalidate non-simple mem refs
 in REG_EQUAL notes.


Makes sense to me. Looking at REG_EQUAL notes in hash_scan_set is
something relatively new. Your patch fixes something we appear to have
overlooked.
I'd still like to see the before/after dumps.  While I think the patch 
is reasonable as well, those dumps should make it clearer to anyone 
looking at this in the future what was going on -- particularly 
important since we don't have an in-tree port which exhibits this problem.


Jeff


Re: [PATCH] Fix PR bootstrap/57154 (issue9179043)

2013-05-06 Thread Jakub Jelinek
On Mon, May 06, 2013 at 09:24:28AM -0600, Jeff Law wrote:
 On 05/03/2013 04:46 PM, Teresa Johnson wrote:
 On Fri, May 3, 2013 at 12:48 PM, Teresa Johnson tejohn...@google.com wrote:
 Yes it will ICE on failure. What is the guideline on c.torture vs gcc.dg?
 I don't think there's any general guidelines.
 
 c-torture was an older framework that was considerably less
 expressive in terms of control of flags, testing for specific
 messages, etc.  But c-torture had the advantage that it iterates
 through a (predefined) list of options, testing each one
 individually while gcc.dg ran each test a single time.
 
 A many years ago parts of the older c-torture framework were
 revamped to utilize the gcc.dg framework *but* they kept the ability
 to run the tests with a variety of options.
 
 Based on my experience I tend to prefer the torture framework as it
 gives coverage across a wider variety of options and that's proven
 useful through the years.  For this particular test the increase in
 coverage is marginal, hence my comment No objection to it being in
 gcc.dg though.

Note that there is also gcc.dg/torture/ which also runs multiple options.

Jakub


[PATCH] Use anonymous SSA name support in SLSR

2013-05-06 Thread Bill Schmidt
This removes lazy_create_slsr_reg and replaces uses of make_ssa_name
with make_temp_ssa_name, removing the need for a bunch of unnecessary
vars.

Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
regressions.  Ok for trunk?

Thanks,
Bill


2013-05-06  Bill Schmidt  wschm...@linux.vnet.ibm.com

* gimple-ssa-strength-reduction.c (lazy_create_slsr_reg): Remove.
(replace_mult_candidate): Remove unnecessary argument; remove
unnecessary parameter from call to introduce_cast_before_cand.
(replace_unconditional_candidate): Remove unnecessary parameter
from call to replace_mult_candidate.
(replace_conditional_candidate): Likewise.
(insert_initializers): Use make_temp_ssa_name.
(introduce_cast_before_cand): Remove unnecessary argument; use
make_temp_ssa_name.
(replace_one_candidate): Remove unnecessary argument; remove
unnecessary parameter from calls to introduce_cast_before_cand.
(replace_profitable_candidates): Remove unnecessary parameters
from calls to replace_one_candidate.


Index: gcc/gimple-ssa-strength-reduction.c
===
--- gcc/gimple-ssa-strength-reduction.c (revision 198627)
+++ gcc/gimple-ssa-strength-reduction.c (working copy)
@@ -376,7 +376,7 @@ static bool address_arithmetic_p;
 
 /* Forward function declarations.  */
 static slsr_cand_t base_cand_from_table (tree);
-static tree introduce_cast_before_cand (slsr_cand_t, tree, tree, tree*);
+static tree introduce_cast_before_cand (slsr_cand_t, tree, tree);
 
 /* Produce a pointer to the IDX'th candidate in the candidate vector.  */
 
@@ -1818,16 +1818,6 @@ cand_abs_increment (slsr_cand_t c)
   return increment;
 }
 
-/* If *VAR is NULL or is not of a compatible type with TYPE, create a
-   new temporary reg of type TYPE and store it in *VAR.  */
-
-static inline void
-lazy_create_slsr_reg (tree *var, tree type)
-{
-  if (!*var || !types_compatible_p (TREE_TYPE (*var), type))
-*var = create_tmp_reg (type, slsr);
-}
-
 /* Return TRUE iff candidate C has already been replaced under
another interpretation.  */
 
@@ -1841,8 +1831,7 @@ cand_already_replaced (slsr_cand_t c)
replace_conditional_candidate.  */
 
 static void
-replace_mult_candidate (slsr_cand_t c, tree basis_name, double_int bump,
-   tree *var)
+replace_mult_candidate (slsr_cand_t c, tree basis_name, double_int bump)
 {
   tree target_type = TREE_TYPE (gimple_assign_lhs (c-cand_stmt));
   enum tree_code cand_code = gimple_assign_rhs_code (c-cand_stmt);
@@ -1869,8 +1858,7 @@ static void
   /* If the basis name and the candidate's LHS have incompatible
 types, introduce a cast.  */
   if (!useless_type_conversion_p (target_type, TREE_TYPE (basis_name)))
-   basis_name = introduce_cast_before_cand (c, target_type,
-basis_name, var);
+   basis_name = introduce_cast_before_cand (c, target_type, basis_name);
   if (bump.is_negative ())
{
  code = MINUS_EXPR;
@@ -1945,7 +1933,6 @@ replace_unconditional_candidate (slsr_cand_t c)
 {
   slsr_cand_t basis;
   double_int stride, bump;
-  tree var = NULL;
 
   if (cand_already_replaced (c))
 return;
@@ -1954,7 +1941,7 @@ replace_unconditional_candidate (slsr_cand_t c)
   stride = tree_to_double_int (c-stride);
   bump = cand_increment (c) * stride;
 
-  replace_mult_candidate (c, gimple_assign_lhs (basis-cand_stmt), bump, var);
+  replace_mult_candidate (c, gimple_assign_lhs (basis-cand_stmt), bump);
 }
 
 /* Return the index in the increment vector of the given INCREMENT.  */
@@ -2150,7 +2137,7 @@ create_phi_basis (slsr_cand_t c, gimple from_phi,
 static void
 replace_conditional_candidate (slsr_cand_t c)
 {
-  tree basis_name, name, var = NULL;
+  tree basis_name, name;
   slsr_cand_t basis;
   location_t loc;
   double_int stride, bump;
@@ -2169,7 +2156,7 @@ replace_conditional_candidate (slsr_cand_t c)
   stride = tree_to_double_int (c-stride);
   bump = c-index * stride;
 
-  replace_mult_candidate (c, name, bump, var);
+  replace_mult_candidate (c, name, bump);
 }
 
 /* Compute the expected costs of inserting basis adjustments for
@@ -2925,7 +2912,6 @@ static void
 insert_initializers (slsr_cand_t c)
 {
   unsigned i;
-  tree new_var = NULL_TREE;
 
   for (i = 0; i  incr_vec_len; i++)
 {
@@ -2963,8 +2949,7 @@ insert_initializers (slsr_cand_t c)
 
   /* Create a new SSA name to hold the initializer's value.  */
   stride_type = TREE_TYPE (c-stride);
-  lazy_create_slsr_reg (new_var, stride_type);
-  new_name = make_ssa_name (new_var, NULL);
+  new_name = make_temp_ssa_name (stride_type, NULL, slsr);
   incr_vec[i].initializer = new_name;
 
   /* Create the initializer and insert it in the latest possible
@@ -3062,15 +3047,13 @@ all_phi_incrs_profitable (slsr_cand_t c, gimple ph
the new SSA name.  */
 
 

Re: C++/v3 PATCH to add/throw std::bad_array_new_length

2013-05-06 Thread Jason Merrill

On 05/06/2013 08:46 AM, Florian Weimer wrote:

On 05/06/2013 02:39 PM, Jason Merrill wrote:

On 05/06/2013 05:46 AM, Florian Weimer wrote:

Nice, this is simpler than expected.  However, it makes the call sites
even more bloated.


Hmm, perhaps the checking should be wrapped in an inline function, so
that the inliner can decide whether or not to expand it at the call
site...


Or we could call __cxa_vec_new[23] and rely on the check there


True.  The problem with using those is the indirect calls to the 
(possibly inline) constructors, though it might be worth doing 
conditionally.  Would you be interested in working on that change?



(in most
cases—for new T[a][b], we'd still need a separate overflow check).


But new T[a][b] is ill-formed, so we don't need to handle that case.


This patch also adds the type to libsupc++, and several exports to
libstdc++.


There's also overflow checking inside __cxa_vec_new[23].  At this point,
we don't know if the caller was compiled in C++11 mode.  But for C++03
code, throwing a subclass of std::bad_alloc probably won't hurt.


And we never use __cxa_vec_new* anyway, they're only there because the
ABI requires them.


EDG-derived compilers will call it, so we should fix it as well.


Right.

Jason



Re: PATCH: contrib/repro_fail: filter out -ignore SIGHUP from spawn line

2013-05-06 Thread David Malcolm
On Thu, 2013-04-25 at 14:10 -0400, David Malcolm wrote:
 On Thu, 2013-04-25 at 13:43 -0400, Diego Novillo wrote:
  On 2013-04-25 12:30 , David Malcolm wrote:
  
   diff --git a/contrib/ChangeLog b/contrib/ChangeLog
   index 9f4505b..01afcb5 100644
   --- a/contrib/ChangeLog
   +++ b/contrib/ChangeLog
   @@ -1,3 +1,7 @@
   +2013-04-25  David Malcolm  dmalc...@redhat.com
   +
   +* repro_fail: filter out -ignore SIGHUP from the spawn lines
   +
  
  This is OK, thanks.  It works with the regular spawn lines too, right?  
  (looks like it should).
 
 All of the spawn lines in my.log files have the -ignore SIGHUP, so I
 hand-edited some to remove that part, and it does indeed work on such
 lines.

BTW, I don't have commit rights to GCC (am reattaching the patch for
convenience)

[I believe the copyright assignment requirements are covered by an
agreement the FSF has with my employer (Red Hat)]

FWIW the -ignore SIGHUP I ran into appears to come from a patch
applied downstream in Fedora packages of DejaGnu [1], but which appears
to be effectively the same as one that's in DejaGnu git (albeit not yet
within a released tarball):
http://git.savannah.gnu.org/gitweb/?p=dejagnu.git;a=commitdiff;h=50a378f626fcdbaf30202a36bf73738de08a53bf

2011-03-15  H.J. Lu  hjl.to...@gmail.com

* lib/remote.exp (local_exec): Ignore SIGHUP.

so if I'm reading this right, any attempt to run repro_fail by someone
using a git build of dejagnu needs the patch.

Hope this is helpful
Dave

[1]
http://pkgs.fedoraproject.org/cgit/dejagnu.git/diff/dejagnu-1.5-smp-1.patch?h=f17id=0c9228fc0093b3de82defbd8de02a65d4ae5f526

commit 86cdd0c0c76cbe0feb169de7ba0c48c5bc13b845
Author: David Malcolm dmalc...@redhat.com
Date:   Tue Apr 30 17:17:05 2013 -0400

repro_fail: filter out -ignore SIGHUP from the spawn lines

2013-04-25  David Malcolm  dmalc...@redhat.com

	* repro_fail: filter out -ignore SIGHUP from the spawn lines

diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 48db27b..6cc7e82 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2013-04-25  David Malcolm  dmalc...@redhat.com
+
+	* repro_fail: filter out -ignore SIGHUP from the spawn lines
+
 2013-04-22  Sofiane Naci  sofiane.n...@arm.com
 
 	* config-list.mk (LIST): Add aarch64-elf and aarch64-linux-gnu.
diff --git a/contrib/repro_fail b/contrib/repro_fail
index b28a712..9ea79f2 100755
--- a/contrib/repro_fail
+++ b/contrib/repro_fail
@@ -4,7 +4,7 @@
 #
 # Contributed by Diego Novillo dnovi...@google.com
 #
-# Copyright (C) 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -56,7 +56,9 @@ logf=$2
 shift 2
 
 # Find the commands in LOGF that reference PATTERN.
-lines=$(grep -E ^spawn .*$pattern $logf | sed -e 's/^spawn //')
+lines=$(grep -E ^spawn .*$pattern $logf \
+| sed -e 's/^spawn -ignore SIGHUP //' \
+| sed -e 's/^spawn //')
 if [ -z $lines ] ; then
 echo Could not find a spawn command for pattern $pattern
 exit 1


Re: [gomp4] #pragma omp declare simd (aka OpenMP elemental functions) parsing

2013-05-06 Thread Jason Merrill

On 05/06/2013 11:04 AM, Jakub Jelinek wrote:

isn't it too invasive to the C++ FE?


It is pretty invasive.  Why not put the information in cp_declarator, as 
you suggested in your earlier email?  You could even put it in the 
attributes field.


Jason



Re: [C++ Patch] PR 57183

2013-05-06 Thread Jason Merrill

OK.

Jason


Re: [C++] Missing save_expr in vector-scalar ops

2013-05-06 Thread Jason Merrill

On 05/06/2013 07:46 AM, Marc Glisse wrote:

I added it after convert while the C front-end has it before convert, I
can put it before if you prefer.


Let's be consistent.

OK for trunk and 4.8.

Jason



Re: [PATCH] Fix latent bug in RTL GCSE/PRE (PR57159)

2013-05-06 Thread Steven Bosscher
On Mon, May 6, 2013 at 5:28 PM, Jeff Law wrote:
 On 05/05/2013 04:18 AM, Steven Bosscher wrote:

 On Fri, May 3, 2013 at 3:10 PM, Julian Brown wrote:

  gcc/
  * gcse.c (compute_ld_motion_mems): Invalidate non-simple mem refs
  in REG_EQUAL notes.


 Makes sense to me. Looking at REG_EQUAL notes in hash_scan_set is
 something relatively new. Your patch fixes something we appear to have
 overlooked.

 I'd still like to see the before/after dumps.  While I think the patch is
 reasonable as well, those dumps should make it clearer to anyone looking at
 this in the future what was going on -- particularly important since we
 don't have an in-tree port which exhibits this problem.

The dumps are attached to the PR, and I know what is going on: Paolo
and I added support for hashing REG_EQUAL notes, to recover most (if
not all) of the PRE/HOIST opportunities lost along with libcall notes.
Before that change, the worst that could happen would have been
incorrect REG_EQUAL notes. Now that values in notes are considered as
PRE/HOIST candidates, MEMs within notes have to be invalidated. The
patch fixes something Paolo and I simply overlooked.

Ciao!
Steven


Re: RFC: PATCH to avoid linking multiple front ends at once with parallel make

2013-05-06 Thread Jason Merrill

On 05/05/2013 09:57 AM, Dave Korn wrote:

   This sounds like a bad idea to me, and not just because the locking
mechanism is dodgy.  Is the problem more widespread than just your laptop?
Does it affect other host OSs?  Linking multiple frontends at once doesn't
lock up my desktop PC, so I'd rather not have it disabled.


Part of the issue is that I build with -g3, which greatly increases the 
memory consumption at link time.  And builds are sharing 4GB with 
everything else I want to run.


I would be happy to have the mechanism off by default and manually 
enabled by people in my situation.



   Why don't you just nice your build shell?  Shouldn't that make the rest of
your system responsive?


I don't think that helps much with swap thrashing, though I could be wrong.

Jason



[patch] Support .eh_frame in crt1 x86_64 glibc (PR libc/15407)

2013-05-06 Thread Jan Kratochvil
Hi,

since
[patch] x86_64: CFI unwinding stop in _start
http://sourceware.org/ml/libc-alpha/2012-03/msg00573.html

there is a regression reproducible with gold:
http://sourceware.org/bugzilla/show_bug.cgi?id=15407

as .eh_frame is created before the __EH_FRAME_BEGIN__ marker.  Linking order:
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/crt1.o
^^^ .eh_frame is used here
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/crtbegin.o
^^^ __EH_FRAME_BEGIN__ marker here

Therefore proposing to move the __EH_FRAME_BEGIN__ marker earlier:
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/crtbegin1.o
^^^ __EH_FRAME_BEGIN__ marker here
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/crt1.o
^^^ .eh_frame is used here
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/crtbegin.o

It is questionable which all targets should this change affect.  If find it
a needless + untestable change to split crtbegin.o for very every target.
I have split it for every glibc x86_64 target (I hope) even if the one uses
PT_GNU_EH_FRAME (for which the __EH_FRAME_BEGIN__ marker is not needed),
it does not hurt and it was easier (possible?) that way.

I have split it also for the non-Linux glibc i386 + x86_64 targets as AFAIK
they are also affected the same way by the glibc change.

I had to split also i386 despite the glibc change affects only x86_64.  It was
needed for the case of --target=i686-pc-linux-gnu --enable-targets=all where:

gcc/config.gcc:
i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | 
i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
[...]
if test x$enable_targets = xall; then
tm_file=${tm_file} i386/x86-64.h 
i386/gnu-user-common.h i386/gnu-user64.h i386/linux-common.h i386/linux64.h

Here the x86_64 *.h files get included even for the i386 target configuration
so it is no longer possible to make the spec change different for i386.

No regressions for Fedora 19 x86_64 GCC 4.9.0 20130504
and for gcc-4.8.0-3.fc19.{x86_64,i686}.

The x$enable_targets = xall case was tested on Debian 7.0 i386 with:
  --enable-languages=c --without-cloog --disable-libquadmath 
--enable-targets=all

It would be good to test also on some of the *BSD hosts, I will try some from
the GCC Compile Farm if this patch gets approved.


Thanks,
Jan


gcc/
2013-05-06  Jan Kratochvil  jan.kratoch...@redhat.com

* config/i386/gnu-user-common.h (USE_CRT_BEGIN1)
(GNU_USER_TARGET_BEGIN1_SPEC, STARTFILE_SPEC): New.
* config/i386/linux-common.h (STARTFILE_SPEC): Use also
GNU_USER_TARGET_BEGIN1_SPEC.

libgcc/
2013-05-06  Jan Kratochvil  jan.kratoch...@redhat.com

* Makefile.in (crtbegin1$(objext), crtbeginS1$(objext))
(crtbeginT1$(objext)): New.
* config.host (i[34567]86-*-linux*, i[34567]86-*-kfreebsd*-gnu)
(i[34567]86-*-knetbsd*-gnu, i[34567]86-*-gnu*)
(i[34567]86-*-kopensolaris*-gnu, x86_64-*-linux*)
(x86_64-*-kfreebsd*-gnu, x86_64-*-knetbsd*-gnu): Add crtbegin1.o,
crtbeginS1.o and crtbeginT1.o.
* crtstuff.c: New block for CRT_BEGIN1.  Copy __EH_FRAME_BEGIN__ there
and also move it to the start of CRT_BEGIN block.

diff --git a/gcc/config/i386/gnu-user-common.h 
b/gcc/config/i386/gnu-user-common.h
index e28483d..7848906 100644
--- a/gcc/config/i386/gnu-user-common.h
+++ b/gcc/config/i386/gnu-user-common.h
@@ -45,6 +45,14 @@ along with GCC; see the file COPYING3.  If not see
 #undef CC1_SPEC
 #define CC1_SPEC GNU_USER_TARGET_CC1_SPEC
 
+#undef USE_CRT_BEGIN1
+#define USE_CRT_BEGIN1
+#define GNU_USER_TARGET_BEGIN1_SPEC \
+  %{static:crtbeginT1.o%s;shared|pie:crtbeginS1.o%s;:crtbegin1.o%s}
+#undef  STARTFILE_SPEC
+#define STARTFILE_SPEC GNU_USER_TARGET_BEGIN1_SPEC   \
+  GNU_USER_TARGET_STARTFILE_SPEC
+
 /* Similar to standard GNU userspace, but adding -ffast-math support.  */
 #define GNU_USER_TARGET_MATHFILE_SPEC \
   %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h
index 1e8bf6b..a442bb1 100644
--- a/gcc/config/i386/linux-common.h
+++ b/gcc/config/i386/linux-common.h
@@ -44,7 +44,8 @@ along with GCC; see the file COPYING3.  If not see
 
 #undef  STARTFILE_SPEC
 #define STARTFILE_SPEC \
-  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, \
+  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_BEGIN1_SPEC   \
+  GNU_USER_TARGET_STARTFILE_SPEC, \
   ANDROID_STARTFILE_SPEC)
 
 #undef  ENDFILE_SPEC
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 990cd49..5a8d834 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -953,6 +953,9 @@ ifeq ($(CUSTOM_CRTSTUFF),)
 # Compile two additional files that are linked with 

Re: [PATCH] Fix latent bug in RTL GCSE/PRE (PR57159)

2013-05-06 Thread Jeff Law

On 05/06/2013 10:27 AM, Steven Bosscher wrote:

On Mon, May 6, 2013 at 5:28 PM, Jeff Law wrote:

On 05/05/2013 04:18 AM, Steven Bosscher wrote:


On Fri, May 3, 2013 at 3:10 PM, Julian Brown wrote:


  gcc/
  * gcse.c (compute_ld_motion_mems): Invalidate non-simple mem refs
  in REG_EQUAL notes.



Makes sense to me. Looking at REG_EQUAL notes in hash_scan_set is
something relatively new. Your patch fixes something we appear to have
overlooked.


I'd still like to see the before/after dumps.  While I think the patch is
reasonable as well, those dumps should make it clearer to anyone looking at
this in the future what was going on -- particularly important since we
don't have an in-tree port which exhibits this problem.


The dumps are attached to the PR,

I must have missed that notification.


 and I know what is going on: Paolo

and I added support for hashing REG_EQUAL notes, to recover most (if
not all) of the PRE/HOIST opportunities lost along with libcall notes.
But what's important here is that anyone be able to look at this issue 
in the future and figure out what's going on.



Before that change, the worst that could happen would have been
incorrect REG_EQUAL notes. Now that values in notes are considered as
PRE/HOIST candidates, MEMs within notes have to be invalidated. The
patch fixes something Paolo and I simply overlooked.
Understood.  My point is this needs to be clearer to folks other than 
Paolo and yourself.  For some folks, being able to look at the dumps and 
implementation side by side along with the textual explanation really helps.


As the original author of most of the RTL PRE code it certainly wasn't 
clear to me what was happening -- and that's an indication more 
information was needed.


I never did much/anything with the load/store motion bits, so I wasn't 
aware of the overall structure where we have items in the table, and 
mark them as invalid.  As far as I know load/store motion is the only 
PRE code which allows such things in the tables at all.  Now that I can 
see the dumps  follow the load/store specific bits of the 
implementation it's pretty clear now this patch is OK.


Jeff


Re: [PATCH] Fix latent bug in RTL GCSE/PRE (PR57159)

2013-05-06 Thread Jeff Law

On 05/03/2013 07:10 AM, Julian Brown wrote:

Hi,

This is a patch which fixes a latent bug in RTL GCSE/PRE, described
more fully in:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57159

I haven't been able to reproduce the problem on mainline (nor on a
supported target). Maybe someone more familiar with the code in question
than I am can tell if the patch is correct nonetheless?

Thanks,

Julian

ChangeLog

 gcc/
 * gcse.c (compute_ld_motion_mems): Invalidate non-simple mem refs
 in REG_EQUAL notes.


pre-bugfix-1.diff


Index: gcc/gcse.c
===
--- gcc/gcse.c  (revision 198175)
+++ gcc/gcse.c  (working copy)
@@ -3888,6 +3888,13 @@ compute_ld_motion_mems (void)
{
  rtx src = SET_SRC (PATTERN (insn));
  rtx dest = SET_DEST (PATTERN (insn));
+ rtx note = find_reg_equal_equiv_note (insn);
+ rtx src_eq;
+
+ if (note != 0  REG_NOTE_KIND (note) == REG_EQUAL)
+   src_eq = XEXP (note, 0);
+ else
+   src_eq = NULL_RTX;

  /* Check for a simple LOAD...  */
  if (MEM_P (src)  simple_mem (src))
@@ -3904,6 +3911,12 @@ compute_ld_motion_mems (void)
  invalidate_any_buried_refs (src);
}

+ /* Also invalidate any buried loads which may be present in
+REG_EQUAL notes.  */
+ if (src_eq != NULL_RTX
+  !(MEM_P (src_eq)  simple_mem (src_eq)))
+   invalidate_any_buried_refs (src_eq);
+
  /* Check for stores. Don't worry about aliased ones, they
 will block any movement we might do later. We only care
 about this exact pattern since those are the only


Is there any good reason why the search for the note is separated from 
the invalidation code.  As far as I can tell, both the search for the 
note and the call to invalidate_any_buried_refs ought to be in a single 
block of uninterrupted code.


What happens if the code contains a simple mem?  We don't invalidate it 
as far as I can tell.  Doesn't that open us up to the same problems that 
we're seeing with with the non-simple mem?


jeff



Re: [PATCH] Use indentation in gtype.state to show nested structure

2013-05-06 Thread Jeff Law

On 05/03/2013 06:48 PM, David Malcolm wrote:



+static int indent_amount = 0;
+static int had_recent_newline = 0;
Any clean way to do this without the global state?  I have to ask given 
you're generally working on removing global state.  Seems to take a tiny 
step backwards.




+
+static void
+write_new_line (void)
+{
+  /* don't add a newline if we've just had one */
+  if (!had_recent_newline)
+{
+  fprintf (state_file, \n);
+  had_recent_newline = 1;
+}
+}

Need a block comment before WRITE_NEW_LINE.


+
+/*
+  If we've just had a newline, write the indentation amount,
+  potentially modified.
+
+  The modifier exists to support code that writes strings with leading
+  space (e.g  foo) which might occur within a line, or could be the first
+  thing on a line.  By passing a modifier of -1, when such a string is the
+  first thing on a line, the modifier swallows the leading space into the
+  indentation, and all the fields line up correctly.
+*/
Comment style is goofy.  Something like this seems better.  Note the 
placement of the start/end comment markers and use of caps when 
describing a variable or parameter name.



/* If we've just had a newline, write the indention amount,
   potentially modified.

   MODIFIER exists to support code that writes strings with leading
   space (e.g.  foo) which might occur within a line, or could be the
   first thing on a line.  When modifier is -1 the leading space into
   the indention is swallowed.  */

Hmm, reading it MODIFIER seems like a particularly bad NAME.  Can you 
come up with a better name for that parameter?





+static void
+write_any_indent (int modifier)
+{
+  int i;
+  if (had_recent_newline)
+for (i = 0; i  indent_amount + modifier; i++)
+  fprintf (state_file,  );
+  had_recent_newline = 0;
+}
+
+static void
+write_open_paren (const char *tag)
+{
+  write_new_line ();
+  write_any_indent (0);
+  fprintf (state_file, (!%s , tag);
+  indent_amount++;
+}
+
+static void
+write_close_paren (void)
+{
+  indent_amount--;
+  write_any_indent (0);
+  fprintf (state_file, ));
+  write_new_line ();
+}
Block comments before each function.  I realize they're pretty trivial, 
but we really try to always have that block comment.


It's probably worth noting that these also insert newlines since it's 
not trivial to determine simply by looking at the function name. 
Similarly for the open-paren.  It's actually open-paren-!.  Closing 
paren seems to be closing-paren + newline.  Not sure if it's worth 
renaming though.  Just thought I'd point it out since I had to 
double-check when reviewing the later code.





+  write_close_paren (); /* (!fields */
We don't generally write comments on the end of lines like this. 
Belongs on the line before and generally should be written as a complete 
sentence.  This occurs often and needs to be fixed.


Please check the indention on your changes themselves. 
write_state_options  write_state_lang_bitmap look like they got mucked 
up, though I didn't look terribly closely.



With those nits fixed, I think this patch will be ready.  Please update 
 repost for final approval.


jeff


Re: [gomp4] #pragma omp declare simd (aka OpenMP elemental functions) parsing

2013-05-06 Thread Jakub Jelinek
On Mon, May 06, 2013 at 12:23:07PM -0400, Jason Merrill wrote:
 On 05/06/2013 11:04 AM, Jakub Jelinek wrote:
 isn't it too invasive to the C++ FE?
 
 It is pretty invasive.  Why not put the information in
 cp_declarator, as you suggested in your earlier email?  You could
 even put it in the attributes field.

I did it that way because if I understand the code well, often
grokdeclarator/start_decl/start_function/grokmethod/grokfield
is called with a chain of declarators, not just a single one.
On which declarator shall I put the vector?  The first one, all of them?
And, if on the first one, grokdeclarator would need to save it in some
local variable again, because
  for (; declarator; declarator = declarator-declarator)
...
loop is done before the grokfndecl calls.  So I thought passing extra
parameter might be easier.  But I might be misreading the code...

Jakub


[Patch, ARM, v2] Enable libsanitizer

2013-05-06 Thread Christophe Lyon
Hi,

Here is a 2nd attempt at enabling libsanitizer on ARM.
Compared with the previous version, this patch is more intrusive to
workaround some limitations with qemu:

* qemu does not work well with threads, so I chose to disable
clone-test-1.c and rlimit-mmap-test-1.c when running on a simulator.
This is a bit overkill since the limitation is caused by qemu, not by
the fact of running on a simulator. Would it cause problems on other
targets?

* due to different connexion mathod between runtest and the target
program in native mode and in simulated mode, causing isatty(2) to
give a different answer, I modified a few regexps to accept possible
decorations. This can be removed once ASAN_OPTIONS=color=0 is
implemented.

Tested on x86 with no regression, on ARM cortex-a9 hardware and
a15-qemu with the expected new tests.

OK?

Christophe.

2013-05-06  Christophe Lyon christophe.l...@linaro.org

gcc/
* config/arm/arm.c (arm_asan_shadow_offset): New function.
(TARGET_ASAN_SHADOW_OFFSET): Define.
* config/arm/linux-eabi.h (ASAN_CC1_SPEC): Define.
(LINUX_OR_ANDROID_CC): Add ASAN_CC1_SPEC.

libsanitizer/
* configure.tgt: Add ARM pattern.
* sanitizer_common/sanitizer_stacktrace.cc: Return the computed
value.

testsuite/
* lib/target-supports.exp (check_effective_target_hw): New
function.
* c-c++-common/asan/clone-test-1.c: Call
check_effective_target_hw.
* c-c++-common/asan/rlimit-mmap-test-1.c: Likewise.
* c-c++-common/asan/heap-overflow-1.c: Update regexps to accept
possible decorations.
* c-c++-common/asan/null-deref-1.c: Likewise.
* c-c++-common/asan/stack-overflow-1.c: Likewise.
* c-c++-common/asan/strncpy-overflow-1.c: Likewise.
* c-c++-common/asan/use-after-free-1.c: Likewise.
* g++.dg/asan/deep-thread-stack-1.C: Likewise.
* g++.dg/asan/large-func-test-1.C: Likewise.

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 0b97cf8..c036a21 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -281,6 +281,8 @@ static unsigned arm_add_stmt_cost (void *data, int count,

 static void arm_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
  bool op0_preserve_value);
+static unsigned HOST_WIDE_INT arm_asan_shadow_offset (void);
+

 /* Table of machine attributes.  */
 static const struct attribute_spec arm_attribute_table[] =
@@ -657,6 +659,9 @@ static const struct attribute_spec arm_attribute_table[] =
 #define TARGET_CANONICALIZE_COMPARISON \
   arm_canonicalize_comparison

+#undef TARGET_ASAN_SHADOW_OFFSET
+#define TARGET_ASAN_SHADOW_OFFSET arm_asan_shadow_offset
+
 struct gcc_target targetm = TARGET_INITIALIZER;

 /* Obstack for minipool constant handling.  */
@@ -28062,4 +28067,12 @@ arm_validize_comparison (rtx *comparison, rtx
* op1, rtx * op2)

 }

+/* Implement the TARGET_ASAN_SHADOW_OFFSET hook.  */
+
+static unsigned HOST_WIDE_INT
+arm_asan_shadow_offset (void)
+{
+  return (unsigned HOST_WIDE_INT) 1  29;
+}
+
 #include gt-arm.h
diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
index 23671a7..cb0aad1 100644
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -84,10 +84,14 @@
   LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC,\
LINUX_TARGET_LINK_SPEC   ANDROID_LINK_SPEC)

+#undef  ASAN_CC1_SPEC
+#define ASAN_CC1_SPEC %{fsanitize=*:-funwind-tables}
+
 #undef  CC1_SPEC
 #define CC1_SPEC\
-  LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC,\
-   GNU_USER_TARGET_CC1_SPEC   ANDROID_CC1_SPEC)
+  LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC   ASAN_CC1_SPEC,\
+   GNU_USER_TARGET_CC1_SPEC   ASAN_CC1_SPEC  \
+   ANDROID_CC1_SPEC)

 #define CC1PLUS_SPEC \
   LINUX_OR_ANDROID_CC (, ANDROID_CC1PLUS_SPEC)
diff --git a/gcc/testsuite/c-c++-common/asan/clone-test-1.c
b/gcc/testsuite/c-c++-common/asan/clone-test-1.c
index d9acc0d..fd187aa 100644
--- a/gcc/testsuite/c-c++-common/asan/clone-test-1.c
+++ b/gcc/testsuite/c-c++-common/asan/clone-test-1.c
@@ -3,6 +3,7 @@

 /* { dg-do run { target { *-*-linux* } } } */
 /* { dg-require-effective-target clone } */
+/* { dg-require-effective-target hw } */
 /* { dg-options -D_GNU_SOURCE } */

 #include stdio.h
diff --git a/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c
b/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c
index 43d47a3..e0b9038 100644
--- a/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c
+++ b/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c
@@ -25,7 +25,7 @@ int main(int argc, char **argv) {

 /* { dg-output READ of size 1 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r) } */
 /* { dg-output #0 0x\[0-9a-f\]+ (in _*main
(\[^\n\r]*heap-overflow-1.c:21|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r) } */
-/* { dg-output 0x\[0-9a-f\]+ is located 0 bytes to the right of
10-byte region\[^\n\r]*(\n|\r\n|\r) } */
-/* { dg-output allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r) } */
+/* { dg-output 

[PATCH] Fix -g ICE with COMPOUND_LITERAL_EXPR (PR debug/57184)

2013-05-06 Thread Jakub Jelinek
Hi!

We ICE on the following testcase, because DECL_INITIAL contains
COMPOUND_LITERAL_EXPR, which expr.c assumes has been gimplified, but
initializers aren't gimplified.  Fixed thusly, bootstrapped/regtested on
x86_64-linux and i686-linux, ok for trunk/4.8?

2013-05-06  Jakub Jelinek  ja...@redhat.com

PR debug/57184
* expr.c (expand_expr_addr_expr_1): Handle COMPOUND_LITERAL_EXPR
for modifier == EXPAND_INITIALIZER.

* gcc.dg/pr57184.c: New test.

--- gcc/expr.c.jj   2013-05-03 14:55:04.0 +0200
+++ gcc/expr.c  2013-05-06 13:41:03.274302405 +0200
@@ -7561,6 +7561,15 @@ expand_expr_addr_expr_1 (tree exp, rtx t
   inner = TREE_OPERAND (exp, 0);
   break;
 
+case COMPOUND_LITERAL_EXPR:
+  /* Allow COMPOUND_LITERAL_EXPR in initializers, if e.g.
+rtl_for_decl_init is called on DECL_INITIAL with
+COMPOUNT_LITERAL_EXPRs in it, they aren't gimplified.  */
+  if (modifier == EXPAND_INITIALIZER
+  COMPOUND_LITERAL_EXPR_DECL (exp))
+   return expand_expr_addr_expr_1 (COMPOUND_LITERAL_EXPR_DECL (exp),
+   target, tmode, modifier, as);
+  /* FALLTHRU */
 default:
   /* If the object is a DECL, then expand it for its rtl.  Don't bypass
 expand_expr, as that can have various side effects; LABEL_DECLs for
--- gcc/testsuite/gcc.dg/pr57184.c.jj   2013-05-06 13:42:12.514923650 +0200
+++ gcc/testsuite/gcc.dg/pr57184.c  2013-05-06 13:41:55.0 +0200
@@ -0,0 +1,13 @@
+/* PR debug/57184 */
+/* { dg-do compile } */
+/* { dg-options -O2 -g } */
+
+struct S {};
+void bar (struct S *const);
+static struct S *const c = (struct S) {};
+
+void
+foo (void)
+{
+  bar (c);
+}

Jakub


[PATCH] Error out on -fsanitize=thread -fsanitize=address

2013-05-06 Thread Jakub Jelinek
Hi!

While these two sanitizing modes don't conflict on the compiler side, the
runtimes are incompatible with each other (each assumes different memory
layout).  We'd need a special runtime library that would handle both at the
same time, probably not worth the hassle.

Ok for trunk/4.8?

2013-05-06  Jakub Jelinek  ja...@redhat.com

* gcc.c (SANITIZER_SPEC): Reject -fsanitize=address -fsanitize=thread
linking.

--- gcc/gcc.c.jj2013-04-15 16:55:04.0 +0200
+++ gcc/gcc.c   2013-05-06 17:25:42.306455151 +0200
@@ -716,7 +716,8 @@ proper position among the other output f
 #ifndef SANITIZER_SPEC
 #define SANITIZER_SPEC \
 %{!nostdlib:%{!nodefaultlibs:%{fsanitize=address: LIBASAN_SPEC \
-%{static:%ecannot specify -static with -fsanitize=address}}\
+%{static:%ecannot specify -static with -fsanitize=address}\
+%{fsanitize=thread:%e-fsanitize=address is incompatible with 
-fsanitize=thread}}\
 %{fsanitize=thread: LIBTSAN_SPEC \
 %{!pie:%{!shared:%e-fsanitize=thread linking must be done with -pie or 
-shared}
 #endif

Jakub


Re: [PATCH, generic] Support printing of escaped curly braces and vertical bar in assembler output

2013-05-06 Thread Jakub Jelinek
On Mon, Apr 29, 2013 at 01:42:55PM +0200, Jakub Jelinek wrote:
 On Mon, Apr 29, 2013 at 03:39:58PM +0400, Maksim Kuznetsov wrote:
  2013/4/29 Jakub Jelinek ja...@redhat.com:
   Also, why are you handling just %{ and %}, and
   not also %| ?  I mean, if you want to print say {|} into assembly for both
   dialects, don't you need:
   asm ({dialect1%{%|%}|%{%|%}dialect2});
   or similar?  If you use just | instead of %|, it would be handled as
   separator of the dialects.
  
  Sure. %| was removed due to concerns over some target architectures
  already use it, but now %| is under ASSEMBLER_DIALECT and doesn't seem
  to affect them.
  
  ChangeLog:
  
  2013-04-29  Maxim Kuznetsov  maks.kuznet...@gmail.com
  * final.c (do_assembler_dialects): Don't handle curly braces and
  vertical bar escaped by % as dialect delimiters.
  (output_asm_insn): Print curly braces and vertical bar if escaped
  by % and ASSEMBLER_DIALECT defined.
  * doc/tm.texi (ASSEMBLER_DIALECT): Document new standard escapes.
  
  testsuite/ChangeLog:
  
  2013-04-29  Maxim Kuznetsov  maks.kuznet...@gmail.com
  
  * gcc.target/i386/asm-dialect-2.c: New testcase.
 
 Ok, thanks.

I've noticed this hasn't been applied yet; if you don't have SVN access, you
need to mention it explicitly, or is there other reason why it hasn't been
committed?

Jakub


Re: [PATCH] Fix thinko in SLSR that caused x86 bootstrap failure

2013-05-06 Thread Jakub Jelinek
On Sun, May 05, 2013 at 03:45:17PM -0500, Bill Schmidt wrote:
 2013-05-05  Bill Schmidt  wschm...@linux.vnet.ibm.com
 
   * gimple-ssa-strength-reduction.c (slsr_process_phi): Re-enable.
   (find_candidates_in_block): Re-enable slsr_process_phi.
   (create_phi_basis): Fix double counting of candidate adjustment.

This broke gcc.dg/pr33017.c testcase on i?86/x86_64 -m32.
./cc1 -O2 -ftree-vectorize -m32 -mno-sse pr33017.c
difference between r19862{6,7} is:
--- pr33017.s1  2013-05-06 21:22:03.786745422 +0200
+++ pr33017.s2  2013-05-06 21:22:16.844673015 +0200
@@ -32,9 +32,9 @@ foo:
movb$87, var.1373+2(%eax)
je  .L10
cmpl$3, %edx
-   movb$87, var.1373+3(%eax)
+   movb$87, var.1373+2(%eax,%eax)
jne .L11
-   movb$87, var.1373+4(%eax)
+   movb$87, var.1373+2(%eax,%eax,2)
movl$3, %ebp
movl$61, 28(%esp)
 .L3:

Jakub


Re: [gomp4] #pragma omp declare simd (aka OpenMP elemental functions) parsing

2013-05-06 Thread Jason Merrill

On 05/06/2013 02:25 PM, Jakub Jelinek wrote:

I did it that way because if I understand the code well, often
grokdeclarator/start_decl/start_function/grokmethod/grokfield
is called with a chain of declarators, not just a single one.


True, perhaps adding it to declspecs-attributes would be simpler.

Jason



Re: [PATCH] Fix thinko in SLSR that caused x86 bootstrap failure

2013-05-06 Thread Bill Schmidt
On Mon, 2013-05-06 at 21:25 +0200, Jakub Jelinek wrote:
 On Sun, May 05, 2013 at 03:45:17PM -0500, Bill Schmidt wrote:
  2013-05-05  Bill Schmidt  wschm...@linux.vnet.ibm.com
  
  * gimple-ssa-strength-reduction.c (slsr_process_phi): Re-enable.
  (find_candidates_in_block): Re-enable slsr_process_phi.
  (create_phi_basis): Fix double counting of candidate adjustment.
 
 This broke gcc.dg/pr33017.c testcase on i?86/x86_64 -m32.
 ./cc1 -O2 -ftree-vectorize -m32 -mno-sse pr33017.c

Jakub, thanks, I'll take a look.

Bill

 difference between r19862{6,7} is:
 --- pr33017.s12013-05-06 21:22:03.786745422 +0200
 +++ pr33017.s22013-05-06 21:22:16.844673015 +0200
 @@ -32,9 +32,9 @@ foo:
   movb$87, var.1373+2(%eax)
   je  .L10
   cmpl$3, %edx
 - movb$87, var.1373+3(%eax)
 + movb$87, var.1373+2(%eax,%eax)
   jne .L11
 - movb$87, var.1373+4(%eax)
 + movb$87, var.1373+2(%eax,%eax,2)
   movl$3, %ebp
   movl$61, 28(%esp)
  .L3:
 
   Jakub
 




Re: [PATCH, generic] Support printing of escaped curly braces and vertical bar in assembler output

2013-05-06 Thread H.J. Lu
On Mon, May 6, 2013 at 12:01 PM, Jakub Jelinek ja...@redhat.com wrote:
 On Mon, Apr 29, 2013 at 01:42:55PM +0200, Jakub Jelinek wrote:
 On Mon, Apr 29, 2013 at 03:39:58PM +0400, Maksim Kuznetsov wrote:
  2013/4/29 Jakub Jelinek ja...@redhat.com:
   Also, why are you handling just %{ and %}, and
   not also %| ?  I mean, if you want to print say {|} into assembly for 
   both
   dialects, don't you need:
   asm ({dialect1%{%|%}|%{%|%}dialect2});
   or similar?  If you use just | instead of %|, it would be handled as
   separator of the dialects.
 
  Sure. %| was removed due to concerns over some target architectures
  already use it, but now %| is under ASSEMBLER_DIALECT and doesn't seem
  to affect them.
 
  ChangeLog:
 
  2013-04-29  Maxim Kuznetsov  maks.kuznet...@gmail.com
  * final.c (do_assembler_dialects): Don't handle curly braces and
  vertical bar escaped by % as dialect delimiters.
  (output_asm_insn): Print curly braces and vertical bar if escaped
  by % and ASSEMBLER_DIALECT defined.
  * doc/tm.texi (ASSEMBLER_DIALECT): Document new standard escapes.
 
  testsuite/ChangeLog:
 
  2013-04-29  Maxim Kuznetsov  maks.kuznet...@gmail.com
 
  * gcc.target/i386/asm-dialect-2.c: New testcase.

 Ok, thanks.

 I've noticed this hasn't been applied yet; if you don't have SVN access, you
 need to mention it explicitly, or is there other reason why it hasn't been
 committed?

 Jakub

I checked it in for him with a small change in document.   It
should be `|' instead of '@|'.

Thanks.

--
H.J.


[PATCH 2/n, i386]: Merge *sse4_1_pextrq and *sse4_1_pextrd with base vec_select patterns.

2013-05-06 Thread Uros Bizjak
Hello!

Attached patch merges *sse4_1_pextrq and *sse4_1_pextrd with base
vec_select patterns. The patch splits instruction with zero selector
to plain movdi and movsi patterns. Please note that pextr $0,...
should only be generated for !TARGET_INTER_UNIT_MOVES_FROM_VEC targets
when -msse4 is used. For TARGET_INTER_UNIT_MOVES_FROM_VEC, we should
always generate corresponding plain movq or movd interunit move.

2013-05-06  Uros Bizjak  ubiz...@gmail.com

* config/i386/i386.md (isa): Add x64_sse4 member.
(enabled): Handle x64_sse4.
(*movdi_internal): Add *x-?r alternative to emit pextrq $0,%xmm,%reg
instruction for 64bit SSE4_1 targets.  Update insn attributes.
(*movsi_internal): Add *x-?r alternative to emit pextrd $0,%xmm,%reg
instruction for SSE4_1 targets.  Update insn attributes.
* config/i386/sse.md (*vec_extractssevecmodelower_0): Merge
with *sse4_1_pextrd and *sse4_1_pextrq having const_0 selector.
(*vec_extractv2di_1): Merge with *sse4_1_pextrq having
const_1 selector.
(*vec_extractv4si): Rename from *sse4_1_pextrd.
(*vec_extractv4si_zext): Rename from *sse4_1_pextrd_zext.
(*vec_extractssevecmodelower_0 splitters): Merge splitters together.

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

Uros.
Index: i386.md
===
--- i386.md (revision 198611)
+++ i386.md (working copy)
@@ -658,12 +658,15 @@
 (define_attr movu 0,1 (const_string 0))
 
 ;; Used to control the enabled attribute on a per-instruction basis.
-(define_attr isa base,x64,x64_sse4_noavx,x64_avx,nox64,sse2,sse2_noavx,
-   sse3,sse4,sse4_noavx,avx,noavx,avx2,noavx2,bmi2,fma4,fma
+(define_attr isa base,x64,x64_sse4,x64_sse4_noavx,x64_avx,nox64,
+   sse2,sse2_noavx,sse3,sse4,sse4_noavx,avx,noavx,
+   avx2,noavx2,bmi2,fma4,fma
   (const_string base))
 
 (define_attr enabled 
   (cond [(eq_attr isa x64) (symbol_ref TARGET_64BIT)
+(eq_attr isa x64_sse4)
+  (symbol_ref TARGET_64BIT  TARGET_SSE4_1)
 (eq_attr isa x64_sse4_noavx)
   (symbol_ref TARGET_64BIT  TARGET_SSE4_1  !TARGET_AVX)
 (eq_attr isa x64_avx)
@@ -1850,9 +1853,9 @@
 
 (define_insn *movdi_internal
   [(set (match_operand:DI 0 nonimmediate_operand
-=r  ,o  ,r,r  ,r,m ,*y,*y,?*y,?m,?r ,?*Ym,*x,*x,*x,m ,?r ,?*Yi,?*Ym,?*Yi)
+=r  ,o  ,r,r  ,r,m ,*y,*y,?*y,?m,?r ,?*Ym,*x,*x,*x,m ,?r 
,?r,?*Yi,?*Ym,?*Yi)
(match_operand:DI 1 general_operand
-riFo,riF,Z,rem,i,re,C ,*y,m  ,*y,*Yn,r   ,C ,*x,m ,*x,*Yj,r   ,*Yj 
,*Yn))]
+riFo,riF,Z,rem,i,re,C ,*y,m  ,*y,*Yn,r   ,C ,*x,m ,*x,*Yj,*x,r   ,*Yj 
,*Yn))]
   !(MEM_P (operands[0])  MEM_P (operands[1]))
 {
   switch (get_attr_type (insn))
@@ -1872,6 +1875,9 @@
   return movq\t{%1, %0|%0, %1};
 
 case TYPE_SSELOG1:
+  if (GENERAL_REG_P (operands[0]))
+   return %vpextrq\t{$0, %1, %0|%0, %1, 0};
+
   return standard_sse_constant_opcode (insn, operands[1]);
 
 case TYPE_SSEMOV:
@@ -1924,8 +1930,10 @@
   [(set (attr isa)
  (cond [(eq_attr alternative 0,1)
  (const_string nox64)
-   (eq_attr alternative 2,3,4,5,10,11,16,17)
+   (eq_attr alternative 2,3,4,5,10,11,16,18)
  (const_string x64)
+   (eq_attr alternative 17)
+ (const_string x64_sse4)
   ]
   (const_string *)))
(set (attr type)
@@ -1935,13 +1943,13 @@
  (const_string mmx)
(eq_attr alternative 7,8,9,10,11)
  (const_string mmxmov)
-   (eq_attr alternative 12)
+   (eq_attr alternative 12,17)
  (const_string sselog1)
-   (eq_attr alternative 13,14,15,16,17)
+   (eq_attr alternative 13,14,15,16,18)
  (const_string ssemov)
-   (eq_attr alternative 18,19)
+   (eq_attr alternative 19,20)
  (const_string ssecvt)
-   (match_operand 1 pic_32bit_operand)
+   (match_operand 1 pic_32bit_operand)
  (const_string lea)
   ]
   (const_string imov)))
@@ -1951,14 +1959,20 @@
 (const_string 0)
 (const_string *)))
(set (attr length_immediate)
- (if_then_else
-   (and (eq_attr alternative 4) (eq_attr type imov))
-(const_string 8)
-(const_string *)))
+ (cond [(and (eq_attr alternative 4) (eq_attr type imov))
+ (const_string 8)
+   (eq_attr alternative 17)
+ (const_string 1)
+  ]
+  (const_string *)))
(set (attr prefix_rex)
- (if_then_else (eq_attr alternative 10,11,16,17)
+ (if_then_else (eq_attr alternative 10,11,16,17,18)
(const_string 1)
(const_string *)))
+   (set (attr prefix_extra)
+ (if_then_else (eq_attr alternative 17)
+   (const_string 1)
+   (const_string *)))
(set (attr prefix)
  (if_then_else (eq_attr type sselog1,ssemov)
(const_string 

unordered profile mode patch

2013-05-06 Thread François Dumont

Hi

Here is the patch to fix the unordered containers profile mode. 
There are a number of enhancements/fixes:
- Use inheritance to play code on instantiation/destruction. This way 
some constructors and assignment operators can be defaulted like in the 
normal implementation and then be deleted if the normal implementation 
has his special function deleted.
- Extend the Inefficient Hash diagnostic to the unordered_multiset and 
unordered_multimap. Surprisingly __profcxx_hashtable_destruct2 was 
called without __profcxx_hashtable_construct2 so having only the 
performance drawback without beneficing from the diagnostic result. I 
implemented it by simply ignoring equivalent elements.
- Do not collect data for the Inefficient Hash diagnostic if it is not 
On, it is a costly operation.
- Use an implementation detail, the cached hash code, when possible. 
This is good for performance and mandatory for robustness because the 
hash functor can throw and the code is called from the destructor. Some 
tests were failing because of that since I had the 
__gnu_cxx::throw_value_* hash functor to conditionally throw.
- Remove useless non-Standard insert(const value_type*, const 
value_type*) overloads.


I also add a missing  in the MoveOnly equality functor signature of 
55043.cc test file. I don't think it was intentional and it was a 
problem for the profile modes that uses it.


Regarding usage of cached hash code I realized that none of the Standard 
methods of the unordered containers allowed to benefit from it. There is 
no gate between iterator and local_iterator. Has a size_type 
bucket(const_iterator) signature been discussed ?


Tested on x86_64 linux profile mode.

2013-05-07  François Dumont fdum...@gcc.gnu.org

* include/profile/unordered_base.h: New.
* include/Makefile.am: Add new profile header.
* include/Makefile.in: Regenerate.
* include/profile/impl/profiler.h
(__profcxx_inefficient_hash_is_on): New macro.
* include/profile/unordered_map (std::profile::unordered_map):
Use new _Unordered_profile base class. Use default implementations
for special functions.
(std::profile::unordered_multimap): Likewise.
* include/profile/unordered_set (std::profile::unordered_set):
Likewise.
(std::profile::unordered_multiset): Likewise.
* testsuite/23_containers/unordered_multiset/55043.cc: Fix
MoveOnly equality operator signature.

Ok to commit ?

François

Index: include/Makefile.am
===
--- include/Makefile.am	(revision 198608)
+++ include/Makefile.am	(working copy)
@@ -788,6 +788,7 @@
 profile_headers = \
 	${profile_srcdir}/array \
 	${profile_srcdir}/base.h \
+	${profile_srcdir}/unordered_base.h \
 	${profile_srcdir}/unordered_map \
 	${profile_srcdir}/unordered_set \
 	${profile_srcdir}/vector \
Index: include/profile/impl/profiler.h
===
--- include/profile/impl/profiler.h	(revision 198608)
+++ include/profile/impl/profiler.h	(working copy)
@@ -188,7 +188,7 @@
   _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__is_invalid())
 #define __profcxx_is_on() \
   _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__is_on())
-#define __profcxx__is_off() \
+#define __profcxx_is_off() \
   _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__is_off())
 #else
 #define __profcxx_report()
@@ -237,6 +237,8 @@
 
 // Turn on/off instrumentation for INEFFICIENT_HASH.
 #if defined(_GLIBCXX_PROFILE_INEFFICIENT_HASH)
+#define __profcxx_inefficient_hash_is_on() \
+  __gnu_profile::__is_on()
 #define __profcxx_hashtable_construct2(__x...) \
   _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
   __gnu_profile::__trace_hash_func_construct(__x))
@@ -244,8 +246,9 @@
   _GLIBCXX_PROFILE_REENTRANCE_GUARD( \
   __gnu_profile::__trace_hash_func_destruct(__x))
 #else
-#define __profcxx_hashtable_destruct2(__x...) 
-#define __profcxx_hashtable_construct2(__x...)  
+#define __profcxx_inefficient_hash_is_on() false
+#define __profcxx_hashtable_destruct2(__x...)
+#define __profcxx_hashtable_construct2(__x...)
 #endif
 
 // Turn on/off instrumentation for VECTOR_TO_LIST.
Index: include/profile/unordered_set
===
--- include/profile/unordered_set	(revision 198608)
+++ include/profile/unordered_set	(working copy)
@@ -34,6 +34,7 @@
 # include unordered_set
 
 #include profile/base.h
+#include profile/unordered_base.h
 
 #define _GLIBCXX_BASE unordered_set_Key, _Hash, _Pred, _Alloc
 #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
@@ -44,14 +45,22 @@
 {
   /** @brief Unordered_set wrapper with performance instrumentation.  */
   templatetypename _Key, 
-	   typename _Hash  = std::hash_Key,
+	   typename _Hash = std::hash_Key,
 	   typename _Pred = std::equal_to_Key,
 	   typename _Alloc =  std::allocator_Key 
 class unordered_set
-: public _GLIBCXX_STD_BASE
+: public _GLIBCXX_STD_BASE,
+

Re: [PATCH, generic] Support printing of escaped curly braces and vertical bar in assembler output

2013-05-06 Thread Maksim Kuznetsov
 I checked it in for him with a small change in document.   It
 should be `|' instead of '@|'.

Thanks a lot!

--
Maxim Kuznetsov


Re: [PATCH] Use indentation in gtype.state to show nested structure

2013-05-06 Thread David Malcolm
On Mon, 2013-05-06 at 12:22 -0600, Jeff Law wrote:
 On 05/03/2013 06:48 PM, David Malcolm wrote:
 
  +static int indent_amount = 0;
  +static int had_recent_newline = 0;
 Any clean way to do this without the global state?  I have to ask given 
 you're generally working on removing global state.  Seems to take a tiny 
 step backwards.

Note that this code is for the gengtype build-time utility, rather than
in GCC proper, so this wasn't on my own mental hitlist for fixing global
state.

The attached rewrite of the patch introduces classes to hold the new
internal state relating to writing out the s-expressions, and by doing
so implicitly adds a requirement that this code be compiled with C++
(I'm not sure that such a requirement existed before).

The new variables become data members of a new s_expr_writer class (and
as such gain trailing underscores as per
http://gcc.gnu.org/codingconventions.html#Cxx_Names )

It does not remove all global state from the writer code, merely the new
state that the old version of the patch added.  For example:
  FILE * state_file
is still global (and shared by the reader code), but fixing that would
make the patch touch many more lines of code and thus be more difficult
to read.

  +
  +static void
  +write_new_line (void)
  +{
  +  /* don't add a newline if we've just had one */
  +  if (!had_recent_newline)
  +{
  +  fprintf (state_file, \n);
  +  had_recent_newline = 1;
  +}
  +}
 Need a block comment before WRITE_NEW_LINE.

Fixed (now s_expr_writer::write_new_line)

  +
  +/*
  +  If we've just had a newline, write the indentation amount,
  +  potentially modified.
  +
  +  The modifier exists to support code that writes strings with leading
  +  space (e.g  foo) which might occur within a line, or could be the first
  +  thing on a line.  By passing a modifier of -1, when such a string is the
  +  first thing on a line, the modifier swallows the leading space into the
  +  indentation, and all the fields line up correctly.
  +*/
 Comment style is goofy.  Something like this seems better.  Note the 
 placement of the start/end comment markers and use of caps when 
 describing a variable or parameter name.

Fixed.

 Hmm, reading it MODIFIER seems like a particularly bad NAME.  Can you 
 come up with a better name for that parameter?

I changed this to leading_spaces, and changed the sign of it, so all
the calls with -1 became calls with 1.

 Block comments before each function.  I realize they're pretty trivial, 
 but we really try to always have that block comment.
Fixed - though some of them are very trivial (e.g. for constructors)

 It's probably worth noting that these also insert newlines since it's 
 not trivial to determine simply by looking at the function name. 
 Similarly for the open-paren.  It's actually open-paren-!.  Closing 
 paren seems to be closing-paren + newline.  Not sure if it's worth 
 renaming though.  Just thought I'd point it out since I had to 
 double-check when reviewing the later code.

I renamed these to begin_s_expr () and end_s_expr () in the new version
of the patch to make the higher-level intent more clear.

  +  write_close_paren (); /* (!fields */
 We don't generally write comments on the end of lines like this. 
 Belongs on the line before and generally should be written as a complete 
 sentence.  This occurs often and needs to be fixed.

I removed most of these comments, except for the cases where the
begin/end pairs were widely separated, or where there could be different
choices of kind of s-expr.  I rewrote these comments as per your review.


 Please check the indention on your changes themselves. 
 write_state_options  write_state_lang_bitmap look like they got mucked 
 up, though I didn't look terribly closely.

I believe I already fixed these in
http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00259.html 

(again, is there an automated way of checking this?)

 With those nits fixed, I think this patch will be ready.  Please update 
  repost for final approval.

Thanks for review; see attached rewrite of patch.

Dave
commit d0666e4ae645fb133b3b9719f334e7dcca76ab3d
Author: David Malcolm dmalc...@redhat.com
Date:   Fri May 3 18:22:38 2013 -0400

Use indentation when generating gtype.state to show nested structure

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cafda6e..0726b95 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,86 @@
+2013-05-06  David Malcolm  dmalc...@redhat.com
+
+	* gengtype-state.c: (s_expr_writer): New class, to handle
+	prettifying of output layout of s-expressions.
+	(state_writer): New class, to write out gtype.state.
+	(state_written_type_count): Move this variable into member data of
+	state_writer.
+	(s_expr_writer::s_expr_writer): New code: constructor for new class.
+	(state_writer::state_writer(): ditto
+	(s_expr_writer::write_new_line): New function
+	(s_expr_writer::write_any_indent): ditto
+	(s_expr_writer::begin_s_expr): ditto
+	(s_expr_writer::end_s_expr): ditto
+	

Re: [PATCH] Use indentation in gtype.state to show nested structure

2013-05-06 Thread David Malcolm
On Mon, 2013-05-06 at 17:05 -0400, David Malcolm wrote:
[...snip...]
 Thanks for review; see attached rewrite of patch.
Sorry, I messed up the macro for generating the ChangeLog in the last
patch; version with fixed ChangeLog attached.

commit 566185b94449a90dc3213ea11643bfb3924a751d
Author: David Malcolm dmalc...@redhat.com
Date:   Fri May 3 18:22:38 2013 -0400

Use indentation when generating gtype.state to show nested structure

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cafda6e..96faa1f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,86 @@
+2013-05-06  David Malcolm  dmalc...@redhat.com
+
+	* gengtype-state.c: (s_expr_writer): New class, to handle
+	prettifying of output layout of s-expressions.
+	(state_writer): New class, to write out gtype.state.
+	(state_written_type_count): Move this variable into member data of
+	state_writer.
+	(s_expr_writer::s_expr_writer): New code: constructor for new class.
+	(state_writer::state_writer(): ditto
+	(s_expr_writer::write_new_line): New function
+	(s_expr_writer::write_any_indent): ditto
+	(s_expr_writer::begin_s_expr): ditto
+	(s_expr_writer::end_s_expr): ditto
+	(write_state_fileloc): convert to method of state_writer...
+	(state_writer:: write_state_fileloc): ...and use methods of
+	s_expr_writer to write indentation into the gtype.state output file
+	to visually represent the hierarchical structure of the list
+	structures
+	(write_state_fields): ditto, renaming to...
+	(state_writer::write_state_fields)
+	(write_state_a_string): ditto, renaming to...
+	(state_writer::write_state_a_string)
+	(write_state_string_option): ditto, renaming to...
+	(state_writer::write_state_string_option)
+	(write_state_type_option): ditto, renaming to...
+	(state_writer::write_state_type_option)
+	(write_state_nested_option): ditto, renaming to...
+	(state_writer::write_state_nested_option)
+	(write_state_option): ditto, renaming to...
+	(state_writer::write_state_option)
+	(write_state_options): ditto, renaming to...
+	(state_writer::write_state_options)
+	(write_state_lang_bitmap): ditto, renaming to...
+	(state_writer::write_state_lang_bitmap)
+	(write_state_version): ditto, renaming to...
+	(state_writer::write_state_version)
+	(write_state_scalar_type): ditto, renaming to...
+	(state_writer::write_state_scalar_type)
+	(write_state_string_type): ditto, renaming to...
+	(state_writer::write_state_string_type)
+	(write_state_undefined_type): ditto, renaming to...
+	(state_writer::write_state_undefined_type)
+	(write_state_struct_union_type): ditto, renaming to...
+	(state_writer::write_state_struct_union_type)
+	(write_state_struct_type): ditto, renaming to...
+	(state_writer::write_state_struct_type)
+	(write_state_user_struct_type): ditto, renaming to...
+	(state_writer::write_state_user_struct_type)
+	(write_state_lang_struct_type): ditto, renaming to...
+	(state_writer::write_state_lang_struct_type)
+	(write_state_param_struct_type): ditto, renaming to...
+	(state_writer::write_state_param_struct_type)
+	(write_state_pointer_type): ditto, renaming to...
+	(state_writer::write_state_pointer_type)
+	(write_state_array_type): ditto, renaming to...
+	(state_writer::write_state_array_type)
+	(write_state_gc_used): ditto, renaming to...
+	(state_writer::write_state_gc_used)
+	(write_state_common_type_content): ditto, renaming to...
+	(state_writer::write_state_common_type_content)
+	(write_state_type): ditto, renaming to...
+	(state_writer::write_state_type)
+	(write_state_pair_list): ditto, renaming to...
+	(state_writer::write_state_pair_list)
+	(write_state_pair): ditto, renaming to...
+	(state_writer::write_state_pair)
+	(write_state_typedefs): ditto, renaming to...
+	(state_writer::write_state_typedefs)
+	(write_state_structures): ditto, renaming to...
+	(state_writer::write_state_structures)
+	(write_state_param_structs): ditto, renaming to...
+	(state_writer::write_state_param_structs)
+	(write_state_variables): ditto, renaming to...
+	(state_writer::write_state_variables)
+	(write_state_srcdir): ditto, renaming to...
+	(state_writer::write_state_srcdir)
+	(write_state_files_list): ditto, renaming to...
+	(state_writer::write_state_files_list)
+	(write_state_languages): ditto, renaming to...
+	(state_writer::write_state_languages)
+	(write_state): create a state_writer instance and use it when
+	writing out the state file
+
 2013-05-02  David Malcolm  dmalc...@redhat.com
 
 	* testsuite/gcc.dg/plugin/one_time_plugin.c (one_pass_gate): example
diff --git a/gcc/gengtype-state.c b/gcc/gengtype-state.c
index 6092dad..c6ecc24 100644
--- a/gcc/gengtype-state.c
+++ b/gcc/gengtype-state.c
@@ -137,9 +137,143 @@ static const char *state_path = NULL;
 static int state_line = 0;
 static long state_bol = 0;	/* offset of beginning of line */
 
+/* A class for writing out s-expressions, keeping track of newlines and
+   nested indentation.  */
+class s_expr_writer
+{
+public:
+  s_expr_writer();
+
+  void write_new_line ();
+  void write_any_indent (int 

Re: RFA: RL78: Improve interrupt function generation

2013-05-06 Thread DJ Delorie

 * Uses register bank 3 instead of register bank 0 inside the
   handler.

I wonder if nested interrupts will cause problems, since the second
interrupt will occur with RB3 already selected.

Also, there are some hand-coded routines in libgloss/libgcc that
manually swap banks, they'd have to be checked to see if there are
issues there.  Perhaps the G10 work there solved it already.

Those, plus Vinay's patch, should be OK otherwise.  My original
intention was to leave RB3 unused for *hand coded* assembler, but if
we can use it for simpler C handlers too that's all for the better :-)

Tested, with no regressions, on an rl78-elf target.

The testsuite doesn't test interrupts...  I'm not even sure the
simulator can simulate interrupt events.


[PATCH] Fix SLSR conditional candidate bug with commuted operands

2013-05-06 Thread Bill Schmidt
This fixes the following bug:

On Mon, 2013-05-06 at 21:25 +0200, Jakub Jelinek wrote:
 On Sun, May 05, 2013 at 03:45:17PM -0500, Bill Schmidt wrote:
  2013-05-05  Bill Schmidt  wschm...@linux.vnet.ibm.com
  
  * gimple-ssa-strength-reduction.c (slsr_process_phi): Re-enable.
  (find_candidates_in_block): Re-enable slsr_process_phi.
  (create_phi_basis): Fix double counting of candidate adjustment.
 
 This broke gcc.dg/pr33017.c testcase on i?86/x86_64 -m32.
 ./cc1 -O2 -ftree-vectorize -m32 -mno-sse pr33017.c
 difference between r19862{6,7} is:
 --- pr33017.s12013-05-06 21:22:03.786745422 +0200
 +++ pr33017.s22013-05-06 21:22:16.844673015 +0200
 @@ -32,9 +32,9 @@ foo:
   movb$87, var.1373+2(%eax)
   je  .L10
   cmpl$3, %edx
 - movb$87, var.1373+3(%eax)
 + movb$87, var.1373+2(%eax,%eax)
   jne .L11
 - movb$87, var.1373+4(%eax)
 + movb$87, var.1373+2(%eax,%eax,2)
   movl$3, %ebp
   movl$61, 28(%esp)
  .L3:
 
   Jakub
 

The pattern we seek for replacing a conditional candidate can be
confused when a CAND_ADD with an index of 1 has its operands commuted in
the analysis.  (For x = y + z, we may record two CAND_ADDs, one for
either ordering of the addends.)  For a candidate with reversed addends
in the analysis, don't attempt to find a hidden basis.  Otherwise we
make an invalid replacement later on.

Verified this fixes the reported bug.  Bootstrapped and tested on
powerpc64-unknown-linux-gnu with no new regressions.  Ok for trunk?

Thanks,
Bill


2013-05-06  Bill Schmidt  wschm...@linux.vnet.ibm.com

* gimple-ssa-strength-reduction.c (find_phi_def): Don't record a
phi def as possibly hiding a basis for a CAND_ADD whose operands
have been commuted in the analysis.
(alloc_cand_and_find_basis): Add parms to call to find_phi_def.


Index: gcc/gimple-ssa-strength-reduction.c
===
--- gcc/gimple-ssa-strength-reduction.c (revision 198627)
+++ gcc/gimple-ssa-strength-reduction.c (working copy)
@@ -413,15 +413,29 @@ cand_chain_hasher::equal (const value_type *chain1
 static hash_table cand_chain_hasher base_cand_map;
 
 /* Look in the candidate table for a CAND_PHI that defines BASE and
-   return it if found; otherwise return NULL.  */
+   return it if found; otherwise return NULL.  GS is the candidate
+   statement with BASE, INDEX, and STRIDE.  If GS is a CAND_ADD with
+   an index of 1 and an SSA name for STRIDE, we must be careful that
+   we haven't commuted the operands for this candidate.  STRIDE must
+   correspond to the second addend of GS for the eventual transformation
+   to be legal.  If not, return NULL.  */
 
 static cand_idx
-find_phi_def (tree base)
+find_phi_def (gimple gs, enum cand_kind kind, tree base,
+  double_int index, tree stride)
 {
   slsr_cand_t c;
 
   if (TREE_CODE (base) != SSA_NAME)
 return 0;
+
+  /* Check for commutativity condition.  */
+  if (kind == CAND_ADD
+   index.is_one ()
+   TREE_CODE (stride) == SSA_NAME
+   gimple_assign_rhs_code (gs) == PLUS_EXPR
+   stride != gimple_assign_rhs2 (gs))
+return 0;
   
   c = base_cand_from_table (base);
 
@@ -565,7 +579,7 @@ alloc_cand_and_find_basis (enum cand_kind kind, gi
   c-next_interp = 0;
   c-dependent = 0;
   c-sibling = 0;
-  c-def_phi = find_phi_def (base);
+  c-def_phi = find_phi_def (gs, kind, base, index, stride);
   c-dead_savings = savings;
 
   cand_vec.safe_push (c);




Re: [PATCH] Fix thinko in SLSR that caused x86 bootstrap failure

2013-05-06 Thread H.J. Lu
On Mon, May 6, 2013 at 12:29 PM, Bill Schmidt
wschm...@linux.vnet.ibm.com wrote:
 On Mon, 2013-05-06 at 21:25 +0200, Jakub Jelinek wrote:
 On Sun, May 05, 2013 at 03:45:17PM -0500, Bill Schmidt wrote:
  2013-05-05  Bill Schmidt  wschm...@linux.vnet.ibm.com
 
  * gimple-ssa-strength-reduction.c (slsr_process_phi): Re-enable.
  (find_candidates_in_block): Re-enable slsr_process_phi.
  (create_phi_basis): Fix double counting of candidate adjustment.

 This broke gcc.dg/pr33017.c testcase on i?86/x86_64 -m32.
 ./cc1 -O2 -ftree-vectorize -m32 -mno-sse pr33017.c

 Jakub, thanks, I'll take a look.

 Bill

 difference between r19862{6,7} is:
 --- pr33017.s12013-05-06 21:22:03.786745422 +0200
 +++ pr33017.s22013-05-06 21:22:16.844673015 +0200
 @@ -32,9 +32,9 @@ foo:
   movb$87, var.1373+2(%eax)
   je  .L10
   cmpl$3, %edx
 - movb$87, var.1373+3(%eax)
 + movb$87, var.1373+2(%eax,%eax)
   jne .L11
 - movb$87, var.1373+4(%eax)
 + movb$87, var.1373+2(%eax,%eax,2)
   movl$3, %ebp
   movl$61, 28(%esp)
  .L3:

   Jakub




It also caused:


AIL: gcc.dg/vect/vect-28.c -flto execution test
FAIL: gcc.dg/vect/vect-28.c execution test
FAIL: gfortran.dg/array_constructor_9.f90  -O3 -fomit-frame-pointer
execution test
FAIL: gfortran.dg/array_constructor_9.f90  -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  execution test
FAIL: gfortran.dg/array_constructor_9.f90  -O3 -fomit-frame-pointer
-funroll-loops  execution test
FAIL: gfortran.dg/array_constructor_9.f90  -O3 -g  execution test
FAIL: gfortran.dg/char_result_3.f90  -O3 -fomit-frame-pointer  execution test
FAIL: gfortran.dg/char_result_3.f90  -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  execution test
FAIL: gfortran.dg/char_result_3.f90  -O3 -fomit-frame-pointer
-funroll-loops  execution test
FAIL: gfortran.dg/char_result_3.f90  -O3 -g  execution test
FAIL: gfortran.dg/cray_pointers_2.f90  -O  execution test
FAIL: gfortran.dg/realloc_on_assign_2.f03  -O3 -fomit-frame-pointer
execution test
FAIL: gfortran.dg/realloc_on_assign_2.f03  -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  execution test
FAIL: gfortran.dg/realloc_on_assign_2.f03  -O3 -fomit-frame-pointer
-funroll-loops  execution test
FAIL: gfortran.dg/realloc_on_assign_2.f03  -O3 -g  execution test

on i686.

--
H.J.


Re: RFC: PATCH to avoid linking multiple front ends at once with parallel make

2013-05-06 Thread Dave Korn
On 06/05/2013 17:41, Jason Merrill wrote:
 On 05/05/2013 09:57 AM, Dave Korn wrote:
 This sounds like a bad idea to me, and not just because the locking 
 mechanism is dodgy. Is the problem more widespread than just your laptop?
  Does it affect other host OSs? Linking multiple frontends at once 
 doesn't lock up my desktop PC, so I'd rather not have it disabled.
 
 Part of the issue is that I build with -g3, which greatly increases the
 memory consumption at link time.  And builds are sharing 4GB with
 everything else I want to run.
 
 I would be happy to have the mechanism off by default and manually
 enabled by people in my situation.

  Well I couldn't possibly object to that :)

Why don't you just nice your build shell?  Shouldn't that make the
 rest of your system responsive?
 
 I don't think that helps much with swap thrashing, though I could be wrong.

  Ah, no, you're probably right there.  So serialising those final links
sounds like a reasonable solution.

cheers,
  DaveK



powerpc64le configure fix

2013-05-06 Thread Alan Modra
Applying under the obvious rule.

2013-05-07  Anton Blanchard  an...@samba.org

* configure.ac (HAVE_LD_LARGE_TOC): Use correct linker emulation
for powerpc64 little endian.
* configure: Regenerate.

diff --git a/gcc/configure.ac b/gcc/configure.ac
index a859d99..a289cf7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4573,6 +4573,9 @@ fi
 case $target:$tm_file in
   powerpc64-*-freebsd* | powerpc64*-*-linux* | 
powerpc*-*-linux*rs6000/biarch64.h*)
   case $target in
+ *le-*-linux*)
+ emul_name=-melf64lppc
+  ;;
  *-*-linux*)
  emul_name=-melf64ppc
   ;;

-- 
Alan Modra
Australia Development Lab, IBM


Re: [google][4.7] Move the building of gcov constructor function after initialization of gcov_info_var

2013-05-06 Thread Carrot Wei
After the refactoring has been checked in, the bug fixing part is simply
a moving a function call.

Tested by running ./buildit with both x86-64 and power64 targets.
The last time regression of tls-tests.c disappeared. So it is really flaky
in our testing environment.

thanks
Carrot

2013-05-02  Guozhi Wei  car...@google.com

* coverage.c (coverage_obj_init): Move the call of build_init_ctor to
(coverage_obj_finish): here.


Index: coverage.c
===
--- coverage.c (revision 198654)
+++ coverage.c (working copy)
@@ -2504,8 +2504,7 @@
   cgraph_build_static_cdtor ('I', ctor, DEFAULT_INIT_PRIORITY);
 }

-/* Create the gcov_info types and object.  Generate the constructor
-   function to call __gcov_init.  Does not generate the initializer
+/* Create the gcov_info types and object. Does not generate the initializer
for the object.  Returns TRUE if coverage data is being emitted.  */

 static bool
@@ -2557,8 +2556,6 @@
   ASM_GENERATE_INTERNAL_LABEL (name_buf, LPBX, 0);
   DECL_NAME (gcov_info_var) = get_identifier (name_buf);

-  build_init_ctor (gcov_info_type);
-
   return true;
 }

@@ -2581,7 +2578,8 @@
 }

 /* Finalize the coverage data.  Generates the array of pointers to
-   function objects from CTOR.  Generate the gcov_info initializer.  */
+   function objects from CTOR.  Generate the gcov_info initializer.
+   Generate the constructor function to call __gcov_init.  */

 static void
 coverage_obj_finish (VEC(constructor_elt,gc) *ctor)
@@ -2599,9 +2597,12 @@
   DECL_NAME (fn_info_ary) = get_identifier (name_buf);
   DECL_INITIAL (fn_info_ary) = build_constructor (fn_info_ary_type, ctor);
   varpool_finalize_decl (fn_info_ary);
-
+
   DECL_INITIAL (gcov_info_var)
 = build_info (TREE_TYPE (gcov_info_var), fn_info_ary);
+
+  build_init_ctor (TREE_TYPE (gcov_info_var));
+
   varpool_finalize_decl (gcov_info_var);
 }



On Thu, May 2, 2013 at 11:15 AM, Xinliang David Li davi...@google.com wrote:
 I suggest submitting the refactoring part of the changes to GCC trunk first.

 thanks,

 David

 On Thu, May 2, 2013 at 11:06 AM, Carrot Wei car...@google.com wrote:
 This patch fixes google bug 8397853 and targets google 4.7 branch.

 In LIPO mode, when coverage_obj_init is called, cgraph_state is
 CGRAPH_STATE_FINISHED. The variable gcov_info_var is created but not
 initialized. When cgraph_build_static_cdtor is called, the new function and
 variables are expanded immediately since cgraph_state is 
 CGRAPH_STATE_FINISHED.
 It causes gcov_info_var into .bss section. But later in function
 coverage_obj_finish we initialize gcov_info_var with non zero contents, so it
 should not be put into .bss section.

 In FDO mode we don't have this problem because when coverage_obj_init is 
 called,
 cgraph_state is CGRAPH_STATE_IPA_SSA. When cgraph_build_static_cdtor is 
 called,
 the new function is not immediately expanded. The variable will have been
 properly initialized when it is expanded.

 It can be fixed by moving the construction of gcov constructor after
 initialization of gcov_info_var.

 Tested with following testing:
 x86-64 bootstrap.
 x86-64 regression test.
 power64 regression test on qemu.

 The only regression for power64 is
 FAIL: gcc.dg/torture/tls/tls-test.c  -O2 -flto -fno-use-linker-plugin
 -flto-partition=none  execution test
 It is a flaky test case in our testing environment since all other executions
 with different compiler options failed. All testing of tls-test.c pass native
 power64 testing.

 thanks
 Carrot

 2013-05-02  Guozhi Wei  car...@google.com

 * coverage.c (gcov_info_type): New global variable.
 (coverage_obj_init): Move the construction of gcov constructor to
 (build_init_ctor): here.
 (coverage_obj_finish): Call build_init_ctor after initialization of
 gcov_info_var.


 Index: coverage.c
 ===
 --- coverage.c (revision 198425)
 +++ coverage.c (working copy)
 @@ -123,6 +123,7 @@

  /* Coverage info VAR_DECL and function info type nodes.  */
  static GTY(()) tree gcov_info_var;
 +static GTY(()) tree gcov_info_type;
  static GTY(()) tree gcov_fn_info_type;
  static GTY(()) tree gcov_fn_info_ptr_type;

 @@ -2478,14 +2479,12 @@
return build_constructor (info_type, v1);
  }

 -/* Create the gcov_info types and object.  Generate the constructor
 -   function to call __gcov_init.  Does not generate the initializer
 +/* Create the gcov_info types and object. Does not generate the initializer
 for the object.  Returns TRUE if coverage data is being emitted.  */

  static bool
  coverage_obj_init (void)
  {
 -  tree gcov_info_type, ctor, stmt, init_fn;
unsigned n_counters = 0;
unsigned ix;
struct coverage_data *fn;
 @@ -2531,24 +2530,6 @@
ASM_GENERATE_INTERNAL_LABEL (name_buf, LPBX, 0);
DECL_NAME (gcov_info_var) = get_identifier (name_buf);

 -  /* Build a decl for __gcov_init.  */
 -  init_fn = build_pointer_type 

Re: [PATCH] Fix thinko in SLSR that caused x86 bootstrap failure

2013-05-06 Thread Bill Schmidt
On Mon, 2013-05-06 at 17:28 -0700, H.J. Lu wrote:
 On Mon, May 6, 2013 at 12:29 PM, Bill Schmidt
 wschm...@linux.vnet.ibm.com wrote:
  On Mon, 2013-05-06 at 21:25 +0200, Jakub Jelinek wrote:
  On Sun, May 05, 2013 at 03:45:17PM -0500, Bill Schmidt wrote:
   2013-05-05  Bill Schmidt  wschm...@linux.vnet.ibm.com
  
   * gimple-ssa-strength-reduction.c (slsr_process_phi): Re-enable.
   (find_candidates_in_block): Re-enable slsr_process_phi.
   (create_phi_basis): Fix double counting of candidate adjustment.
 
  This broke gcc.dg/pr33017.c testcase on i?86/x86_64 -m32.
  ./cc1 -O2 -ftree-vectorize -m32 -mno-sse pr33017.c
 
  Jakub, thanks, I'll take a look.
 
  Bill
 
  difference between r19862{6,7} is:
  --- pr33017.s12013-05-06 21:22:03.786745422 +0200
  +++ pr33017.s22013-05-06 21:22:16.844673015 +0200
  @@ -32,9 +32,9 @@ foo:
movb$87, var.1373+2(%eax)
je  .L10
cmpl$3, %edx
  - movb$87, var.1373+3(%eax)
  + movb$87, var.1373+2(%eax,%eax)
jne .L11
  - movb$87, var.1373+4(%eax)
  + movb$87, var.1373+2(%eax,%eax,2)
movl$3, %ebp
movl$61, 28(%esp)
   .L3:
 
Jakub
 
 
 
 
 It also caused:
 
 
 AIL: gcc.dg/vect/vect-28.c -flto execution test
 FAIL: gcc.dg/vect/vect-28.c execution test
 FAIL: gfortran.dg/array_constructor_9.f90  -O3 -fomit-frame-pointer
 execution test
 FAIL: gfortran.dg/array_constructor_9.f90  -O3 -fomit-frame-pointer
 -funroll-all-loops -finline-functions  execution test
 FAIL: gfortran.dg/array_constructor_9.f90  -O3 -fomit-frame-pointer
 -funroll-loops  execution test
 FAIL: gfortran.dg/array_constructor_9.f90  -O3 -g  execution test
 FAIL: gfortran.dg/char_result_3.f90  -O3 -fomit-frame-pointer  execution test
 FAIL: gfortran.dg/char_result_3.f90  -O3 -fomit-frame-pointer
 -funroll-all-loops -finline-functions  execution test
 FAIL: gfortran.dg/char_result_3.f90  -O3 -fomit-frame-pointer
 -funroll-loops  execution test
 FAIL: gfortran.dg/char_result_3.f90  -O3 -g  execution test
 FAIL: gfortran.dg/cray_pointers_2.f90  -O  execution test
 FAIL: gfortran.dg/realloc_on_assign_2.f03  -O3 -fomit-frame-pointer
 execution test
 FAIL: gfortran.dg/realloc_on_assign_2.f03  -O3 -fomit-frame-pointer
 -funroll-all-loops -finline-functions  execution test
 FAIL: gfortran.dg/realloc_on_assign_2.f03  -O3 -fomit-frame-pointer
 -funroll-loops  execution test
 FAIL: gfortran.dg/realloc_on_assign_2.f03  -O3 -g  execution test
 
 on i686.
 
 --
 H.J.
 

H.J., do you know whether the proposed patch fixes these failures?  I'll
take a look at these tomorrow if not.

Thanks,
Bill





[patch] top-level configure for Nios II

2013-05-06 Thread Sandra Loosemore
The newlib support for Nios II ELF has just been approved and checked 
in.  However, there's no libgloss support; it's assumed that folks will 
link with a BSP (like Altera's HAL) to provide the target-specific 
startup code and I/O stubs.  So, this patch adds libgloss to the 
top-level noconfigdirs.


Jeff Johnston has already approved this patch for newlib.  OK for gcc, too?

-Sandra


2013-05-06  Sandra Loosemore  san...@codesourcery.com

* configure.ac (noconfigdirs [nios2-*-*]): Add target-libgloss.
* configure: Regenerated.
Index: configure
===
--- configure	(revision 198662)
+++ configure	(working copy)
@@ -3718,6 +3718,9 @@ case ${target} in
   mt-*-*)
 noconfigdirs=$noconfigdirs sim
 ;;
+  nios2-*-*)
+noconfigdirs=$noconfigdirs target-libgloss
+;;
   powerpc-*-aix*)
 # copied from rs6000-*-* entry
 noconfigdirs=$noconfigdirs gprof
Index: configure.ac
===
--- configure.ac	(revision 198662)
+++ configure.ac	(working copy)
@@ -1057,6 +1057,9 @@ case ${target} in
   mt-*-*)
 noconfigdirs=$noconfigdirs sim
 ;;
+  nios2-*-*)
+noconfigdirs=$noconfigdirs target-libgloss
+;;
   powerpc-*-aix*)
 # copied from rs6000-*-* entry
 noconfigdirs=$noconfigdirs gprof


Re: [google][4.7] Move the building of gcov constructor function after initialization of gcov_info_var

2013-05-06 Thread Xinliang David Li
ok.

David

On Mon, May 6, 2013 at 6:03 PM, Carrot Wei car...@google.com wrote:
 After the refactoring has been checked in, the bug fixing part is simply
 a moving a function call.

 Tested by running ./buildit with both x86-64 and power64 targets.
 The last time regression of tls-tests.c disappeared. So it is really flaky
 in our testing environment.

 thanks
 Carrot

 2013-05-02  Guozhi Wei  car...@google.com

 * coverage.c (coverage_obj_init): Move the call of build_init_ctor to
 (coverage_obj_finish): here.


 Index: coverage.c
 ===
 --- coverage.c (revision 198654)
 +++ coverage.c (working copy)
 @@ -2504,8 +2504,7 @@
cgraph_build_static_cdtor ('I', ctor, DEFAULT_INIT_PRIORITY);
  }

 -/* Create the gcov_info types and object.  Generate the constructor
 -   function to call __gcov_init.  Does not generate the initializer
 +/* Create the gcov_info types and object. Does not generate the initializer
 for the object.  Returns TRUE if coverage data is being emitted.  */

  static bool
 @@ -2557,8 +2556,6 @@
ASM_GENERATE_INTERNAL_LABEL (name_buf, LPBX, 0);
DECL_NAME (gcov_info_var) = get_identifier (name_buf);

 -  build_init_ctor (gcov_info_type);
 -
return true;
  }

 @@ -2581,7 +2578,8 @@
  }

  /* Finalize the coverage data.  Generates the array of pointers to
 -   function objects from CTOR.  Generate the gcov_info initializer.  */
 +   function objects from CTOR.  Generate the gcov_info initializer.
 +   Generate the constructor function to call __gcov_init.  */

  static void
  coverage_obj_finish (VEC(constructor_elt,gc) *ctor)
 @@ -2599,9 +2597,12 @@
DECL_NAME (fn_info_ary) = get_identifier (name_buf);
DECL_INITIAL (fn_info_ary) = build_constructor (fn_info_ary_type, ctor);
varpool_finalize_decl (fn_info_ary);
 -
 +
DECL_INITIAL (gcov_info_var)
  = build_info (TREE_TYPE (gcov_info_var), fn_info_ary);
 +
 +  build_init_ctor (TREE_TYPE (gcov_info_var));
 +
varpool_finalize_decl (gcov_info_var);
  }



 On Thu, May 2, 2013 at 11:15 AM, Xinliang David Li davi...@google.com wrote:
 I suggest submitting the refactoring part of the changes to GCC trunk first.

 thanks,

 David

 On Thu, May 2, 2013 at 11:06 AM, Carrot Wei car...@google.com wrote:
 This patch fixes google bug 8397853 and targets google 4.7 branch.

 In LIPO mode, when coverage_obj_init is called, cgraph_state is
 CGRAPH_STATE_FINISHED. The variable gcov_info_var is created but not
 initialized. When cgraph_build_static_cdtor is called, the new function and
 variables are expanded immediately since cgraph_state is 
 CGRAPH_STATE_FINISHED.
 It causes gcov_info_var into .bss section. But later in function
 coverage_obj_finish we initialize gcov_info_var with non zero contents, so 
 it
 should not be put into .bss section.

 In FDO mode we don't have this problem because when coverage_obj_init is 
 called,
 cgraph_state is CGRAPH_STATE_IPA_SSA. When cgraph_build_static_cdtor is 
 called,
 the new function is not immediately expanded. The variable will have been
 properly initialized when it is expanded.

 It can be fixed by moving the construction of gcov constructor after
 initialization of gcov_info_var.

 Tested with following testing:
 x86-64 bootstrap.
 x86-64 regression test.
 power64 regression test on qemu.

 The only regression for power64 is
 FAIL: gcc.dg/torture/tls/tls-test.c  -O2 -flto -fno-use-linker-plugin
 -flto-partition=none  execution test
 It is a flaky test case in our testing environment since all other 
 executions
 with different compiler options failed. All testing of tls-test.c pass 
 native
 power64 testing.

 thanks
 Carrot

 2013-05-02  Guozhi Wei  car...@google.com

 * coverage.c (gcov_info_type): New global variable.
 (coverage_obj_init): Move the construction of gcov constructor to
 (build_init_ctor): here.
 (coverage_obj_finish): Call build_init_ctor after initialization of
 gcov_info_var.


 Index: coverage.c
 ===
 --- coverage.c (revision 198425)
 +++ coverage.c (working copy)
 @@ -123,6 +123,7 @@

  /* Coverage info VAR_DECL and function info type nodes.  */
  static GTY(()) tree gcov_info_var;
 +static GTY(()) tree gcov_info_type;
  static GTY(()) tree gcov_fn_info_type;
  static GTY(()) tree gcov_fn_info_ptr_type;

 @@ -2478,14 +2479,12 @@
return build_constructor (info_type, v1);
  }

 -/* Create the gcov_info types and object.  Generate the constructor
 -   function to call __gcov_init.  Does not generate the initializer
 +/* Create the gcov_info types and object. Does not generate the initializer
 for the object.  Returns TRUE if coverage data is being emitted.  */

  static bool
  coverage_obj_init (void)
  {
 -  tree gcov_info_type, ctor, stmt, init_fn;
unsigned n_counters = 0;
unsigned ix;
struct coverage_data *fn;
 @@ -2531,24 +2530,6 @@
ASM_GENERATE_INTERNAL_LABEL (name_buf, LPBX, 0);

RFA: PATCH to add variadic version of build_constructor

2013-05-06 Thread Jason Merrill
Most build_* functions have variadic versions, but build_constructor 
doesn't as of yet, and it would be convenient for a patch I'm working 
on.  I decided to call it build_constructor_va, but am open to other 
naming ideas.


Tested x86_64-pc-linux-gnu.  OK for trunk?
commit 7cab86001c233a8cac209e905aafe796560b80ff
Author: Jason Merrill ja...@redhat.com
Date:   Mon May 6 23:15:08 2013 -0400

	* tree.c (build_constructor_va): New.
	* tree.h: Declare it.

diff --git a/gcc/tree.c b/gcc/tree.c
index d8f2424..9782fba 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1467,6 +1467,29 @@ build_constructor_from_list (tree type, tree vals)
   return build_constructor (type, v);
 }
 
+/* Return a new CONSTRUCTOR node whose type is TYPE.  If additional
+   arguments are provided, they are index/value pairs.  The list must be
+   terminated by two NULL_TREEs.  */
+
+tree
+build_constructor_va (tree type, ...)
+{
+  vecconstructor_elt, va_gc *v = NULL;
+  va_list p;
+
+  va_start (p, type);
+  while (true)
+{
+  tree index = va_arg (p, tree);
+  tree value = va_arg (p, tree);
+  if (index == NULL_TREE  value == NULL_TREE)
+	break;
+  CONSTRUCTOR_APPEND_ELT (v, index, value);
+}
+  va_end (p);
+  return build_constructor (type, v);
+}
+
 /* Return a new FIXED_CST node whose type is TYPE and value is F.  */
 
 tree
diff --git a/gcc/tree.h b/gcc/tree.h
index be43440..5150237 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4763,6 +4763,7 @@ extern tree build_vector_from_val (tree, tree);
 extern tree build_constructor (tree, vecconstructor_elt, va_gc *);
 extern tree build_constructor_single (tree, tree, tree);
 extern tree build_constructor_from_list (tree, tree);
+extern tree build_constructor_va (tree, ...);
 extern tree build_real_from_int_cst (tree, const_tree);
 extern tree build_complex (tree, tree, tree);
 extern tree build_one_cst (tree);


Re: [PATCH] Use indentation in gtype.state to show nested structure

2013-05-06 Thread Laurynas Biveinis
2013/5/6 Jeff Law l...@redhat.com:
 On 05/03/2013 06:48 PM, David Malcolm wrote:


 +static int indent_amount = 0;
 +static int had_recent_newline = 0;

 Any clean way to do this without the global state?  I have to ask given
 you're generally working on removing global state.  Seems to take a tiny
 step backwards.

My 2c is that this global state is confined to gengtype, where the
increased modularity isn't going to pay off much anyway. Thus IMHO
it's not a big deal.