[libcxx-commits] [PATCH] D86102: [libunwind] Ensure enough alignment for unw_cursor_t for SEH build configurations

Ryan Prichard via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 22 17:07:30 PDT 2020


rprichard added a comment.

After this change, I see a compile error with GCC. There's something broken with libunwind's static_assert emulation <https://github.com/llvm/llvm-project/blob/cc7bf9bcbfbc8d8188d9fe540c2bc1aee23824af/libunwind/src/config.h#L25-L29>. I'd guess the fix is to remove that emulation and simply use the C++11 static_assert.

Regarding static_assert: there are two compile_time_assert_failed[] declarations within a single scope, and GCC thinks the declarations are incompatible. Somehow it matters that the array condition depends on a template parameter. Here's a simple demo that compiles with Clang but not GCC, https://godbolt.org/z/M3sc4x.

The libunwind error:

  /x/llvm-upstream/llvm-project/libunwind/src/config.h:27:18: error: conflicting declaration ‘int libunwind::compile_time_assert_failed [((__alignof__ (libunwind::UnwindCursor<A, R>) <= 8) ? 1 : -1)]’
     27 |       extern int compile_time_assert_failed[ ( __b ) ? 1 : -1 ]  \
        |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
  /x/llvm-upstream/llvm-project/libunwind/src/UnwindCursor.hpp:1187:3: note: in expansion of macro ‘static_assert’
   1187 |   static_assert((alignof(UnwindCursor<A, R>) <= alignof(unw_cursor_t)),
        |   ^~~~~~~~~~~~~
  /x/llvm-upstream/llvm-project/libunwind/src/config.h:27:18: note: previous declaration as ‘int libunwind::compile_time_assert_failed [(check_fit<libunwind::UnwindCursor<A, R>, unw_cursor_t>::does_fit ? 1 : -1)]’
     27 |       extern int compile_time_assert_failed[ ( __b ) ? 1 : -1 ]  \
        |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
  /x/llvm-upstream/llvm-project/libunwind/src/UnwindCursor.hpp:1185:3: note: in expansion of macro ‘static_assert’
   1185 |   static_assert((check_fit<UnwindCursor<A, R>, unw_cursor_t>::does_fit),
        |   ^~~~~~~~~~~~~


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86102



More information about the libcxx-commits mailing list