[Bug c++/53094] constexpr vector subscripting

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 3 22:31:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53094

--- Comment #13 from Marc Glisse <glisse at gcc dot gnu.org> 2012-12-03 22:30:53 UTC ---
typedef float __attribute__( ( vector_size( 4*sizeof(float) ) ) ) V4;
constexpr V4 v = {1,1,1,0};
constexpr V4 r = v[0]+v;

is enough to reproduce your latest ICE. cxx_eval_bare_aggregate doesn't check
that ce->index is not NULL for the constructor elements, and tests its
TREE_CODE, which segfaults. Easiest workaround is to test if ce->index is zero
and in that case skip the COMPONENT_REF and NOP_EXPR tests. Which brings you
back to a regular "not a constant expression" error message.



More information about the Gcc-bugs mailing list