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

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 13:27:36 PDT 2023


nickdesaulniers requested changes to this revision.
nickdesaulniers added inline comments.
This revision now requires changes to proceed.


================
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)
----------------
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).


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

https://reviews.llvm.org/D145726



More information about the cfe-commits mailing list