mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/82294 (Array of objects with constexpr constructors initialized from space-inefficient memory image)
PR c++/82294 PR c++/87436 * init.c (build_vec_init): Change num_initialized_elts type from int to HOST_WIDE_INT. Build a RANGE_EXPR if e needs to be repeated more than once. From-SVN: r267142
This commit is contained in:
parent
8d33eae891
commit
faa9232da3
|
|
@ -1,3 +1,11 @@
|
||||||
|
2018-12-14 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR c++/82294
|
||||||
|
PR c++/87436
|
||||||
|
* init.c (build_vec_init): Change num_initialized_elts type from int
|
||||||
|
to HOST_WIDE_INT. Build a RANGE_EXPR if e needs to be repeated more
|
||||||
|
than once.
|
||||||
|
|
||||||
2018-12-13 Marek Polacek <polacek@redhat.com>
|
2018-12-13 Marek Polacek <polacek@redhat.com>
|
||||||
|
|
||||||
PR c++/88216 - ICE with class type in non-type template parameter.
|
PR c++/88216 - ICE with class type in non-type template parameter.
|
||||||
|
|
|
||||||
|
|
@ -4104,7 +4104,7 @@ build_vec_init (tree base, tree maxindex, tree init,
|
||||||
tree compound_stmt;
|
tree compound_stmt;
|
||||||
int destroy_temps;
|
int destroy_temps;
|
||||||
tree try_block = NULL_TREE;
|
tree try_block = NULL_TREE;
|
||||||
int num_initialized_elts = 0;
|
HOST_WIDE_INT num_initialized_elts = 0;
|
||||||
bool is_global;
|
bool is_global;
|
||||||
tree obase = base;
|
tree obase = base;
|
||||||
bool xvalue = false;
|
bool xvalue = false;
|
||||||
|
|
@ -4539,10 +4539,13 @@ build_vec_init (tree base, tree maxindex, tree init,
|
||||||
|
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
int max = tree_to_shwi (maxindex)+1;
|
HOST_WIDE_INT last = tree_to_shwi (maxindex);
|
||||||
for (; num_initialized_elts < max; ++num_initialized_elts)
|
if (num_initialized_elts <= last)
|
||||||
{
|
{
|
||||||
tree field = size_int (num_initialized_elts);
|
tree field = size_int (num_initialized_elts);
|
||||||
|
if (num_initialized_elts != last)
|
||||||
|
field = build2 (RANGE_EXPR, sizetype, field,
|
||||||
|
size_int (last));
|
||||||
CONSTRUCTOR_APPEND_ELT (const_vec, field, e);
|
CONSTRUCTOR_APPEND_ELT (const_vec, field, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue