re PR c++/57175 (NRVO and alignment)

2013-05-20  Marc Glisse  <marc.glisse@inria.fr>

	PR c++/57175
gcc/cp/
	* typeck.c (check_return_expr): Reverse the alignment comparison.

gcc/testsuite/
	* g++.dg/pr57175.C: New testcase.

From-SVN: r199093
This commit is contained in:
Marc Glisse 2013-05-20 09:50:54 +02:00 committed by Marc Glisse
parent e82a38701a
commit 5657d96616
4 changed files with 30 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2013-05-20 Marc Glisse <marc.glisse@inria.fr>
PR c++/57175
* typeck.c (check_return_expr): Reverse the alignment comparison.
2013-05-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/18126

View File

@ -8369,7 +8369,7 @@ check_return_expr (tree retval, bool *no_warning)
&& DECL_CONTEXT (retval) == current_function_decl
&& ! TREE_STATIC (retval)
&& ! DECL_ANON_UNION_VAR_P (retval)
&& (DECL_ALIGN (retval) >= DECL_ALIGN (result))
&& (DECL_ALIGN (retval) <= DECL_ALIGN (result))
/* The cv-unqualified type of the returned value must be the
same as the cv-unqualified return type of the
function. */

View File

@ -1,3 +1,8 @@
2013-05-20 Marc Glisse <marc.glisse@inria.fr>
PR c++/57175
* g++.dg/pr57175.C: New testcase.
2013-05-17 Easwaran Raman <eraman@google.com>
* gcc.dg/tree-ssa/reassoc-28.c: New testcase.

View File

@ -0,0 +1,19 @@
/* { dg-do compile } */
/* { dg-options "-std=c++11" } */
extern "C" void do_not_remove ();
struct A
{
A () { }
A (A const&) { do_not_remove (); }
};
A
f ()
{
alignas (2 * alignof (A)) A x;
return x;
}
/* { dg-final { scan-assembler "do_not_remove" } } */