This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/36602] memset should be optimized into an empty CONSTRUCTOR
- From: "jason at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 06 Jun 2012 16:36:31 +0000
- Subject: [Bug tree-optimization/36602] memset should be optimized into an empty CONSTRUCTOR
- Auto-submitted: auto-generated
- References: <bug-36602-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36602
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-06 16:36:31 UTC ---
(In reply to comment #6)
> Joseph, Jason - any opinion on the question of equivalence between
> memcpy/memset and an aggregate assignment/init (also consider anonymous
> memory)?
The transformation seems safe to me. Aggregate assignment/init leave anonymous
bit-fields and padding with unspecified contents, but I imagine GCC
initializes/copies them anyway. In C++ any class that would be affected by the
difference is not trivially copyable, so using memset/memcpy is already
undefined behavior.