public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fixup return stmt verifier wrt DECL_BY_REFERENCE
@ 2010-07-05  8:57 Richard Guenther
  0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2010-07-05  8:57 UTC (permalink / raw)
  To: gcc-patches


Noticed by Honza.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2010-07-05  Richard Guenther  <rguenther@suse.de>

	* tree-cfg.c (verify_gimple_return): Handle DECL_BY_REFERENCE
	RESULT_DECLs properly.

Index: gcc/tree-cfg.c
===================================================================
*** gcc/tree-cfg.c	(revision 161801)
--- gcc/tree-cfg.c	(working copy)
*************** verify_gimple_return (gimple stmt)
*** 3826,3837 ****
        return true;
      }
  
!   if (!useless_type_conversion_p (restype, TREE_TYPE (op))
!       /* ???  With C++ we can have the situation that the result
! 	 decl is a reference type while the return type is an aggregate.  */
!       && !(TREE_CODE (op) == RESULT_DECL
! 	   && TREE_CODE (TREE_TYPE (op)) == REFERENCE_TYPE
! 	   && useless_type_conversion_p (restype, TREE_TYPE (TREE_TYPE (op)))))
      {
        error ("invalid conversion in return statement");
        debug_generic_stmt (restype);
--- 3846,3859 ----
        return true;
      }
  
!   if ((TREE_CODE (op) == RESULT_DECL
!        && DECL_BY_REFERENCE (op))
!       || (TREE_CODE (op) == SSA_NAME
! 	  && TREE_CODE (SSA_NAME_VAR (op)) == RESULT_DECL
! 	  && DECL_BY_REFERENCE (SSA_NAME_VAR (op))))
!     op = TREE_TYPE (op);
! 
!   if (!useless_type_conversion_p (restype, TREE_TYPE (op)))
      {
        error ("invalid conversion in return statement");
        debug_generic_stmt (restype);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-07-05  8:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-05  8:57 [PATCH] Fixup return stmt verifier wrt DECL_BY_REFERENCE Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).