https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92674
Bug ID: 92674
Summary: [8/9/10 Regression] ICE in gimple_phi_arg, at
gimple.h:4406 since r240291
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
Target Milestone: ---
I see the following ICE, it's reduced from icewm package:
$ cat 1.ii
class YWMApp {
public:
YWMApp(const char *);
};
class YIcon {
public:
static int getIcon(const char *);
};
YWMApp::YWMApp(const char *) { YIcon::getIcon(""); }
char main_overrideTheme;
main() { YWMApp app(&main_overrideTheme); }
$ cat 2.ii
class mstring {
public:
int compareTo(const mstring &) const;
};
int mstring::compareTo(const mstring &) const {}
class refcounted {
public:
virtual void __destroy();
};
class YIcon;
template < class > class ref {
YIcon *ptr;
public:
~ref() { ptr->__destroy(); }
};
class upath {
public:
upath(const char *);
mstring path() { return fPath; }
mstring fPath;
};
int cacheFind_r;
class YIcon : public refcounted {
ref< YIcon > getIcon(const char *);
int cacheFind(upath);
public:
ref< YIcon > *getItemPtr();
} iconCache;
int YIcon::cacheFind(upath name) {
ref< YIcon > __trans_tmp_2;
while (cacheFind_r) {
{
__trans_tmp_2 = *getItemPtr();
}
ref< YIcon > found = __trans_tmp_2;
mstring __trans_tmp_1;
name.path().compareTo(__trans_tmp_1);
}
}
ref< YIcon > YIcon::getIcon(const char *name) { cacheFind(name); }
$ g++ -O2 -fPIC 1.ii 2.ii -flto=16
1.ii:11:1: warning: ISO C++ forbids declaration of ‘main’ with no type
[-Wreturn-type]
11 | main() { YWMApp app(&main_overrideTheme); }
| ^~~~
2.ii: In member function ‘int mstring::compareTo(const mstring&) const’:
2.ii:5:48: warning: no return statement in function returning non-void
[-Wreturn-type]
5 | int mstring::compareTo(const mstring &) const {}
| ^
2.ii: In destructor ‘ref< <template-parameter-1-1> >::~ref()’:
2.ii:16:15: warning: invalid use of incomplete type ‘class YIcon’
16 | ~ref() { ptr->__destroy(); }
| ^~
2.ii:11:7: note: forward declaration of ‘class YIcon’
11 | class YIcon;
| ^~~~~
2.ii: In member function ‘int YIcon::cacheFind(upath)’:
2.ii:42:1: warning: no return statement in function returning non-void
[-Wreturn-type]
42 | }
| ^
2.ii: In member function ‘ref<YIcon> YIcon::getIcon(const char*)’:
2.ii:43:66: warning: no return statement in function returning non-void
[-Wreturn-type]
43 | ref< YIcon > YIcon::getIcon(const char *name) { cacheFind(name); }
| ^
1.ii:7:14: warning: ‘getIcon’ violates the C++ One Definition Rule [-Wodr]
7 | static int getIcon(const char *);
| ^
2.ii:43:14: note: ‘getIcon’ was previously declared here
43 | ref< YIcon > YIcon::getIcon(const char *name) { cacheFind(name); }
| ^
2.ii:43:14: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is
used
during IPA pass: inline
2.ii: In function ‘getIcon.constprop.isra’:
2.ii:43:14: internal compiler error: in gimple_phi_arg, at gimple.h:4406
43 | ref< YIcon > YIcon::getIcon(const char *name) { cacheFind(name); }
| ^
0x639113 gimple_phi_arg
/home/marxin/Programming/gcc/gcc/gimple.h:4406
0x639113 gimple_phi_arg
/home/marxin/Programming/gcc/gcc/gimple.h:4414
0x639113 gimple_phi_arg_def
/home/marxin/Programming/gcc/gcc/gimple.h:4457
0x639113 walk_ssa_copies
/home/marxin/Programming/gcc/gcc/ipa-polymorphic-call.c:835
0xac7f71 ipa_polymorphic_call_context::ipa_polymorphic_call_context(tree_node*,
tree_node*, gimple*, tree_node**)
/home/marxin/Programming/gcc/gcc/ipa-polymorphic-call.c:898
0xa00ed6 possible_polymorphic_call_targets(tree_node*, gimple*, bool*, void**)
/home/marxin/Programming/gcc/gcc/ipa-utils.h:134
0xa00ed6 gimple_fold_call
/home/marxin/Programming/gcc/gcc/gimple-fold.c:4348
0xa0176b fold_stmt_1
/home/marxin/Programming/gcc/gcc/gimple-fold.c:5112
0xd5dea6 fold_marked_statements
/home/marxin/Programming/gcc/gcc/tree-inline.c:5288
0xd6cbd1 optimize_inline_calls(tree_node*)
/home/marxin/Programming/gcc/gcc/tree-inline.c:5369
0x15fac04 inline_transform(cgraph_node*)
/home/marxin/Programming/gcc/gcc/ipa-inline-transform.c:720
0xc0eeaa execute_one_ipa_transform_pass
/home/marxin/Programming/gcc/gcc/passes.c:2231
0xc0eeaa execute_all_ipa_transforms(bool)
/home/marxin/Programming/gcc/gcc/passes.c:2270
0x897561 cgraph_node::expand()
/home/marxin/Programming/gcc/gcc/cgraphunit.c:2189
0x89853b expand_all_functions
/home/marxin/Programming/gcc/gcc/cgraphunit.c:2335
0x89853b symbol_table::compile()
/home/marxin/Programming/gcc/gcc/cgraphunit.c:2685
0x7f49e9 lto_main()
/home/marxin/Programming/gcc/gcc/lto/lto.c:658