public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix ICE during nested functions lowering
@ 2011-04-21 15:05 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2011-04-21 15:05 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]

The attached testcase triggers an ICE during nested functions lowering, a 
regression present on the mainline and 4.6 branch.  The middle-end is trying 
to create an object which must be created by the front-end:

  /* If the type is of variable size or a type which must be created by the
     frontend, something is wrong.  Note that we explicitly allow
     incomplete types here, since we create them ourselves here.  */
  gcc_assert (!TREE_ADDRESSABLE (type));

This is a fallout of tuplification.  It turns out that the real issue was fixed 
back in July by Richard:

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

	* tree-ssa-propagate.h (valid_gimple_call_p): Remove.
	* tree-ssa-propagate.c (valid_gimple_call_p): Make static.  Fix.
	* gimple.h (is_gimple_operand): Remove.
	* gimple.c (is_gimple_operand): Likewise.
	(walk_gimple_op): Fix wi->val_only setting for calls.
	* tree-cfg.c (verify_gimple_call): Fix argument validation.
	* tree-profile.c (tree_gen_ic_func_profiler): Do not create
	invalid gimple calls.

but the walk_gimple_op change contains a couple of oversights.

Bootstrapped/regtested on x86_64-suse-linux, applied on the mainline and 4.6 
branch as obvious.


2011-04-21  Eric Botcazou  <ebotcazou@adacore.com>

	* gimple.c (walk_gimple_op) <GIMPLE_CALL>: Fix couple of oversights.


2011-04-21  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/volatile5.adb: New test.
	* gnat.dg/volatile5_pkg.ads: New helper.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 877 bytes --]

Index: gimple.c
===================================================================
--- gimple.c	(revision 172811)
+++ gimple.c	(working copy)
@@ -1464,7 +1464,8 @@ walk_gimple_op (gimple stmt, walk_tree_f
       for (i = 0; i < gimple_call_num_args (stmt); i++)
 	{
 	  if (wi)
-	    wi->val_only = is_gimple_reg_type (gimple_call_arg (stmt, i));
+	    wi->val_only
+	      = is_gimple_reg_type (TREE_TYPE (gimple_call_arg (stmt, i)));
 	  ret = walk_tree (gimple_call_arg_ptr (stmt, i), callback_op, wi,
 			   pset);
 	  if (ret)
@@ -1476,7 +1477,8 @@ walk_gimple_op (gimple stmt, walk_tree_f
 	  if (wi)
 	    {
 	      wi->is_lhs = true;
-	      wi->val_only = is_gimple_reg_type (gimple_call_lhs (stmt));
+	      wi->val_only
+		= is_gimple_reg_type (TREE_TYPE (gimple_call_lhs (stmt)));
 	    }
 
 	  ret = walk_tree (gimple_call_lhs_ptr (stmt), callback_op, wi, pset);

[-- Attachment #3: volatile5.adb --]
[-- Type: text/x-adasrc, Size: 172 bytes --]

-- { dg-do compile }

with Volatile5_Pkg; use Volatile5_Pkg;

procedure Volatile5 is

   A : Rec;

   procedure Proc is
   begin
      A := F;
   end;

begin
   Proc;
end;

[-- Attachment #4: volatile5_pkg.ads --]
[-- Type: text/x-adasrc, Size: 156 bytes --]

package Volatile5_Pkg is

   type Rec is record
      I : Integer;
   end record;
   pragma Volatile(Rec);

  function F return Rec;

end Volatile5_Pkg;
-- 

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

only message in thread, other threads:[~2011-04-21 14:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-21 15:05 Fix ICE during nested functions lowering Eric Botcazou

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).