This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/55513] [4.7/4.8 Regression] Incorrect snprintf folding when building with -std=c++0x
- 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: Wed, 28 Nov 2012 15:15:11 +0000
- Subject: [Bug c++/55513] [4.7/4.8 Regression] Incorrect snprintf folding when building with -std=c++0x
- Auto-submitted: auto-generated
- References: <bug-55513-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55513
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-28 15:15:11 UTC ---
In cp_parser_constant_expression when we call cp_parser_assignment_expression
on the initializer, it returns
((char *) __builtin_memcpy ((char *) &str, (const char *) "Hello", 6);, 5)
As this is C++11, we call potential_rvalue_constant_expression which returns
true (the call in the COMPOUND_EXPR is builtin, and all its arguments are
pontential_rvalue_constant_expression arguments). I bet somewhere later on we
see that it is const and ignore the TREE_SIDE_EFFECTS initializer.