[lld] r266857 - Revert "[ELF] - Avoid using memset for zero-initialization of struct member. NFC."

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 23:08:33 PDT 2016


I don't think we have any bots that test this configuration unfortunately.
I've updated my local machine to VS2015 recently (sadly a little too early
for me to have caught this locally and been able to easily debug it
locally) and I'm trying to get an internal bot updated too (which is where
I caught this).

Considering how much time I lost debugging this, I think we should consider
deprecating VS2013 support at least within LLD.

-- Sean Silva

On Tue, Apr 19, 2016 at 9:26 PM, Sean Silva via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: silvas
> Date: Tue Apr 19 23:26:16 2016
> New Revision: 266857
>
> URL: http://llvm.org/viewvc/llvm-project?rev=266857&view=rev
> Log:
> Revert "[ELF] - Avoid using memset for zero-initialization of struct
> member. NFC."
>
> This reverts commit r266618. It breaks basically everything.
>
> I think VS2013 doesn't interpret this code in the same way.
> The size field (at least) is left uninitialized, causing all sorts of havok
> (e.g. creating a 34GB file for a trivial hello world program).
>
> The offending compiler reports itself as follows:
>
>     c:\release-vs2013>cl /?
>     Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x64
>     Copyright (C) Microsoft Corporation.  All rights reserved.
>
> Modified:
>     lld/trunk/ELF/OutputSections.cpp
>     lld/trunk/ELF/OutputSections.h
>
> Modified: lld/trunk/ELF/OutputSections.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=266857&r1=266856&r2=266857&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/OutputSections.cpp (original)
> +++ lld/trunk/ELF/OutputSections.cpp Tue Apr 19 23:26:16 2016
> @@ -44,6 +44,7 @@ template <class ELFT>
>  OutputSectionBase<ELFT>::OutputSectionBase(StringRef Name, uint32_t Type,
>                                             uintX_t Flags)
>      : Name(Name) {
> +  memset(&Header, 0, sizeof(Elf_Shdr));
>    Header.sh_type = Type;
>    Header.sh_flags = Flags;
>  }
>
> Modified: lld/trunk/ELF/OutputSections.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=266857&r1=266856&r2=266857&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/OutputSections.h (original)
> +++ lld/trunk/ELF/OutputSections.h Tue Apr 19 23:26:16 2016
> @@ -97,7 +97,7 @@ public:
>
>  protected:
>    StringRef Name;
> -  Elf_Shdr Header = {};
> +  Elf_Shdr Header;
>  };
>
>  template <class ELFT> class GotSection final : public
> OutputSectionBase<ELFT> {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160419/12f5f1b0/attachment.html>


More information about the llvm-commits mailing list