[Bug middle-end/79756] [5/6/7 Regression] ICE in execute_todo, at passes.c:2011

2017-03-02 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79756

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #6 from Richard Biener  ---
Ok, testing the patch then.

[Bug middle-end/79756] [5/6/7 Regression] ICE in execute_todo, at passes.c:2011

2017-03-01 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79756

--- Comment #5 from joseph at codesourcery dot com  ---
On Wed, 1 Mar 2017, rguenth at gcc dot gnu.org wrote:

> but note that convert_vector_to_array_for_subscript will return
> VIEW_CONVERT_EXPR  (MAYBE_CONST (...)) then.  Maybe proper
> operation is to instead return

Returning that is fine.  The following principles apply:

* Anything inside a C_MAYBE_CONST_EXPR must already have been fully 
folded.

* Anything wrapped around a C_MAYBE_CONST_EXPR must be handled in 
c_fully_fold_internal with recursion to its operands, to avoid a 
C_MAYBE_CONST_EXPR ending up nested inside the output of 
c_fully_fold_internal.

VIEW_CONVERT_EXPR is handled in c_fully_fold_internal, so it's OK to wrap 
one around a C_MAYBE_CONST_EXPR.

[Bug middle-end/79756] [5/6/7 Regression] ICE in execute_todo, at passes.c:2011

2017-03-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79756

--- Comment #4 from Richard Biener  ---
That is, we probably lack testcases for constexpr GCC vector extension indexing
uses?

[Bug middle-end/79756] [5/6/7 Regression] ICE in execute_todo, at passes.c:2011

2017-03-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79756

Richard Biener  changed:

   What|Removed |Added

 CC||jsm28 at gcc dot gnu.org,
   ||rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener  ---
We run into convert_vector_to_array_for_subscript /
c_common_mark_addressable_vec with

<<< Unknown tree: c_maybe_const_expr

  <<< Unknown tree: compound_literal_expr
V D.1797 = {1, 0}; >>> >>>

not sure if that's intended.  But due to this we fail to mark the vector
as addressable which then results in this ICE.

Fix:

Index: gcc/c-family/c-common.c
===
--- gcc/c-family/c-common.c (revision 245780)
+++ gcc/c-family/c-common.c (working copy)
@@ -6534,6 +6534,8 @@ complete_array_type (tree *ptype, tree i
 void 
 c_common_mark_addressable_vec (tree t)
 {   
+  if (TREE_CODE (t) == C_MAYBE_CONST_EXPR)
+t = C_MAYBE_CONST_EXPR_EXPR (t);
   while (handled_component_p (t))
 t = TREE_OPERAND (t, 0);
   if (!VAR_P (t)

but note that convert_vector_to_array_for_subscript will return
VIEW_CONVERT_EXPR  (MAYBE_CONST (...)) then.  Maybe proper
operation is to instead return

MAYBE_CONST (VIEW_CONVERT_EXPR  (...))?

Or the caller (build_array_ref) was supposed to strip MAYBE_CONST and
put it back around the array-ref?

I don't understand the C_MAYBE_CONST stuff very well so leaving the actual
fix to C FE maintainers.

[Bug middle-end/79756] [5/6/7 Regression] ICE in execute_todo, at passes.c:2011

2017-02-28 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79756

--- Comment #2 from Marek Polacek  ---
Could've started with r192721.

[Bug middle-end/79756] [5/6/7 Regression] ICE in execute_todo, at passes.c:2011

2017-02-28 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79756

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Keywords||ice-on-valid-code
   Last reconfirmed||2017-02-28
  Component|c   |middle-end
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1
Summary|ICE in execute_todo, at |[5/6/7 Regression] ICE in
   |passes.c:2011   |execute_todo, at
   ||passes.c:2011
   Target Milestone|--- |5.5

--- Comment #1 from Marek Polacek  ---
Confirmed, GCC 4.7 accepts the code.