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 tree-optimization/36602] memset should be optimized into an empty CONSTRUCTOR


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.


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