public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/61602] [4.10 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257
[not found] <bug-61602-4@http.gcc.gnu.org/bugzilla/>
@ 2014-06-25 8:29 ` rguenth at gcc dot gnu.org
2014-07-09 5:40 ` su at cs dot ucdavis.edu
` (9 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-25 8:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61602
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |lto
CC| |hubicka at gcc dot gnu.org
Component|lto |ipa
Target Milestone|--- |4.10.0
Summary|ICE in lto1 on |[4.10 Regression] ICE in
|x86_64-linux-gnu in |lto1 on x86_64-linux-gnu in
|ipa_single_use, at |ipa_single_use, at
|ipa.c:1257 |ipa.c:1257
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/61602] [4.10 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257
[not found] <bug-61602-4@http.gcc.gnu.org/bugzilla/>
2014-06-25 8:29 ` [Bug ipa/61602] [4.10 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257 rguenth at gcc dot gnu.org
@ 2014-07-09 5:40 ` su at cs dot ucdavis.edu
2014-07-09 8:00 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-07-09 5:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61602
--- Comment #1 from Zhendong Su <su at cs dot ucdavis.edu> ---
To help diagnose the issue, here is another test case that triggers the same
ICE without using LTO.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 4.10.0 20140708 (experimental) [trunk revision 212357] (GCC)
$
$ gcc-trunk -O1 -c small.c
small.c:9:1: internal compiler error: in ipa_single_use, at ipa.c:1255
}
^
0x81fc21 ipa_single_use
../../gcc-trunk/gcc/ipa.c:1255
0x81fc21 execute
../../gcc-trunk/gcc/ipa.c:1303
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.
$
-------------------------------------------
static int a, *b = &a, **c = &b, ***d = &c;
int
main ()
{
d = 0;
b = 0;
return 0;
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/61602] [4.10 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257
[not found] <bug-61602-4@http.gcc.gnu.org/bugzilla/>
2014-06-25 8:29 ` [Bug ipa/61602] [4.10 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257 rguenth at gcc dot gnu.org
2014-07-09 5:40 ` su at cs dot ucdavis.edu
@ 2014-07-09 8:00 ` jakub at gcc dot gnu.org
2014-08-06 0:03 ` su at cs dot ucdavis.edu
` (7 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-07-09 8:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61602
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-07-09
CC| |jakub at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r211925 (at least the #c1 testcase).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/61602] [4.10 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257
[not found] <bug-61602-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2014-07-09 8:00 ` jakub at gcc dot gnu.org
@ 2014-08-06 0:03 ` su at cs dot ucdavis.edu
2014-11-19 13:30 ` [Bug ipa/61602] [5 " tbsaunde at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-08-06 0:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61602
--- Comment #3 from Zhendong Su <su at cs dot ucdavis.edu> ---
Hi, it would be really nice if this one could be fixed very soon as it keeps
popping up during my testing. Many thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/61602] [5 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257
[not found] <bug-61602-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2014-08-06 0:03 ` su at cs dot ucdavis.edu
@ 2014-11-19 13:30 ` tbsaunde at gcc dot gnu.org
2014-11-19 13:51 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: tbsaunde at gcc dot gnu.org @ 2014-11-19 13:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61602
tbsaunde at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tbsaunde at gcc dot gnu.org
--- Comment #4 from tbsaunde at gcc dot gnu.org ---
So, during the single use pass we have 3 variables in symtab a, b and d.
a->ref_list.referring is empty so the map doesn't contain an entry for a. So
single_use_map is only { b-> main, d -> main } and we assert because
single_use_map.get(a) returns NULL.
However I'm not sure if the problem is the assert being incorrect or if
a.ref_list.referring should contain main.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/61602] [5 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257
[not found] <bug-61602-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2014-11-19 13:30 ` [Bug ipa/61602] [5 " tbsaunde at gcc dot gnu.org
@ 2014-11-19 13:51 ` rguenth at gcc dot gnu.org
2014-11-22 8:41 ` trippels at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-19 13:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61602
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Still broken - Honza?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/61602] [5 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257
[not found] <bug-61602-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2014-11-19 13:51 ` rguenth at gcc dot gnu.org
@ 2014-11-22 8:41 ` trippels at gcc dot gnu.org
2014-12-15 3:55 ` hubicka at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-11-22 8:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61602
Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |trippels at gcc dot gnu.org
--- Comment #6 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
An overnight csmith run came up with the same issue:
~ % cat crash1.i
int a;
int *b = &a, **c = &b;
int
main ()
{
int **d = &b;
*d = 0;
}
~ % gcc -O2 -flto crash2.i
lto1: internal compiler error: in ipa_single_use, at ipa.c:1299
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/61602] [5 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257
[not found] <bug-61602-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2014-11-22 8:41 ` trippels at gcc dot gnu.org
@ 2014-12-15 3:55 ` hubicka at gcc dot gnu.org
2014-12-15 4:11 ` hubicka at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-12-15 3:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61602
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |hubicka at gcc dot gnu.org
--- Comment #7 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Mine.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/61602] [5 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257
[not found] <bug-61602-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2014-12-15 3:55 ` hubicka at gcc dot gnu.org
@ 2014-12-15 4:11 ` hubicka at gcc dot gnu.org
2014-12-15 6:20 ` hubicka at gcc dot gnu.org
2014-12-15 7:08 ` hubicka at gcc dot gnu.org
10 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-12-15 4:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61602
--- Comment #8 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
OK, the problem is that the variable becomes unreachable after other variable
is declared writeonly and its constructor is killed. I am testing:
Index: ipa.c
===================================================================
--- ipa.c (revision 218730)
+++ ipa.c (working copy)
@@ -714,14 +714,18 @@ set_readonly_bit (varpool_node *vnode, v
/* Set writeonly bit and clear the initalizer, since it will not be needed.
*/
bool
-set_writeonly_bit (varpool_node *vnode, void *data ATTRIBUTE_UNUSED)
+set_writeonly_bit (varpool_node *vnode, void *data)
{
vnode->writeonly = true;
if (optimize)
{
DECL_INITIAL (vnode->decl) = NULL;
if (!vnode->alias)
- vnode->remove_all_references ();
+ {
+ if (vnode->num_references ())
+ *(bool *)data = true;
+ vnode->remove_all_references ();
+ }
}
return false;
}
@@ -739,15 +743,18 @@ clear_addressable_bit (varpool_node *vno
/* Discover variables that have no longer address taken or that are read only
and update their flags.
+ Return true when unreachable symbol removan should be done.
+
FIXME: This can not be done in between gimplify and omp_expand since
readonly flag plays role on what is shared and what is not. Currently we
do
this transformation as part of whole program visibility and re-do at
ipa-reference pass (to take into account clonning), but it would
make sense to do it before early optimizations. */
-void
+bool
ipa_discover_readonly_nonaddressable_vars (void)
{
+ bool remove_p = false;
varpool_node *vnode;
if (dump_file)
fprintf (dump_file, "Clearing variable flags:");
@@ -762,14 +769,16 @@ ipa_discover_readonly_nonaddressable_var
bool read = false;
bool explicit_refs = true;
- process_references (vnode, &written, &address_taken, &read,
&explicit_refs);
+ process_references (vnode, &written, &address_taken, &read,
+ &explicit_refs);
if (!explicit_refs)
continue;
if (!address_taken)
{
if (TREE_ADDRESSABLE (vnode->decl) && dump_file)
fprintf (dump_file, " %s (non-addressable)", vnode->name ());
- vnode->call_for_node_and_aliases (clear_addressable_bit, NULL,
true);
+ vnode->call_for_node_and_aliases (clear_addressable_bit, NULL,
+ true);
}
if (!address_taken && !written
/* Making variable in explicit section readonly can cause section
@@ -785,11 +794,13 @@ ipa_discover_readonly_nonaddressable_var
{
if (dump_file)
fprintf (dump_file, " %s (write-only)", vnode->name ());
- vnode->call_for_node_and_aliases (set_writeonly_bit, NULL, true);
+ vnode->call_for_node_and_aliases (set_writeonly_bit, &remove_p,
+ true);
}
}
if (dump_file)
fprintf (dump_file, "\n");
+ return remove_p;
}
/* Free inline summary. */
Index: cgraph.h
===================================================================
--- cgraph.h (revision 218726)
+++ cgraph.h (working copy)
@@ -2188,7 +2188,7 @@ void record_references_in_initializer (t
/* In ipa.c */
void cgraph_build_static_cdtor (char which, tree body, int priority);
-void ipa_discover_readonly_nonaddressable_vars (void);
+bool ipa_discover_readonly_nonaddressable_vars (void);
/* In varpool.c */
tree ctor_for_folding (tree);
Index: testsuite/gcc.dg/torture/pr61602.c
===================================================================
--- testsuite/gcc.dg/torture/pr61602.c (revision 0)
+++ testsuite/gcc.dg/torture/pr61602.c (revision 0)
@@ -0,0 +1,8 @@
+int a;
+int *b = &a, **c = &b;
+int
+main ()
+{
+ int **d = &b;
+ *d = 0;
+}
Index: ipa-reference.c
===================================================================
--- ipa-reference.c (revision 218726)
+++ ipa-reference.c (working copy)
@@ -676,11 +676,12 @@ propagate (void)
XCNEWVEC (struct cgraph_node *, symtab->cgraph_count);
int order_pos;
int i;
+ bool remove_p;
if (dump_file)
cgraph_node::dump_cgraph (dump_file);
- ipa_discover_readonly_nonaddressable_vars ();
+ remove_p = ipa_discover_readonly_nonaddressable_vars ();
generate_summary ();
/* Propagate the local information through the call graph to produce
@@ -867,7 +868,7 @@ propagate (void)
if (dump_file)
splay_tree_delete (reference_vars_to_consider);
reference_vars_to_consider = NULL;
- return 0;
+ return remove_p ? TODO_remove_functions : 0;
}
/* Return true if we need to write summary of NODE. */
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/61602] [5 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257
[not found] <bug-61602-4@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2014-12-15 4:11 ` hubicka at gcc dot gnu.org
@ 2014-12-15 6:20 ` hubicka at gcc dot gnu.org
2014-12-15 7:08 ` hubicka at gcc dot gnu.org
10 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-12-15 6:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61602
--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Author: hubicka
Date: Mon Dec 15 06:19:51 2014
New Revision: 218731
URL: https://gcc.gnu.org/viewcvs?rev=218731&root=gcc&view=rev
Log:
PR ipa/61602
* gcc.dg/torture/pr61602.c: New testcase.
* cgraph.h (ipa_discover_readonly_nonaddressable_vars): Return bool.
* ipa.c (set_writeonly_bit): Track if reference was removed.
(ipa_discover_readonly_nonaddressable_vars): Return true if any
references was removed.
* ipa-reference.c (propagate): Return TODO_remove_functions if
reference was removed.
Added:
trunk/gcc/testsuite/gcc.dg/torture/pr61602.c
Modified:
trunk/gcc/cgraph.h
trunk/gcc/ipa-reference.c
trunk/gcc/ipa.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ipa/61602] [5 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257
[not found] <bug-61602-4@http.gcc.gnu.org/bugzilla/>
` (9 preceding siblings ...)
2014-12-15 6:20 ` hubicka at gcc dot gnu.org
@ 2014-12-15 7:08 ` hubicka at gcc dot gnu.org
10 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-12-15 7:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61602
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-12-15 7:08 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-61602-4@http.gcc.gnu.org/bugzilla/>
2014-06-25 8:29 ` [Bug ipa/61602] [4.10 Regression] ICE in lto1 on x86_64-linux-gnu in ipa_single_use, at ipa.c:1257 rguenth at gcc dot gnu.org
2014-07-09 5:40 ` su at cs dot ucdavis.edu
2014-07-09 8:00 ` jakub at gcc dot gnu.org
2014-08-06 0:03 ` su at cs dot ucdavis.edu
2014-11-19 13:30 ` [Bug ipa/61602] [5 " tbsaunde at gcc dot gnu.org
2014-11-19 13:51 ` rguenth at gcc dot gnu.org
2014-11-22 8:41 ` trippels at gcc dot gnu.org
2014-12-15 3:55 ` hubicka at gcc dot gnu.org
2014-12-15 4:11 ` hubicka at gcc dot gnu.org
2014-12-15 6:20 ` hubicka at gcc dot gnu.org
2014-12-15 7:08 ` hubicka at gcc dot gnu.org
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).