[PATCH] D145726: Fix assembler error when -g and -gdwarf-* is passed with -fno-integrated-as.

garvit gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 20:29:17 PDT 2023


garvitgupta08 added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:980-981
+    StringRef BaseInput = StringRef(II.getBaseInput());
+    types::ID InputType = types::lookupTypeForExtension(
+        llvm::sys::path::extension(BaseInput).drop_front());
+    if (InputType == types::TY_Asm || InputType == types::TY_PP_Asm)
----------------
nickdesaulniers wrote:
> The following input causes clang to crash:
> 
> ```
> $ clang -fno-integrated-as -c -x assembler-with-cpp /dev/null
> clang: /android0/llvm-project/llvm/include/llvm/ADT/StringRef.h:597: llvm::StringRef llvm::StringRef::drop_front(size_t) const: Assertion `size() >= N && "Dropping more elements than exist"' failed.
> ```
> 
> Please fix that and add a test case for `/dev/null` (i.e. inputs for which no extension exists).
For Inputs without extension, will there always be a -x flag?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145726/new/

https://reviews.llvm.org/D145726



More information about the cfe-commits mailing list