This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/60855] ICE provoked by a lambda using the sizeof a captured stack-allocated array


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-04-16
     Ever confirmed|0                           |1
      Known to fail|4.8.1                       |4.7.2, 4.8.2

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  We trap on

9446          /* Variables inherited from containing functions should have
9447             been lowered by this point.  */
9448          context = decl_function_context (exp);
9449          gcc_assert (SCOPE_FILE_SCOPE_P (context)
9450                      || context == current_function_decl
9451                      || TREE_STATIC (exp)
9452                      || DECL_EXTERNAL (exp)
9453                      /* ??? C++ creates functions that are not
TREE_STATIC.  */
(gdb) l
9454                      || TREE_CODE (exp) == FUNCTION_DECL);

where the context is 'main' but cfun is 'operator()' and 'exp' is the
SSA_NAME_VAR of an SSA name.

Index: gcc/tree-ssa.c
===================================================================
--- gcc/tree-ssa.c      (revision 209423)
+++ gcc/tree-ssa.c      (working copy)
@@ -686,6 +686,13 @@ verify_ssa_name (tree ssa_name, bool is_
       return true;
     }

+  if (SSA_NAME_VAR (ssa_name) != NULL_TREE
+      && decl_function_context (SSA_NAME_VAR (ssa_name)) != cfun->decl)
+    {
+      error ("SSA name for variable not belonging to the current function");
+      return true;
+    }
+
   if (is_virtual && !virtual_operand_p (ssa_name))
     {
       error ("found a virtual definition for a GIMPLE register");

should catch the root cause.  Well, it's already bogus at into-SSA time.

Index: gcc/tree-cfg.c
===================================================================
--- gcc/tree-cfg.c      (revision 209423)
+++ gcc/tree-cfg.c      (working copy)
@@ -2972,6 +2989,15 @@ verify_expr (tree *tp, int *walk_subtree
        }
       break;

+    case VAR_DECL:
+      if (decl_function_context (t)
+         && decl_function_context (t) != cfun->decl)
+       {
+         error ("invalid context of variable");
+         return t;
+       }
+      break;
+
     default:
       break;
     }

makes it error after CFG construction.  So it must be an error during
un-nesting (which is interwinded with gimplification).

Confirmed, not a regression.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]