https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94775
Bug ID: 94775
Summary: [8/9/10 Regression] ICE in strip_typedefs, at
cp/tree.c:1734
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zhroma at gcc dot gnu.org
Target Milestone: ---
At least ubuntu v8.3.0 and trunk v10.0.1 (20200402) ICE on Linux x86-64 with
the following reduced testcase while emitting diagnostic:
$ cat bug.ii
template <typename> using a = int;
template <bool, typename, typename> using b = int;
typedef char d;
template <long> using e = int;
template <int f, int q> struct h { using i = b<q, a<e<f>>, e<f>>; };
template <long f, bool g> using j = typename h<f, g>::i;
long ab, k, aj;
const d l[]{};
class m {
public:
m(int);
};
class n {
m ad() const;
template <class ae> void o(long) const {
using c __attribute__((aligned(1))) = const ae;
}
long p;
template <class, class>
auto s(unsigned long, unsigned long, unsigned long, unsigned long) const;
template <bool = false> auto q(unsigned long, unsigned long) const;
};
template <class, class>
auto n::s(unsigned long, unsigned long, unsigned long, unsigned long t) const {
o<d>(p);
return t;
}
template <bool g> auto n::q(unsigned long p1, unsigned long p2) const {
using r = j<4, false>;
using ai = j<4, g>;
return s<ai, r>(ab, k, p1, p2);
}
m n::ad() const {
long f(l[aj]);
m(q(8, f));
}
$ g++ -std=c++17 -Wall -O2 -c -fsanitize=address bug.ii
bug.ii: In member function 'void n::o(long int) const':
bug.ii:16:11: warning: typedef 'using c = const ae' locally defined but not
used [-Wunused-local-typedefs]
16 | using c __attribute__((aligned(1))) = const ae;
| ^
bug.ii: In member function 'm n::ad() const':
bug.ii:36:1: warning: no return statement in function returning non-void
[-Wreturn-type]
36 | }
| ^
'
during GIMPLE pass: vrp
in strip_typedefs, at cp/tree.c:1734
33 | m n::ad() const {
| ^
0x9b4eeb strip_typedefs(tree_node*, bool*, unsigned int)
...
7.5.0 seems to work fine.