[all-commits] [llvm/llvm-project] d2e7dc: [CodeGen] Fix Bug 47499: __unaligned extension inc...

Reid Kleckner via All-commits all-commits at lists.llvm.org
Thu Nov 5 13:00:21 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d2e7dca5ca92c655e451d6fcb806df38d7f2d56b
      https://github.com/llvm/llvm-project/commit/d2e7dca5ca92c655e451d6fcb806df38d7f2d56b
  Author: Jan Ole Hüser <j.hueser at beckhoff.de>
  Date:   2020-11-05 (Thu, 05 Nov 2020)

  Changed paths:
    M clang/lib/CodeGen/CodeGenModule.cpp
    A clang/test/CodeGen/unaligned-struct-copy.c

  Log Message:
  -----------
  [CodeGen] Fix Bug 47499: __unaligned extension inconsistent behaviour with C and C++

For the language C++ the keyword __unaligned (a Microsoft extension) had no effect on pointers.

The reason, why there was a difference between C and C++ for the keyword __unaligned:
For C, the Method getAsCXXREcordDecl() returns nullptr. That guarantees that hasUnaligned() is called.
If the language is C++, it is not guaranteed, that hasUnaligend() is called and evaluated.

Here are some links:

The Bug: https://bugs.llvm.org/show_bug.cgi?id=47499
Thread on the cfe-dev mailing list: http://lists.llvm.org/pipermail/cfe-dev/2020-September/066783.html
Diff, that introduced the check hasUnaligned() in getNaturalTypeAlignment(): https://reviews.llvm.org/D30166

Reviewed By: rnk

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




More information about the All-commits mailing list