Re: [PATCH] Fix Linux/sparc build after generic asm output optimizations.

2011-11-12 Thread Eric Botcazou
> Any ELF target that overrides ASM_GENERATE_INTERNAL_LABEL is at risk
> of not building any more due to the recent elfos.h changes.
>
> Those changes require that the label format generated by
> ASM_GENERATE_INTERNAL_LABEL and TARGET_ASM_INTERNAL_LABEL are in sync,
> but that is only being ensured for targets that use elfos.h as-is.

And ASM_GENERATE_INTERNAL_LABEL uses stpcpy, which isn't portable.

> Eric, it seems that most if not all of the other ELF sparc targets
> will need something like this as well but I was only able to validate
> Linux at the moment.

Aren't all ELF targets of all architectures potentially affected?

-- 
Eric Botcazou


Re: [patch tree-optimization 1/2]: Branch-cost optimizations

2011-11-12 Thread Kai Tietz
2011/11/10 Jeff Law :
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 11/09/11 14:09, Kai Tietz wrote:
>>
>> Well, such a comparison-logic-folder helper - like affine-tree for
>> add/subtract/scale) - is for sure something good for inner gimple
>> passes building up new logic-truth expressions, but such a pass
>> doesn't meet requirements need to fold for BC optimization AFAICS.
> Perhaps.  I think the thing to do would be to see what additional
> needs we have and evaluate if they make sense in that kind of framework.
>
>>
>> The difference is that for BC we don't want to fold at all. Also
>> it isn't necessarily "simplified" statement we want. For example
>> 'if ((a | b) == 0 & ...) ...'.  If the costs of such pattern '(a |
>> b) == 0' are too high, we want to representation it instead as 'if
>> (a == 0) if (b == 0) ...'.
> We don't have to fold.  Think of this as an easy to use on-the-side
> representation of some operation(s).
Well, this is clear, but I see here not much re-use between
BC-optimization and general truth-logic folding.

The requirement that we need to handle comparisons for conditional
folding is mainly caused by the cond_expr itself.  As here we have no
ssa-comparison statement itself.  We have here left and right operand
plus a comparison-code.  So this kind of statement requires that we
handle it in tree.  Additional it might be a floating-point
comparison, where logical-invert can't be done on comparison's code
itself.  So we need here to introduce a dummy expression for such
cases (eg making a AST tree out of it).
One of the major difference I see between expanding for general
optimization vs. BC-optimization is the cost-analysis itself and the
decision, if we want to exloide a statment into its sub-parts, or
not.. For non-conditions, we don't want to look into multiple used
statements at all, but for BC we might want that, as long as statement
wasn't used before (in statement and dominators)  Also costs of a
statements operand depends on its use.  Means an operand with
multiple-use, which was prior to this statement evaluated, can be
considered as simple-statments with costs of 1, but a statement with
multiple use, which wasn't already evaluated has the costs of its
operations.

> What I would roughly expect to see is the set of operations feeding
> the comparison shoved into this structure.  With the full set of ops
> exposed into this structure we could look at the cost,
> canonicalize/simplify if appropriate, then select the best codegen
> strategy, modifying the on-the-side structure as needed.  We then
> reflect the final result back into the IL.

Well, the set of operations would be pretty limited IMHO.  It would be
logical and/or/not. May logical-xor could be interesting in some
cases, but not really sure if it is worth to handle it all, as a
logical-xor is normally a simple equal-compare in a condition.
Additionally we need function to read in a conditional-expression from
SSA-gimple form and built by it this representation and doing the
comparison-expansion (means eliminating logical-not expressions and
exploding some folded-patterns to their pure-logical expanded form -
like (A | B) ==/!= 0, (A & B) ==/!= ~0 for integral-typed A,B, .And
for boolean-typed A,B we might have things like A < B -> !A && B,
etc.

>> We have an condition 'if ((A | B) == 0 && C == 0) ...' where the
>> joining of A == 0 and C == 0 would be profitable by
>> BC-optimization, but the join of A != 0 and B != 0 isn't. So we do
>> - as my patch does - first an expand to element comparison-sequence
>> view.
>>
>> So we get for it the transformed form 'if (A == 0 && B == 0 && C ==
>> 0)'.
> Right, so one of the first steps would be to canonicalize the (A|B) ==
> 0 && C == 0 form into something like you've shown above within this
> on-the-side structure.

Sure. with considering the "simple" characteristic of a
gimple-statement and evaluating elements costs.

>> Now we can begin to search for valid patterns in the condition for
>> joining by searching from left-to-right for a profitable pattern.
>> So we end-up with final statement 'if ((A | C) == 0 && C)'
> Which would be fairly straighforward using the on-the-side structure.
>
> I'm not sure what I'm missing since the description you've given fits
> very nicely with the overall approach Richi is suggesting.

The point is here more, that I don't see a share-ability of this
abstraction for BC and general condition-build-up, as the attributes
for them are quite different.  For a simple comparison-chain collector
we need indeed just an inverse, and a helper-mode to represent intial
condition-expression's compare.  For BC we would need to make out of
such a general tree a specialized one with the additional attributes
and expansion logic before we can work on it at all.  As for BC we
have always to operate on already created SSA-gimple form, we don't
need any operations on such a tree.  We just read it in to our
representation with calculating attribu

gcov patch, multiple paths

2011-11-12 Thread Nathan Sidwell

Hi,
I've committed this patch to gcov,  It deals with cases where the same header 
file, containing inline functions etc, is included by multiple different 
pathnames.  The current behavior treats these as distinct sources, which is (a) 
misleading and (b) in the absence of -p all but one instance of the resulting 
.gcov file will be overwritten.


We now canonicalize the names of source files by eliding '.' components always 
and eliding 'dir/..' components where possible.  We can't resolve a 'dir/..' 
component when 'dir' is a symlink.  We also canonicalize \\ path separators.


I discovered some faults with the preserve-pathname mangling, in that it didn't 
match the documented behaviour ('.' wasn't elided, and /../ turned into '#..#^'. 
 These are fixed with this patch too.


I updated the documentation to make it clear you can provide either source or 
object filenames to gcov.  Historically it accepted source files, but with 
current inlining and C++ features, it makes more sense to provide the object 
file names, especially in multi-directory builds.


tested on i686-pc-linux-gnu
2011-11-12  Nathan Sidwell  

* gcov.c (struct name_map): New.
(names, n_names, a_names): New global vars.
(print_usage): Adjust usage.
(generate_results): Canonicalize main file name.
(release_structures): Adjust.
(name_search, name_sort): New callbacks.
(find_source): Look for and create a canonical name.
(canonicalize_name): New.
(make_gcov_file_name): Reimplement and fix mangling.
(mangle_name): New.
* doc/gcov.texi: Update documentation about path preservation.

testsuite/
* gcc.misc-tests/gcov-15.c: New.

Index: doc/gcov.texi
===
--- doc/gcov.texi   (revision 181300)
+++ doc/gcov.texi   (working copy)
@@ -113,7 +113,7 @@ compatible with any other profiling or t
 @section Invoking @command{gcov}
 
 @smallexample
-gcov @r{[}@var{options}@r{]} @var{sourcefiles}
+gcov @r{[}@var{options}@r{]} @var{files}
 @end smallexample
 
 @command{gcov} accepts the following options:
@@ -176,11 +176,12 @@ Do not create the @command{gcov} output
 @itemx --long-file-names
 Create long file names for included source files.  For example, if the
 header file @file{x.h} contains code, and was included in the file
-@file{a.c}, then running @command{gcov} on the file @file{a.c} will produce
-an output file called @file{a.c##x.h.gcov} instead of @file{x.h.gcov}.
-This can be useful if @file{x.h} is included in multiple source
-files.  If you use the @samp{-p} option, both the including and
-included file names will be complete path names.
+@file{a.c}, then running @command{gcov} on the file @file{a.c} will
+produce an output file called @file{a.c##x.h.gcov} instead of
+@file{x.h.gcov}.  This can be useful if @file{x.h} is included in
+multiple source files and you want to see the individual
+contributions.  If you use the @samp{-p} option, both the including
+and included file names will be complete path names.
 
 @item -p
 @itemx --preserve-paths
@@ -188,9 +189,9 @@ Preserve complete path information in th
 @file{.gcov} files.  Without this option, just the filename component is
 used.  With this option, all directories are used, with @samp{/} characters
 translated to @samp{#} characters, @file{.} directory components
-removed and @file{..}
+removed and unremoveable @file{..}
 components renamed to @samp{^}.  This is useful if sourcefiles are in several
-different directories.  It also affects the @samp{-l} option.
+different directories.
 
 @item -f
 @itemx --function-summaries
@@ -203,9 +204,8 @@ Specify either the directory containing
 object path name.  The @file{.gcno}, and
 @file{.gcda} data files are searched for using this option.  If a directory
 is specified, the data files are in that directory and named after the
-source file name, without its extension.  If a file is specified here,
-the data files are named after that file, without its extension.  If this
-option is not supplied, it defaults to the current directory.
+input file name, without its extension.  If a file is specified here,
+the data files are named after that file, without its extension.
 
 @item -u
 @itemx --unconditional-branches
@@ -223,12 +223,17 @@ when you invoked the compiler.  Otherwis
 the source files.  @command{gcov} produces files called
 @file{@var{mangledname}.gcov} in the current directory.  These contain
 the coverage information of the source file they correspond to.
-One @file{.gcov} file is produced for each source file containing code,
+One @file{.gcov} file is produced for each source (or header) file
+containing code,
 which was compiled to produce the data files.  The @var{mangledname} part
 of the output file name is usually simply the source file name, but can
 be something more complicated if the @samp{-l} or @samp{-p} options are
 given.  Refer to those options for

Fix bootstrap with solaris as

2011-11-12 Thread Jan Hubicka
Hi,
my reorg of wekarefs broke solaris bootstrap. The problem is that C++ FE 
produces
aliases for external variables/functions and expect them to be always thrown 
away.
I think this was originally an oversight, since they are completely useless for
rest of compilation but with new alias representation we ought to be able to use
them to prove that the two vars are known to be equivalent. This patch however 
just
prevents cgraphunit from outputting them and thus fixes the bootstrap issue.

Bootstrapped/regtested & comitted.
Honza
Index: ChangeLog
===
--- ChangeLog   (revision 181310)
+++ ChangeLog   (working copy)
@@ -1,3 +1,8 @@
+2011-11-12  Jan Hubicka  
+
+   PR bootstrap/50822
+   * cgraphunit.c (output_weakrefs): Output really only weakrefs.
+
 2011-11-12  Nathan Sidwell  
 
* gcov.c (struct name_map): New.
Index: cgraphunit.c
===
--- cgraphunit.c(revision 181310)
+++ cgraphunit.c(working copy)
@@ -2101,13 +2101,15 @@ output_weakrefs (void)
   struct varpool_node *vnode;
   for (node = cgraph_nodes; node; node = node->next)
 if (node->alias && DECL_EXTERNAL (node->decl)
-&& !TREE_ASM_WRITTEN (node->decl))
+&& !TREE_ASM_WRITTEN (node->decl)
+   && lookup_attribute ("weakref", DECL_ATTRIBUTES (node->decl)))
   assemble_alias (node->decl,
  node->thunk.alias ? DECL_ASSEMBLER_NAME 
(node->thunk.alias)
  : get_alias_symbol (node->decl));
   for (vnode = varpool_nodes; vnode; vnode = vnode->next)
 if (vnode->alias && DECL_EXTERNAL (vnode->decl)
-&& !TREE_ASM_WRITTEN (vnode->decl))
+&& !TREE_ASM_WRITTEN (vnode->decl)
+   && lookup_attribute ("weakref", DECL_ATTRIBUTES (vnode->decl)))
   assemble_alias (vnode->decl,
  vnode->alias_of ? DECL_ASSEMBLER_NAME (vnode->alias_of)
  : get_alias_symbol (vnode->decl));


Re: [PATCH 0/3] Conversion to __atomic builtins

2011-11-12 Thread David Edelsohn
On Sat, Nov 12, 2011 at 1:46 AM, Richard Henderson  wrote:

> The first patch removes two avoidable warnings in rs6000.md.
> It seems like we could avoid many more of the remaining, but
> those are harder; this one was obvious.
>
> The second patch is a build error.  It has appeared on this
> list previously, but not yet applied.

>  rs6000: fix*_trunc insns use nonimmediate_operand
>  ppc-linux: Fix call to _Unwind_SetGRPtr

The first two patches are good.

The third will take a little more time to review.

Thanks, David


[Patch Powerpc/Darwin, committed] fix PR45233

2011-11-12 Thread Iain Sandoe

OK'd by Mike in the PR thread.
Applied to trunk and 4.6
Iain

gcc:

PR target/45233
* config/rs6000/rs6000.c (rs6000_legitimize_reload_address):
Only expand a symbol ref. into an access when the entity is defined
in the TU.

PR bootstrap/50822
Index: gcc/config/rs6000/rs6000.c
===
--- gcc/config/rs6000/rs6000.c  (revision 181311)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -6169,6 +6169,7 @@ rs6000_legitimize_reload_address (rtx x, enum mach
 #if TARGET_MACHO
   && DEFAULT_ABI == ABI_DARWIN
   && (flag_pic || MACHO_DYNAMIC_NO_PIC_P)
+  && machopic_symbol_defined_p (x)
 #else
   && DEFAULT_ABI == ABI_V4
   && !flag_pic



Re: [PATCH] Fix Linux/sparc build after generic asm output optimizations.

2011-11-12 Thread Jason Merrill

On 11/12/2011 03:57 AM, Eric Botcazou wrote:

And ASM_GENERATE_INTERNAL_LABEL uses stpcpy, which isn't portable.


We just need to declare it in system.h in order to use the definition in 
libiberty.


Jason


Re: PING 1 [Patch Ada RFA] make sure that multilibs are built with correct s-oscons.ads

2011-11-12 Thread Iain Sandoe


On 9 Nov 2011, at 09:54, Arnaud Charlet wrote:


* Iain Sandoe, 2011-11-07 :

Subject: PING 1 [Patch Ada RFA] make sure that multilibs are built  
with

correct s-oscons.ads


Patch looks fine to me.


It's an official 'OK' then.


Thanks, done (r181319).

May I repeat my question re. 4.6?
Since this is a wrong-code situation, I would have thought it eligible  
for a back-port?


thanks
Iain




Re: [PATCH] Fix Linux/sparc build after generic asm output optimizations.

2011-11-12 Thread Eric Botcazou
> We just need to declare it in system.h in order to use the definition in
> libiberty.

OK, this should be fine.

-- 
Eric Botcazou


Re: [PATCH 0/4][CFT] Handle legacy __sync libcalls

2011-11-12 Thread Richard Henderson
On 11/11/2011 07:39 PM, Kaz Kojima wrote:
> It seems that expand_builtin sets "target" variable to
> const0_trx when "ignore" argument is set and this causes
> the above ICE.  I'm trying a patch ...

I think the fix belongs in expand_builtin_compare_and_swap.
I'm testing the following.


r~
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 98dc636..9dc68cc 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -5144,7 +5144,6 @@ expand_builtin_sync_operation (enum machine_mode mode, 
tree exp,
case BUILT_IN_SYNC_FETCH_AND_NAND_4:
case BUILT_IN_SYNC_FETCH_AND_NAND_8:
case BUILT_IN_SYNC_FETCH_AND_NAND_16:
-
  if (warned_f_a_n)
break;
 
@@ -5158,7 +5157,6 @@ expand_builtin_sync_operation (enum machine_mode mode, 
tree exp,
case BUILT_IN_SYNC_NAND_AND_FETCH_4:
case BUILT_IN_SYNC_NAND_AND_FETCH_8:
case BUILT_IN_SYNC_NAND_AND_FETCH_16:
-
  if (warned_n_a_f)
break;
 
@@ -5190,16 +5188,24 @@ expand_builtin_compare_and_swap (enum machine_mode 
mode, tree exp,
 bool is_bool, rtx target)
 {
   rtx old_val, new_val, mem;
+  rtx *pbool, *poval;
 
   /* Expand the operands.  */
   mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
   old_val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode);
   new_val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 2), mode);
 
-  if (!expand_atomic_compare_and_swap ((is_bool ? &target : NULL),
-  (is_bool ? NULL : &target),
-  mem, old_val, new_val, false,
-  MEMMODEL_SEQ_CST, MEMMODEL_SEQ_CST))
+  pbool = poval = NULL;
+  if (target != const0_rtx)
+{
+  if (is_bool)
+   pbool = ⌖
+  else
+   poval = ⌖
+}
+  if (!expand_atomic_compare_and_swap (pbool, poval, mem, old_val, new_val,
+  false, MEMMODEL_SEQ_CST,
+  MEMMODEL_SEQ_CST))
 return NULL_RTX;
 
   return target;
@@ -5338,8 +5344,9 @@ expand_builtin_atomic_compare_exchange (enum machine_mode 
mode, tree exp,
 
   oldval = copy_to_reg (gen_rtx_MEM (mode, expect));
 
-  if (!expand_atomic_compare_and_swap (&target, &oldval, mem, oldval,
-  desired, is_weak, success, failure))
+  if (!expand_atomic_compare_and_swap ((target == const0_rtx ? NULL : &target),
+  &oldval, mem, oldval, desired,
+  is_weak, success, failure))
 return NULL_RTX;
 
   emit_move_insn (gen_rtx_MEM (mode, expect), oldval);


[v3] fix libstdc++/51083

2011-11-12 Thread Jonathan Wakely
This allows __promote to be used like enable_if to constrain the TR1
and C++11 maths function overloads so they only work for floating
point and integral types.

PR libstdc++/51083
* include/ext/type_traits.h (__promote): Only define __type member
for integral and floating point types, to prevent math functions
participating in overload resolution for other types.
(__promote_2, __promote_3, __promote_4): Use __promote in default
template argument values, so deduction only succeeds for integral and
floating point types.
* testsuite/26_numerics/cmath/51083.cc: New.
* testsuite/26_numerics/complex/51083.cc: New.
* testsuite/tr1/8_c_compatibility/cmath/51083.cc: New.
* testsuite/tr1/8_c_compatibility/complex/51083.cc: New.

tested x86_64-linux, committed to trunk.

I'm undecided whether this counts as a regression or not and if it
should be applied to the 4.6 branch - the testcases worked before TR1
was added or without -std=c++0x.
Index: include/ext/type_traits.h
===
--- include/ext/type_traits.h   (revision 181320)
+++ include/ext/type_traits.h   (revision 181321)
@@ -161,44 +161,50 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 struct __promote
 { typedef double __type; };
 
+  // No nested __type member for non-integer non-floating point types,
+  // allows this type to be used for SFINAE to constrain overloads in
+  //  and  to only the intended types.
   template
 struct __promote<_Tp, false>
-{ typedef _Tp __type; };
+{ };
 
-  template
+  template<>
+struct __promote
+{ typedef long double __type; };
+
+  template<>
+struct __promote
+{ typedef double __type; };
+
+  template<>
+struct __promote
+{ typedef float __type; };
+
+  template::__type,
+   typename _Up2 = typename __promote<_Up>::__type>
 struct __promote_2
 {
-private:
-  typedef typename __promote<_Tp>::__type __type1;
-  typedef typename __promote<_Up>::__type __type2;
-
-public:
-  typedef __typeof__(__type1() + __type2()) __type;
+  typedef __typeof__(_Tp2() + _Up2()) __type;
 };
 
-  template
+  template::__type,
+   typename _Up2 = typename __promote<_Up>::__type,
+   typename _Vp2 = typename __promote<_Vp>::__type>
 struct __promote_3
 {
-private:
-  typedef typename __promote<_Tp>::__type __type1;
-  typedef typename __promote<_Up>::__type __type2;
-  typedef typename __promote<_Vp>::__type __type3;
-
-public:
-  typedef __typeof__(__type1() + __type2() + __type3()) __type;
+  typedef __typeof__(_Tp2() + _Up2() + _Vp2()) __type;
 };
 
-  template
+  template::__type,
+   typename _Up2 = typename __promote<_Up>::__type,
+   typename _Vp2 = typename __promote<_Vp>::__type,
+   typename _Wp2 = typename __promote<_Wp>::__type>
 struct __promote_4
 {
-private:
-  typedef typename __promote<_Tp>::__type __type1;
-  typedef typename __promote<_Up>::__type __type2;
-  typedef typename __promote<_Vp>::__type __type3;
-  typedef typename __promote<_Wp>::__type __type4;
-
-public:
-  typedef __typeof__(__type1() + __type2() + __type3() + __type4()) __type;
+  typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type;
 };
 
 _GLIBCXX_END_NAMESPACE_VERSION
Index: testsuite/26_numerics/complex/51083.cc
===
--- testsuite/26_numerics/complex/51083.cc  (revision 0)
+++ testsuite/26_numerics/complex/51083.cc  (revision 181321)
@@ -0,0 +1,54 @@
+// { dg-options "-std=gnu++0x" }
+//
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// .
+
+#include 
+
+namespace a
+{
+  template class Mat { };
+
+  template struct Mat2 : Mat { };
+
+  template int arg(Mat) { return 1; }
+  template int conj(Mat) { return 1; }
+  template int imag(Mat) { return 1; }
+  template int norm(Mat) { return 1; }
+  template int proj(Mat) { return 1; }
+  template int real(Mat) { return 1; }
+
+  template int pow(Mat, U) { return 1; }
+  template int pow(T, Mat) { return 1; }
+}
+
+int main()
+{
+  int __attribute__((unused)) i;
+
+  using namespace

Re: PING 1 [Patch Ada RFA] make sure that multilibs are built with correct s-oscons.ads

2011-11-12 Thread Arnaud Charlet
> May I repeat my question re. 4.6?
> Since this is a wrong-code situation, I would have thought it eligible for
> a back-port?

Well, it's not a wrong-code as in "wrong code generated by the back-end",
and it's not a regression.

In any case, backporting to 4.6 is fine with me.

Arno


Re: [v3] fix libstdc++/51083

2011-11-12 Thread Paolo Carlini
Hi

> I'm undecided whether this counts as a regression or not and if it
> should be applied to the 4.6 branch - the testcases worked before TR1
> was added or without -std=c++0x.

Thanks a lot for fixing this! About the branch, the patch seems safe enough to 
me, maybe just wait a couple if weeks?

Paolo


Re: [v3] fix libstdc++/51083

2011-11-12 Thread Jonathan Wakely
On 12 November 2011 16:24, Paolo Carlini wrote:
> Hi
>
>> I'm undecided whether this counts as a regression or not and if it
>> should be applied to the 4.6 branch - the testcases worked before TR1
>> was added or without -std=c++0x.
>
> Thanks a lot for fixing this! About the branch, the patch seems safe enough 
> to me, maybe just wait a couple if weeks?

Yeah, that's what I was thinking too - will do, thanks.


Re: [Patch 001] [x86 backend] Define march/mtune for upcoming AMD Bulldozer procesor.

2011-11-12 Thread Uros Bizjak
On Fri, Nov 11, 2011 at 1:47 PM, Venkataramanan Kumar
 wrote:

> Can you please check if these changes as Ok.
>
> On Thu, Nov 10, 2011 at 7:59 PM, Jan Hubicka  wrote:
>>
>> > Hello!
>> >
>> > > This patch defines -march=bdver1 and -mtune=bdver1 flag for the
>> > > upcoming
>> > > AMD Bulldozer processor.
>> Hi,
>> it seems that bdver/btver is not mentioned in invoke.texi nor
>> changes.html.
>> Could you please add documentation?

These are OK.

Thanks,
Uros.


Re: [PATCH 0/4][CFT] Handle legacy __sync libcalls

2011-11-12 Thread Richard Henderson
On 11/12/2011 07:56 AM, Richard Henderson wrote:
> On 11/11/2011 07:39 PM, Kaz Kojima wrote:
>> It seems that expand_builtin sets "target" variable to
>> const0_trx when "ignore" argument is set and this causes
>> the above ICE.  I'm trying a patch ...
> 
> I think the fix belongs in expand_builtin_compare_and_swap.
> I'm testing the following.

Full test completed on x86_64-linux.  I verified that the test
you mentioned no longer ICEs on sh4-linux.

Committed.


r~


Re: PATCH [1/n] addr32: Properly use Pmode and word_mode

2011-11-12 Thread Uros Bizjak
On Sat, Nov 12, 2011 at 3:19 AM, H.J. Lu  wrote:

> The current x32 implementation uses LEAs to convert 32bit address to
> 64bit.  However, we can use addr32 prefix to use 32bit address directly.
> It improves performance by 5% in SPEC CPU 2K/2006.  All changes are done
> in x86 backend, except for a smaill unwind library assert change:
>
> http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01555.html
>
> due to return column size difference.
>
> For x86-64, Pmode can be 32bit or 64bit, but word_mode is always 64bit.
> push/pop only work on word_mode.  Also string instructions take Pmode
> pointers.
>
> I will submit a set of patches to use 32bit Pmode for x32.  This is
> the first patch to properly use Pmode and word_mode.  It also adds
> addr32 prefix to string instructions if needed.  OK for trunk?

Not for stage3.

Uros.


Re: [v3] fix libstdc++/51083

2011-11-12 Thread Gabriel Dos Reis
On Sat, Nov 12, 2011 at 9:59 AM, Jonathan Wakely  wrote:
> This allows __promote to be used like enable_if to constrain the TR1
> and C++11 maths function overloads so they only work for floating
> point and integral types.
>
>        PR libstdc++/51083
>        * include/ext/type_traits.h (__promote): Only define __type member
>        for integral and floating point types, to prevent math functions
>        participating in overload resolution for other types.
>        (__promote_2, __promote_3, __promote_4): Use __promote in default
>        template argument values, so deduction only succeeds for integral and
>        floating point types.
>        * testsuite/26_numerics/cmath/51083.cc: New.
>        * testsuite/26_numerics/complex/51083.cc: New.
>        * testsuite/tr1/8_c_compatibility/cmath/51083.cc: New.
>        * testsuite/tr1/8_c_compatibility/complex/51083.cc: New.
>
> tested x86_64-linux, committed to trunk.
>
> I'm undecided whether this counts as a regression or not and if it
> should be applied to the 4.6 branch - the testcases worked before TR1
> was added or without -std=c++0x.
>

I'm OK with it everywhere.


PATCH [2/n] addr32: Output REX prefix for UNSPEC_GOTNTPOFF

2011-11-12 Thread H.J. Lu
X86-64 linker optimizes TLS_MODEL_INITIAL_EXEC to TLS_MODEL_LOCAL_EXEC
by checking

movq foo@gottpoff(%rip), %reg

and

addq foo@gottpoff(%rip), %reg

It uses the REX prefix to avoid the last byte of the previous
instruction.  With 32bit Pmode, we may not have the REX prefix and
the last byte of the previous instruction may be an offset, which
may look like a REX prefix.  IE->LE optimization will generate corrupted
binary.  This patch makes sure we always output an REX pfrefix for
UNSPEC_GOTNTPOFF.  OK for trunk?

Thanks.

H.J.
---
2011-11-12  H.J. Lu  

* config/i386/i386-protos.h (ix86_output_rex_prefix_p): New.
* config/i386/i386.c (ix86_output_rex_prefix_p): Likewise.

* config/i386/i386.md (*movsi_internal): Output REX prefix if
needed.
(*add_1): Likewise.

diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 5486e61..14af5e6 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -274,6 +274,8 @@ extern void x86_output_aligned_bss (FILE *, tree, const 
char *,
 extern void x86_elf_aligned_common (FILE *, const char *,
unsigned HOST_WIDE_INT, int);
 
+extern bool ix86_output_rex_prefix_p (rtx, rtx);
+
 #ifdef RTX_CODE
 extern void ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *,
  enum rtx_code *, enum rtx_code *);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index f73bb94..81ff746 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -14510,6 +14510,29 @@ i386_asm_output_addr_const_extra (FILE *file, rtx x)
 
   return true;
 }
+
+/* Since x64-64 linker IE->LE transition requires a REX prefix, we
+   output a REX prefix if there isn't one.  */
+
+bool
+ix86_output_rex_prefix_p (rtx dest, rtx op)
+{
+  if (!TARGET_X32
+  || GET_MODE (dest) != SImode
+  || REX_INT_REG_P (dest)
+  || !MEM_P (op))
+return false;
+
+  op = XEXP (op, 0);
+  if (GET_CODE (op) != CONST)
+return false;
+
+  op = XEXP (op, 0);
+  if (GET_CODE (op) != UNSPEC)
+return false;
+
+  return XINT (op, 1) == UNSPEC_GOTNTPOFF;
+}
 
 /* Split one or more double-mode RTL references into pairs of half-mode
references.  The RTL can be REG, offsettable MEM, integer constant, or
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 9d2d084..5660ea2 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -2287,7 +2287,11 @@
 
 default:
   gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
-  return "mov{l}\t{%1, %0|%0, %1}";
+  /* Output REX prefix if needed.  */
+  if (ix86_output_rex_prefix_p (operands[0], operands[1]))
+   return "rex mov{l}\t{%1, %0|%0, %1}";
+  else
+   return "mov{l}\t{%1, %0|%0, %1}";
 }
 }
   [(set (attr "type")
@@ -5616,7 +5620,11 @@
   if (x86_maybe_negate_const_int (&operands[2], mode))
 return "sub{}\t{%2, %0|%0, %2}";
 
-  return "add{}\t{%2, %0|%0, %2}";
+  /* Output REX prefix if needed.  */
+  if (ix86_output_rex_prefix_p (operands[0], operands[2]))
+   return "rex add{}\t{%2, %0|%0, %2}";
+  else
+   return "add{}\t{%2, %0|%0, %2}";
 }
 }
   [(set (attr "type")


Re: [PATCH] Fix Linux/sparc build after generic asm output optimizations.

2011-11-12 Thread Dimitrios Apostolou

Hi,

On Sat, 12 Nov 2011, Eric Botcazou wrote:


We just need to declare it in system.h in order to use the definition in
libiberty.


OK, this should be fine.



do the patches I sent for bug #51094 solve the problems?

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


Thanks,
Dimitris




Re: [Gcc.amd] [Patch 002] Document bdver1 in changes.html for GCC4.6

2011-11-12 Thread Gerald Pfeifer
On Fri, 11 Nov 2011, venkataramanan.ku...@amd.com wrote:
> Added bdver1 information to changes.html for GCC4.6
> 
> is Ok to commit?

Looks good to me, yes.

Thanks,
Gerald


Re: [PATCH 3/4] hppa: Install __sync libfuncs for linux.

2011-11-12 Thread Gerald Pfeifer
On Fri, 11 Nov 2011, Richard Henderson wrote:
> @@ -136,3 +136,6 @@ along with GCC; see the file COPYING3.  If not see
>  /* Linux always uses gas.  */
>  #undef TARGET_GAS
>  #define TARGET_GAS 1
> +
> +#undef TARGET_SYNC_LIBCALL
> +#define TARGET_SYNC_LIBCALL 1

John, Richard, while you are at it, mind making this GNU/Linux per
guidance from RMS?  (That'll save us work later on.)

I assume the ChangeLog entry also should refer to GNU/Linux?

Gerald


Re: [PATCH] Fix Linux/sparc build after generic asm output optimizations.

2011-11-12 Thread David Miller
From: Eric Botcazou 
Date: Sat, 12 Nov 2011 09:57:04 +0100

>> Eric, it seems that most if not all of the other ELF sparc targets
>> will need something like this as well but I was only able to validate
>> Linux at the moment.
> 
> Aren't all ELF targets of all architectures potentially affected?

Again, only those ELF targets which have an override for
ASM_GENERATE_INTERNAL_LABEL, which if you check is almost entirely
Sparc.

The normal thing to do is to use the elfos.h defines as-is.

In the end it was a good thing, as we can now get rid of these spurious
override sparc doesn't even need.


Fix permissions in update_web_docs_svn

2011-11-12 Thread Gerald Pfeifer
Benjamin maintains the libstdc++ manuals under /onlinedocs on
gcc.gnu.org, but we keep running into permissions problems.

The patch below addresses this such that he, and others in the
gcc group with login access, can take care of such changes.

Unless there are any objections, I am planning on checking this
in.  (The script is generally run as gccadmin with group gcc.)
Affirmative notes welcome as well. :-)

Gerald


2011-11-02  Gerald Pfeifer  

* update_web_docs_svn: Make $DOCSDIR group writable after
creating it.

Index: update_web_docs_svn
===
--- update_web_docs_svn (revision 181325)
+++ update_web_docs_svn (working copy)
@@ -93,6 +93,7 @@
 
 if [ ! -d $DOCSDIR ]; then
   mkdir $DOCSDIR
+  chmod g+w $DOCSDIR
 fi
 
 if [ -z "$RELEASE" ]; then


Re: [PATCH] Fix Linux/sparc build after generic asm output optimizations.

2011-11-12 Thread Eric Botcazou
> Again, only those ELF targets which have an override for
> ASM_GENERATE_INTERNAL_LABEL, which if you check is almost entirely
> Sparc.

We probably aren't looking at the same tree then.  Alpha, IA-64, MIPS, HP-PA, 
SPARC and a few others have an override for ASM_GENERATE_INTERNAL_LABEL.

> The normal thing to do is to use the elfos.h defines as-is.

Target macros are meant to be overridden though.  If an implicit dependency has 
been introduced, then it should be documented and the tree should be audited.

-- 
Eric Botcazou


Re: [PATCH] Fix Linux/sparc build after generic asm output optimizations.

2011-11-12 Thread David Miller
From: Eric Botcazou 
Date: Sun, 13 Nov 2011 00:26:51 +0100

>> Again, only those ELF targets which have an override for
>> ASM_GENERATE_INTERNAL_LABEL, which if you check is almost entirely
>> Sparc.
> 
> We probably aren't looking at the same tree then.  Alpha, IA-64, MIPS, HP-PA, 
> SPARC and a few others have an override for ASM_GENERATE_INTERNAL_LABEL.

I am aware of these cases.

And when I took at look at them it seemed to me that these base target
headers where you see those defines either do not get used alongside
elfos.h or will come before elfos.h in the tmake file listing, thus
the elfos.h definition will take precedence.

On the other hand, on Sparc, the overrides occur in OS specific target
headers which appear after elfos.h in the tmake header file list.

>> The normal thing to do is to use the elfos.h defines as-is.
> 
> Target macros are meant to be overridden though.  If an implicit dependency 
> has 
> been introduced, then it should be documented and the tree should be audited.

Agreed.


Re: [PATCH 0/4][CFT] Handle legacy __sync libcalls

2011-11-12 Thread Kaz Kojima
Richard Henderson  wrote:
>> I think the fix belongs in expand_builtin_compare_and_swap.
>> I'm testing the following.
> 
> Full test completed on x86_64-linux.  I verified that the test
> you mentioned no longer ICEs on sh4-linux.
> 
> Committed.

Thanks!

Regards,
kaz


PATCH for to use tree clobbers for c++/51060 (temporary re-use)

2011-11-12 Thread Jason Merrill
Now that we have a way of explicitly marking a variable as dead, we can 
use that to indicate the end of a temporary's lifetime by adding it as a 
cleanup for that temporary.  Since gimple_push_cleanup still deals in 
trees I needed to tweak a couple of places to avoid trying to treat a 
clobber as a real CONSTRUCTOR, but the changes were small.


One somewhat surprising thing that showed up as a result of this change 
were some failures in the libstdc++ testsuite.  When I investigated, I 
found that the tests were relying on temporaries living longer than they 
should:



 const int& x = std::max(1, 2);


Since std::max takes its arguments by const reference and returns one of 
them, x ends up as a dangling reference to the temporary containing 2, 
which dies at the end of the declaration-statement.  This patch breaks 
the testcase because now the temporary stack slots get reused by the 
next statement, so by the time we look at x it no longer points to a 2. 
 I've fixed the tests by removing the references on the variables.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 007e09c084265ea24ca76db72083d90b3280
Author: Jason Merrill 
Date:   Fri Nov 11 17:42:30 2011 -0500

	PR c++/51060
	* gimplify.c (gimplify_target_expr): Add a clobber to the cleanup.
	(gimplify_modify_expr): Don't try to simplify it.
	* cp/cp-gimplify.c (cp_gimplify_expr): Leave clobbers alone.

diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index af45f59..9968c3d 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -569,7 +569,8 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
 
 	else if ((is_gimple_lvalue (op1) || INDIRECT_REF_P (op1)
 		  || (TREE_CODE (op1) == CONSTRUCTOR
-		  && CONSTRUCTOR_NELTS (op1) == 0)
+		  && CONSTRUCTOR_NELTS (op1) == 0
+		  && !TREE_CLOBBER_P (op1))
 		  || (TREE_CODE (op1) == CALL_EXPR
 		  && !CALL_EXPR_RETURN_SLOT_OPT (op1)))
 		 && is_really_empty_class (TREE_TYPE (op0)))
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 9845b69..cfe6696 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -4554,6 +4554,16 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
   gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR
 	  || TREE_CODE (*expr_p) == INIT_EXPR);
 
+  /* Trying to simplify a clobber using normal logic doesn't work,
+ so handle it here.  */
+  if (TREE_CLOBBER_P (*from_p))
+{
+  gcc_assert (!want_value && TREE_CODE (*to_p) == VAR_DECL);
+  gimplify_seq_add_stmt (pre_p, gimple_build_assign (*to_p, *from_p));
+  *expr_p = NULL;
+  return GS_ALL_DONE;
+}
+
   /* Insert pointer conversions required by the middle-end that are not
  required by the frontend.  This fixes middle-end type checking for
  for example gcc.dg/redecl-6.c.  */
@@ -5335,6 +5345,8 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
 
   if (init)
 {
+  tree cleanup = NULL_TREE;
+
   /* TARGET_EXPR temps aren't part of the enclosing block, so add it
 	 to the temps list.  Handle also variable length TARGET_EXPRs.  */
   if (TREE_CODE (DECL_SIZE (temp)) != INTEGER_CST)
@@ -5369,8 +5381,30 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
 
   /* If needed, push the cleanup for the temp.  */
   if (TARGET_EXPR_CLEANUP (targ))
-	gimple_push_cleanup (temp, TARGET_EXPR_CLEANUP (targ),
-			 CLEANUP_EH_ONLY (targ), pre_p);
+	{
+	  if (CLEANUP_EH_ONLY (targ))
+	gimple_push_cleanup (temp, TARGET_EXPR_CLEANUP (targ),
+ CLEANUP_EH_ONLY (targ), pre_p);
+	  else
+	cleanup = TARGET_EXPR_CLEANUP (targ);
+	}
+
+  /* Add a clobber for the temporary going out of scope, like
+	 gimplify_bind_expr.  */
+  if (needs_to_live_in_memory (temp))
+	{
+	  tree clobber = build_constructor (TREE_TYPE (temp), NULL);
+	  TREE_THIS_VOLATILE (clobber) = true;
+	  clobber = build2 (MODIFY_EXPR, TREE_TYPE (temp), temp, clobber);
+	  if (cleanup)
+	cleanup = build2 (COMPOUND_EXPR, void_type_node, cleanup,
+			  clobber);
+	  else
+	cleanup = clobber;
+	}
+
+  if (cleanup)
+	gimple_push_cleanup (temp, cleanup, false, pre_p);
 
   /* Only expand this once.  */
   TREE_OPERAND (targ, 3) = init;
diff --git a/gcc/testsuite/g++.dg/opt/stack2.C b/gcc/testsuite/g++.dg/opt/stack2.C
new file mode 100644
index 000..8468e1a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/stack2.C
@@ -0,0 +1,33 @@
+// PR c++/51060
+// { dg-options "-Os -Wframe-larger-than=2000 -Werror" }
+
+// Shows a problem of not re-using stack space:
+// Compile as: g++ -c test_stack_reuse.cpp -o /dev/null -Wframe-larger-than=2048 -Werror -Os
+// Result: warning: the frame size of 10240 bytes is larger than 2048 bytes [-Wframe-larger-than=]
+//
+
+struct StackObject
+{
+  StackObject();
+  char buffer[1024];
+};
+
+void Test()
+{
+#define TEST_SUB() \
+  StackObject();
+
+#define TEST() \
+	TEST_SUB() \
+	TEST_SUB() \
+	TEST_SUB() \
+	TE

Re: [PATCH 3/4] hppa: Install __sync libfuncs for linux.

2011-11-12 Thread Dave Anglin

On 12-Nov-11, at 3:42 PM, Gerald Pfeifer wrote:


John, Richard, while you are at it, mind making this GNU/Linux per
guidance from RMS?  (That'll save us work later on.)


Yes.  I don't want to participate in this controversy.

I believe the file was initially contributed by developers working under
a HP contract to port the PA-RISC architecture to the "Linux" kernel.

John David Anglin


[libstdc++] Reference GNU/Linux in doc/xml/manual/using.xml

2011-11-12 Thread Gerald Pfeifer
This is the third to last patch necessary for libstdc++ from what I
can tell; committed to trunk.

Gerald


2011-11-13  Gerald Pfeifer  

* using.xml: Use GNU/Linux.

Index: doc/xml/manual/using.xml
===
--- doc/xml/manual/using.xml(revision 181332)
+++ doc/xml/manual/using.xml(working copy)
@@ -1177,7 +1177,7 @@

  

- GNU ld (default on Linux):
+ GNU ld (default on GNU/Linux):
   -Wl,-rpath,destdir/lib

  
@@ -1207,7 +1207,7 @@
  On some platforms the system administrator can configure the
  dynamic linker to always look for libraries in
  destdir/lib, for example
- by using the ldconfig utility on Linux
+ by using the ldconfig utility on GNU/Linux
  or the crle utility on Solaris. This is a
  system-wide change which can make the system unusable so if you
  are unsure then use one of the other methods described above.
@@ -1269,7 +1269,7 @@
   to display how ad hoc this is: On Solaris, both -pthreads and
   -threads (with subtly different meanings) are honored.  On OSF,
   -pthread and -threads (with subtly different meanings) are
-  honored.  On Linux/i386, -pthread is honored.  On FreeBSD,
+  honored.  On GNU/Linux i386, -pthread is honored.  On FreeBSD,
   -pthread is honored.  Some other ports use other switches.
   AFAIK, none of this is properly documented anywhere other than
   in ``gcc -dumpspecs'' (look at lib and cpp entries).



Re: [doc] fix broken anchor in install.texi

2011-11-12 Thread Gerald Pfeifer
On Mon, 7 Nov 2011, Jonathan Wakely wrote:
> We currently have a broken link in the installation docs, see below.
> I've tried to fix it, but on both Fedora 15 and Debian squeeze the
> docs generated by "make html" do not match the online docs because of
> a different version of makeinfo (4.13 versus 4.8 usedfor the online
> docs).
> 
> Can anyone with makeinfo 4.8 confirm that this fixes the broken anchor?
> 
> Or should I just commit it as obvious and revert it if the regenerated
> onlinedocs aren't fixed?

Jonathan, I am a bit confused because if I use the online documentation
at http://gcc.gnu.org/install/specific.html the anchor is already of the
form "sparc-sun-solaris210", that is, without the dot, and it works just
fine.

On the other hand, looking at the source code your patch has not been
applied yet.

Since your patch makes things just more conservative and robust, let's
go ahead and apply it.  Just, if there is something I missed, please
advise. :-)


As a bit of background, sadly at one point makeinfo added transformations
for special characters to replace them by hex values weirdly encoded; 
that is the _002e you are seeing: hex 2E, the ASCII dot.

For this reason I have this in wwwdocs/bin/preprocess that takes care
of restorting dashes and asterisks (at the price of breaking links to 
external documents, since we can only fix up what is under our control):

  sed -e 's/_002d/-/g' -e 's/_002a/*/g'

We might consider adding -e 's/_002e/./g', but really, just avoiding
this altogether as your patch does, seems wiser.

Thanks,
Gerald


C++ PATCH for c++/986 (warn about temporary bound to reference in constructor)

2011-11-12 Thread Jason Merrill
My recent work on fixing lifetime extension for temporaries bound to 
references makes it trivial to add this warning.


Tested x86_64-pc-linux-gnu, applied to trunk.
commit 1db25121594ff9405adeb5bd6892d72679bf2ba1
Author: Jason Merrill 
Date:   Sat Nov 12 20:42:21 2011 -0500

	PR c++/986
	* call.c (set_up_extended_ref_temp): Warn about references
	bound to non-static reference members.
	* init.c (perform_member_init): Pass in the member.

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index dd3026d..181d9e8 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -8609,6 +8609,14 @@ set_up_extended_ref_temp (tree decl, tree expr, VEC(tree,gc) **cleanups,
   if (TREE_CODE (expr) != TARGET_EXPR)
 expr = get_target_expr (expr);
 
+  if (TREE_CODE (decl) == FIELD_DECL
+  && extra_warnings && !TREE_NO_WARNING (decl))
+{
+  warning (OPT_Wextra, "a temporary bound to %qD only persists "
+	   "until the constructor exits", decl);
+  TREE_NO_WARNING (decl) = true;
+}
+
   /* Recursively extend temps in this initializer.  */
   TARGET_EXPR_INITIAL (expr)
 = extend_ref_init_temps (decl, TARGET_EXPR_INITIAL (expr), cleanups);
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 888c151..73f2b67 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -623,7 +623,7 @@ perform_member_init (tree member, tree init)
   if (init == error_mark_node)
 	return;
   /* Use 'this' as the decl, as it has the lifetime we want.  */
-  init = extend_ref_init_temps (current_class_ptr, init, &cleanups);
+  init = extend_ref_init_temps (member, init, &cleanups);
   if (TREE_CODE (type) == ARRAY_TYPE
 	  && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (type)))
 	init = build_vec_init_expr (type, init, tf_warning_or_error);
diff --git a/gcc/testsuite/g++.dg/warn/ref-temp1.C b/gcc/testsuite/g++.dg/warn/ref-temp1.C
new file mode 100644
index 000..26f1ca5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/ref-temp1.C
@@ -0,0 +1,11 @@
+// PR c++/986
+// { dg-options "-Wall -Wextra" }
+
+struct X { X (int); };
+
+struct Y {
+  Y ();
+  const X &x;			// note the ampersand
+};
+
+Y::Y () : x(1) {}		// { dg-warning "temporary" }