This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70634] [4.9/5/6 Regression] ICE on valid code on x86_64-linux-gnu: Segmentation fault (program cc1plus)
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 12 Apr 2016 13:56:32 +0000
- Subject: [Bug c++/70634] [4.9/5/6 Regression] ICE on valid code on x86_64-linux-gnu: Segmentation fault (program cc1plus)
- Auto-submitted: auto-generated
- References: <bug-70634-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70634
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, when value_dependent_expression is called on the VAR_DECL i,
it (since the above mentioned change) recurse on its DECL_INITIAL:
if (DECL_INITIAL (expression)
&& decl_constant_var_p (expression)
&& (TREE_CODE (DECL_INITIAL (expression)) == TREE_LIST
/* cp_finish_decl doesn't fold reference initializers. */
|| TREE_CODE (TREE_TYPE (expression)) == REFERENCE_TYPE
|| value_dependent_expression_p (DECL_INITIAL (expression))))
return true;
then when seeing the SIZEOF_EXPR in there we do:
return instantiation_dependent_expression_p (expression);
on the SIZEOF_EXPR's operand (which is VAR_DECL i), and
instantiation_dependent_r for VAR_DECL just calls value_dependent_expression
again, which closes the infinite recursion. So we need to break the recursion
somewhere, perhaps by remembering in which VAR_DECL initializers we are already
in, or by temporarily clearing the DECL_INITIALIZER of the VAR_DECLs we are
recursing into, whatever. Jason, any thoughts on this?