public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/57649] [4.7 Regression] ICE in set_is_used
2013-06-19 9:33 [Bug middle-end/57649] New: [4.7 Regression] ICE in set_is_used jakub at gcc dot gnu.org
@ 2013-06-19 9:33 ` jakub at gcc dot gnu.org
2013-06-19 9:39 ` ebotcazou at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-06-19 9:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57649
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/57649] New: [4.7 Regression] ICE in set_is_used
@ 2013-06-19 9:33 jakub at gcc dot gnu.org
2013-06-19 9:33 ` [Bug middle-end/57649] " jakub at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-06-19 9:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57649
Bug ID: 57649
Summary: [4.7 Regression] ICE in set_is_used
Product: gcc
Version: 4.7.3
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
CC: matz at gcc dot gnu.org
void bar (const char *);
void
foo ()
{
static const char *s = __PRETTY_FUNCTION__;
struct T { T () { bar (s); } } t;
}
ICEs at -O2 starting with r179618 on 4.7 branch, went away with r187719 for
4.8+.
Similarly C -O2:
void bar (const char *);
void
foo (void)
{
static const char *s = __PRETTY_FUNCTION__;
auto void baz (void) { bar (s); }
baz ();
}
The problem is that the s variable isn't referenced in foo during
*referenced_vars pass, is referenced in another function (nested or local class
method), but at that point the DECL_INITIAL of the var isn't marked, and later
on when the nested/local class method is inlined nothing marks the
DECL_INITIAL.
Perhaps the inliner should somewhere go through all gimple_referenced_vars of
the callee and for each TREE_STATIC var with DECL_CONTEXT of the caller just
call add_referenced_var?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/57649] [4.7 Regression] ICE in set_is_used
2013-06-19 9:33 [Bug middle-end/57649] New: [4.7 Regression] ICE in set_is_used jakub at gcc dot gnu.org
2013-06-19 9:33 ` [Bug middle-end/57649] " jakub at gcc dot gnu.org
@ 2013-06-19 9:39 ` ebotcazou at gcc dot gnu.org
2013-06-19 9:40 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2013-06-19 9:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57649
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-06-19
CC| |ebotcazou at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
We have this patchlet in our 4.7 tree:
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -590,10 +590,13 @@ add_referenced_var (tree var)
/* Scan DECL_INITIAL for pointer variables as they may contain
address arithmetic referencing the address of other
variables. As we are only interested in directly referenced
- globals or referenced locals restrict this to initializers
- than can refer to local variables. */
+ globals or referenced locals, restrict this to initializers
+ than can refer to local variables. But we need to do it for
+ initializers of global variables declared in parent functions
+ lest these variables aren't referenced anywhere else. */
if (DECL_INITIAL (var)
- && DECL_CONTEXT (var) == current_function_decl)
+ && (DECL_CONTEXT (var) == current_function_decl
+ || (!DECL_FILE_SCOPE_P (var) && is_global_var (var))))
walk_tree (&DECL_INITIAL (var), find_vars_r, NULL, 0);
return true;
* tree-dfa.c (add_referenced_var): Find variables referenced in the
initializers of global variables declared in parent functions.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/57649] [4.7 Regression] ICE in set_is_used
2013-06-19 9:33 [Bug middle-end/57649] New: [4.7 Regression] ICE in set_is_used jakub at gcc dot gnu.org
2013-06-19 9:33 ` [Bug middle-end/57649] " jakub at gcc dot gnu.org
2013-06-19 9:39 ` ebotcazou at gcc dot gnu.org
@ 2013-06-19 9:40 ` jakub at gcc dot gnu.org
2013-06-19 9:47 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-06-19 9:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57649
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Actually, it ICEs even without inlining, so guess the issue is just that we
have a local static var that is referenced by some other function (thus used)
and we don't mark its DECL_INITIAL as referenced.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/57649] [4.7 Regression] ICE in set_is_used
2013-06-19 9:33 [Bug middle-end/57649] New: [4.7 Regression] ICE in set_is_used jakub at gcc dot gnu.org
` (2 preceding siblings ...)
2013-06-19 9:40 ` jakub at gcc dot gnu.org
@ 2013-06-19 9:47 ` jakub at gcc dot gnu.org
2013-06-19 10:42 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-06-19 9:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57649
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Other testcases without __PRETTY_FUNCTION__:
void bar (const char *);
void
foo (void)
{
static const char r[] = "abc";
static const char *s = t;
auto void baz (void) { bar (s); }
baz ();
}
void bar (const char *);
void
foo ()
{
static const char r[] = "abc";
static const char *s = r;
struct T { T () { bar (s); } } t;
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/57649] [4.7 Regression] ICE in set_is_used
2013-06-19 9:33 [Bug middle-end/57649] New: [4.7 Regression] ICE in set_is_used jakub at gcc dot gnu.org
` (3 preceding siblings ...)
2013-06-19 9:47 ` jakub at gcc dot gnu.org
@ 2013-06-19 10:42 ` rguenth at gcc dot gnu.org
2013-06-19 10:46 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-06-19 10:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57649
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
How about backporting r187719? I don't remember whether there are any
dependencies here, but ... it seems it's the first patch in the series
to cleanup all this stuff.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/57649] [4.7 Regression] ICE in set_is_used
2013-06-19 9:33 [Bug middle-end/57649] New: [4.7 Regression] ICE in set_is_used jakub at gcc dot gnu.org
` (4 preceding siblings ...)
2013-06-19 10:42 ` rguenth at gcc dot gnu.org
@ 2013-06-19 10:46 ` jakub at gcc dot gnu.org
2013-06-19 10:52 ` rguenth at gcc dot gnu.org
2014-06-12 13:28 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-06-19 10:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57649
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Isn't it going to cause problems if we fold some accesses to the static var
using the expressions in the initializer, we'd end up with not having the vars
referenced?
If backporting anything, my preference would be to actually backport just the
tree-ssa-live.c change and not the tree-dfa.c change.
Or Eric's patch.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/57649] [4.7 Regression] ICE in set_is_used
2013-06-19 9:33 [Bug middle-end/57649] New: [4.7 Regression] ICE in set_is_used jakub at gcc dot gnu.org
` (5 preceding siblings ...)
2013-06-19 10:46 ` jakub at gcc dot gnu.org
@ 2013-06-19 10:52 ` rguenth at gcc dot gnu.org
2014-06-12 13:28 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-06-19 10:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57649
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #5)
> Isn't it going to cause problems if we fold some accesses to the static var
> using the expressions in the initializer, we'd end up with not having the
> vars referenced?
Well - we are carefully trying to add them at the point we fold ...
> If backporting anything, my preference would be to actually backport just
> the tree-ssa-live.c change and not the tree-dfa.c change.
> Or Eric's patch.
Backporting just the tree-ssa-live.c change also works for me.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/57649] [4.7 Regression] ICE in set_is_used
2013-06-19 9:33 [Bug middle-end/57649] New: [4.7 Regression] ICE in set_is_used jakub at gcc dot gnu.org
` (6 preceding siblings ...)
2013-06-19 10:52 ` rguenth at gcc dot gnu.org
@ 2014-06-12 13:28 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-12 13:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57649
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|4.7.4 |4.8.0
Known to fail| |4.7.4
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in 4.8.0.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-06-12 13:28 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-19 9:33 [Bug middle-end/57649] New: [4.7 Regression] ICE in set_is_used jakub at gcc dot gnu.org
2013-06-19 9:33 ` [Bug middle-end/57649] " jakub at gcc dot gnu.org
2013-06-19 9:39 ` ebotcazou at gcc dot gnu.org
2013-06-19 9:40 ` jakub at gcc dot gnu.org
2013-06-19 9:47 ` jakub at gcc dot gnu.org
2013-06-19 10:42 ` rguenth at gcc dot gnu.org
2013-06-19 10:46 ` jakub at gcc dot gnu.org
2013-06-19 10:52 ` rguenth at gcc dot gnu.org
2014-06-12 13:28 ` rguenth 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).