[all-commits] [llvm/llvm-project] 3a08ad: [Clang] Fix crash in coverage of if consteval.

Tobias Hieta via All-commits all-commits at lists.llvm.org
Mon Sep 12 03:55:11 PDT 2022


  Branch: refs/heads/release/15.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 3a08ad21ce89174f4ecdf1aad8ed7a161ef52a65
      https://github.com/llvm/llvm-project/commit/3a08ad21ce89174f4ecdf1aad8ed7a161ef52a65
  Author: Corentin Jabot <corentinjabot at gmail.com>
  Date:   2022-09-12 (Mon, 12 Sep 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/CodeGen/CoverageMappingGen.cpp
    M clang/test/CoverageMapping/if.cpp

  Log Message:
  -----------
  [Clang] Fix crash in coverage of if consteval.

Clang crashes when encountering an `if consteval` statement.
This is the minimum fix not to crash.
The fix is consistent with the current behavior of if constexpr,
which does generate coverage data for the discarded branches.
This is of course not correct and a better solution is
needed for both if constexpr and if consteval.
See https://github.com/llvm/llvm-project/issues/54419.

Fixes #57377

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D132723


  Commit: 1a5c5e0f67be2e08c86b754da1e008f645d49c61
      https://github.com/llvm/llvm-project/commit/1a5c5e0f67be2e08c86b754da1e008f645d49c61
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-09-12 (Mon, 12 Sep 2022)

  Changed paths:
    M llvm/lib/CodeGen/DwarfEHPrepare.cpp
    A llvm/test/CodeGen/X86/dwarf-eh-prepare-dbg.ll

  Log Message:
  -----------
  [DwarfEhPrepare] Assign dummy debug location for inserted _Unwind_Resume calls (PR57469)

DwarfEhPrepare inserts calls to _Unwind_Resume into landing pads.
If _Unwind_Resume happens to be defined in the same module and
debug info is used, then this leads to a verifier error:

  inlinable function call in a function with debug info must
    have a !dbg location
  call void @_Unwind_Resume(ptr %exn.obj) #0

Fix this by assigning a dummy location to the call. (As this
happens in the backend, inlining is not actually relevant here.)

Fixes https://github.com/llvm/llvm-project/issues/57469.

Differential Revision: https://reviews.llvm.org/D133095

(cherry picked from commit 5134bd432f8c35c87f4c4dc3bb744d396adcab58)


  Commit: c643956d69b1813cc2caf938207f073d28b7b72c
      https://github.com/llvm/llvm-project/commit/c643956d69b1813cc2caf938207f073d28b7b72c
  Author: Brad Smith <brad at comstyle.com>
  Date:   2022-09-12 (Mon, 12 Sep 2022)

  Changed paths:
    M mlir/lib/ExecutionEngine/CRunnerUtils.cpp

  Log Message:
  -----------
  [mlir] Fix building CRunnerUtils on OpenBSD with 15.x

CRunnerUtils builds as C++11. 9c1d133c3a0256cce7f40e2e06966f84e8b99ffe broke
the build on OpenBSD. aligned_alloc() was only introduced in C++17.


  Commit: 92e7ef99303f8f367f279ccfa2393e4b96db915a
      https://github.com/llvm/llvm-project/commit/92e7ef99303f8f367f279ccfa2393e4b96db915a
  Author: Jan Ole Hüser <J.Hueser at beckhoff.com>
  Date:   2022-09-12 (Mon, 12 Sep 2022)

  Changed paths:
    M lld/COFF/Symbols.h
    M lld/COFF/Writer.cpp
    M lld/test/COFF/arm-thumb-thunks.s
    M lld/test/COFF/arm64-thunks.s

  Log Message:
  -----------
  [LLD][COFF] Fix writing a map file when range extension thunks are inserted

Bug: An assertion fails:

    Assertion failed: isa<To>(Val) && "cast<Ty>() argument of incompatible type!",
    file C:\Users\<user>\prog\llvm\llvm-git-lld-bug\llvm\include\llvm/Support/Casting.h, line 578

Bug is triggered, if

    - a map file is requested with /MAP, and
    - Architecture is ARMv7, Thumb, and
    - a relative jump (branch instruction) is greater than 16 MiB (2^24)

The reason for the Bug is:

    - a Thunk is created for the jump
    - a Symbol for the Thunk is created
        - of type `DefinedSynthetic`
        - in file `Writer.cpp`
        - in function `getThunk`
    - the Symbol has no name
    - when creating the map file, the name of the Symbol is queried
    - the function `Symbol::computeName` of the base class `Symbol`
      casts the `this` pointer to type `DefinedCOFF` (a derived type),
      but the acutal type is `DefinedSynthetic`
    - The in the llvm::cast an assertion fails

Changes:

- Modify regression test to trigger this bug
- Give the symbol pointing to the thunk a name, to fix the bug
- Add assertion, that only DefinedCOFF symbols are allowed to have an
  empty name, when the constructor of the base class Symbol is executed

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D133201

(cherry picked from commit 4e5a59a3839f54d928d37d49d4c4ddbb3f339b76)


Compare: https://github.com/llvm/llvm-project/compare/1c73596d3454...92e7ef99303f


More information about the All-commits mailing list