[Bug tree-optimization/65002] [5 Regression] ICE: Segmentation fault

2015-02-13 Thread ienkovich at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65002

--- Comment #8 from ienkovich at gcc dot gnu.org ---
Author: ienkovich
Date: Fri Feb 13 09:44:07 2015
New Revision: 220679

URL: https://gcc.gnu.org/viewcvs?rev=220679root=gccview=rev
Log:
gcc/

PR tree-optimization/65002
* tree-cfg.c (pass_data_fixup_cfg): Don't update
SSA on start.
* tree-sra.c (some_callers_have_no_vuse_p): New.
(ipa_early_sra): Reject functions whose callers
assume function is read only.

gcc/testsuite/

PR tree-optimization/65002
* gcc.dg/pr65002.C: New.


Added:
trunk/gcc/testsuite/gcc.dg/pr65002.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-cfg.c
trunk/gcc/tree-sra.c


[Bug tree-optimization/65002] [5 Regression] ICE: Segmentation fault

2015-02-13 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65002

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Jakub Jelinek jakub at gcc dot gnu.org ---
Fixed.


[Bug tree-optimization/65002] [5 Regression] ICE: Segmentation fault

2015-02-11 Thread enkovich.gnu at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65002

--- Comment #6 from Ilya Enkovich enkovich.gnu at gmail dot com ---
Is this actually an ICE on valid code?  'const' attribute seems incorrect here
similar to what we had in PR64353.

The problem comes from SSA inconsistency caused by the wrong attribute. 
Probably just ignore such cases in SRA as was previously proposed for PR64353?

Here is a possible patch (SSA update at fixup_cfg start may be removed then):

diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index ad9584e..7f78e68 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -4890,6 +4890,20 @@ some_callers_have_mismatched_arguments_p (struct
cgraph_node *node,
   return false;
 }

+/* Return false if all callers have vuse attached to a call statement.  */
+
+static bool
+some_callers_have_no_vuse_p (struct cgraph_node *node,
+void *data ATTRIBUTE_UNUSED)
+{
+  struct cgraph_edge *cs;
+  for (cs = node-callers; cs; cs = cs-next_caller)
+if (!cs-call_stmt || !gimple_vuse (cs-call_stmt))
+  return true;
+
+  return false;
+}
+
 /* Convert all callers of NODE.  */

 static bool
@@ -5116,6 +5130,15 @@ ipa_early_sra (void)
   goto simple_out;
 }

+  if (node-call_for_symbol_thunks_and_aliases
+   (some_callers_have_no_vuse_p, NULL, true))
+{
+  if (dump_file)
+   fprintf (dump_file, There are callers with no VUSE attached 
+to a call stmt.\n);
+  goto simple_out;
+}
+
   bb_dereferences = XCNEWVEC (HOST_WIDE_INT,
 func_param_count
 * last_basic_block_for_fn (cfun));


[Bug tree-optimization/65002] [5 Regression] ICE: Segmentation fault

2015-02-11 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65002

--- Comment #7 from Jakub Jelinek jakub at gcc dot gnu.org ---
Sure, the __attribute__((const)) looks very much wrong to me, as it returns
what the reference points, it necessarily reads memory and therefore is at most
pure, but certainly not const.

But, we must not ICE even on invalid or questionable code.  And misplaced const
attribute isn't something we should hard error on, perhaps warn (I think there
is some PR about that and it is definitely non-trivial).


[Bug tree-optimization/65002] [5 Regression] ICE: Segmentation fault

2015-02-10 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65002

--- Comment #5 from Jakub Jelinek jakub at gcc dot gnu.org ---
Seems estimate_function_body_sizes, in particular the ipa_load_from_parm_agg,
assumes that the function has SSA form properly updated, but since the bounded
pointers stuff changes that is not necessarily true.  Normally that is fixed up
now during fixup_cfg pass, but this call happens before that.
Perhaps we need to update ssa form for the function if it hasn't been updated
yet before we call these?


[Bug tree-optimization/65002] [5 Regression] ICE: Segmentation fault

2015-02-10 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65002

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-02-10
 CC||jamborm at gcc dot gnu.org
  Component|c++ |tree-optimization
   Target Milestone|--- |5.0
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener rguenth at gcc dot gnu.org ---
Confirmed.

 ./cc1plus  -quiet t.ii -O2
t.ii: In member function 'virtual int B::m_fn1(float) const':
t.ii:22:1: internal compiler error: tree check: expected ssa_name, have
var_decl in walk_aliased_vdefs_1, at tree-ssa-alias.c:2772
 }
 ^
0x12ae851 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
/space/rguenther/src/svn/trunk/gcc/tree.c:9290
0x6d9331 tree_check(tree_node*, char const*, int, char const*, tree_code)
/space/rguenther/src/svn/trunk/gcc/tree.h:2846
0x10d8eb1 walk_aliased_vdefs_1
/space/rguenther/src/svn/trunk/gcc/tree-ssa-alias.c:2772
0x10d90bc walk_aliased_vdefs(ao_ref*, tree_node*, bool (*)(ao_ref*, tree_node*,
void*), void*, bitmap_head**, bool*)
/space/rguenther/src/svn/trunk/gcc/tree-ssa-alias.c:2824
0xd70695 parm_preserved_before_stmt_p
/space/rguenther/src/svn/trunk/gcc/ipa-prop.c:937
0xd70ab9 ipa_load_from_parm_agg_1
/space/rguenther/src/svn/trunk/gcc/ipa-prop.c:1072
0xd70dbe ipa_load_from_parm_agg(ipa_node_params*, gimple_statement_base*,
tree_node*, int*, long*, bool*)
/space/rguenther/src/svn/trunk/gcc/ipa-prop.c:1135
0xd5aa69 unmodified_parm_or_parm_agg_item
/space/rguenther/src/svn/trunk/gcc/ipa-inline-analysis.c:1617
0xd5c43e will_be_nonconstant_predicate
/space/rguenther/src/svn/trunk/gcc/ipa-inline-analysis.c:2078
0xd5e529 estimate_function_body_sizes
/space/rguenther/src/svn/trunk/gcc/ipa-inline-analysis.c:2697
0xd5f6d5 compute_inline_parameters(cgraph_node*, bool)
/space/rguenther/src/svn/trunk/gcc/ipa-inline-analysis.c:2950
0x10c4cf4 convert_callers_for_node
/space/rguenther/src/svn/trunk/gcc/tree-sra.c:4922
0xaabf36 cgraph_node::call_for_symbol_thunks_and_aliases(bool (*)(cgraph_node*,
void*), void*, bool, bool)
/space/rguenther/src/svn/trunk/gcc/cgraph.c:2203
0x10c4d66 convert_callers
/space/rguenther/src/svn/trunk/gcc/tree-sra.c:4937
0x10c4fc1 modify_function
/space/rguenther/src/svn/trunk/gcc/tree-sra.c:4993
0x10c55ef ipa_early_sra
/space/rguenther/src/svn/trunk/gcc/tree-sra.c:5146
0x10c5728 execute
/space/rguenther/src/svn/trunk/gcc/tree-sra.c:5193
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See http://gcc.gnu.org/bugs.html for instructions.


[Bug tree-optimization/65002] [5 Regression] ICE: Segmentation fault

2015-02-10 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65002

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek jakub at gcc dot gnu.org ---
Started with r217125.


[Bug tree-optimization/65002] [5 Regression] ICE: Segmentation fault

2015-02-10 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65002

Markus Trippelsdorf trippels at gcc dot gnu.org changed:

   What|Removed |Added

 CC||trippels at gcc dot gnu.org

--- Comment #3 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
Might be a dup a PR64597.


[Bug tree-optimization/65002] [5 Regression] ICE: Segmentation fault

2015-02-10 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65002

Markus Trippelsdorf trippels at gcc dot gnu.org changed:

   What|Removed |Added

 CC||rearnsha at gcc dot gnu.org

--- Comment #4 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
*** Bug 64597 has been marked as a duplicate of this bug. ***