This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/66618] Failure to diagnose non-constant initializer for static object with -O1
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 22 Jun 2015 12:58:41 +0000
- Subject: [Bug c/66618] Failure to diagnose non-constant initializer for static object with -O1
- Auto-submitted: auto-generated
- References: <bug-66618-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66618
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-06-22
CC| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed. What's going on here is that digest_init has
6630 inside_init = c_fully_fold (inside_init, require_constant,
&maybe_const);
6631 inside_init = decl_constant_value_for_optimization (inside_init);
and that decl_constant_value_for_optimization when optimizing is able to turn a
"const int" into an integer constant. And an integer constant is fine as an
initializer thus we don't error.