This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/66618] Failure to diagnose non-constant initializer for static object with -O1


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]