This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/55081] [4.8 regression?] Non-optimized static array elements initialization
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 26 Oct 2012 14:49:20 +0000
- Subject: [Bug c++/55081] [4.8 regression?] Non-optimized static array elements initialization
- Auto-submitted: auto-generated
- References: <bug-55081-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55081
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
Target Milestone|--- |4.8.0
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-26 14:49:20 UTC ---
Works fine with -std=c++11.
In store_init we have:
/* In C++0x constant expression is a semantic, not syntactic, property.
In C++98, make sure that what we thought was a constant expression at
template definition time is still constant. */
if ((cxx_dialect >= cxx0x
|| DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl))
&& (decl_maybe_constant_var_p (decl)
|| TREE_STATIC (decl)))
but here DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) isn't set and
cxx_dialect < cxx0x for -std=c++98. Not sure what we should do here, either
just call maybe_constant_value or maybe_constant_init otherwise to fold sizeof,
or, if it is really not appropriate for C++98 as an optimization,
fold_sizeof_expr_r recursively plus fold. Jason, what do you think?