[all-commits] [llvm/llvm-project] 52624d: [clang] Check '-Wp, ' arg has values before accesin...

Jaime González via All-commits all-commits at lists.llvm.org
Tue Nov 5 08:42:11 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 52624d77c9d541dc6adccdbfea6e981e8e8079b8
      https://github.com/llvm/llvm-project/commit/52624d77c9d541dc6adccdbfea6e981e8e8079b8
  Author: Jaime González <jaime.gonzalez at appentra.com>
  Date:   2024-11-05 (Tue, 05 Nov 2024)

  Changed paths:
    M clang/lib/Driver/Driver.cpp

  Log Message:
  -----------
  [clang] Check '-Wp,' arg has values before accesing (#113677)

Executing `clang -Wp,` without any argument value causes Undefined
Behavior due to accessing a SmallVector without elements

Executing clang in debug mode raises an assert and Valgrind complains as
follow:

```
$ valgrind bin/clang -Wp,
==18620== Memcheck, a memory error detector
==18620== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==18620== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==18620== Command: bin/clang -Wp,
==18620== 
==18620== Conditional jump or move depends on uninitialised value(s)
==18620==    at 0x44F215B: clang::driver::Driver::TranslateInputArgs(llvm::opt::InputArgList const&) const (in /home/jaime/devel/llvm-project/build/bin/clang-20)
==18620==    by 0x4515831: clang::driver::Driver::BuildCompilation(llvm::ArrayRef<char const*>) (in /home/jaime/devel/llvm-project/build/bin/clang-20)
==18620==    by 0x10B3435: clang_main(int, char**, llvm::ToolContext const&) (in /home/jaime/devel/llvm-project/build/bin/clang-20)
==18620==    by 0xF78F99: main (in /home/jaime/devel/llvm-project/build/bin/clang-20)
==18620== 
...
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list