[PATCH] [MC] report error instead of assertion for non-zero initializer in .bss section

Weiming Zhao weimingz at codeaurora.org
Sat Jun 21 17:34:39 PDT 2014


>>! In D4199#3, @rnk wrote:
> This seems like an OK diagnostic for now in LLVM, but eventually we will need one in clang.

It's good have a check in clang with more detailed info. (line no. etc).

>>! In D4199#13, @rafael wrote:
> LGTM with a nit.

Thanks! I'll commit with the change.

================
Comment at: lib/MC/MCAssembler.cpp:789-790
@@ +788,4 @@
+            if (SD->getSection().getVariant() == MCSection::SV_ELF)
+              SecName = "section '" + static_cast<const MCSectionELF&>
+                (SD->getSection()).getSectionName().str()  + "'";
+            report_fatal_error("non-zero initializer found in " + SecName);
----------------
Reid Kleckner wrote:
> This creates a StringRef that points to a destroyed std::string.
Thanks. Will fix.

http://reviews.llvm.org/D4199






More information about the llvm-commits mailing list