[all-commits] [llvm/llvm-project] 241275: Revert "[Clang] Propagate guaranteed alignment for...

James Y Knight via All-commits all-commits at lists.llvm.org
Tue Feb 8 15:00:41 PST 2022


  Branch: refs/heads/backport-53540
  Home:   https://github.com/llvm/llvm-project
  Commit: 241275a01ed88cd59d503449a8c74a3b7cfedbb2
      https://github.com/llvm/llvm-project/commit/241275a01ed88cd59d503449a8c74a3b7cfedbb2
  Author: James Y Knight <jyknight at google.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M clang/include/clang/Basic/TargetInfo.h
    M clang/lib/Sema/SemaDecl.cpp
    M clang/test/CodeGen/alloc-fns-alignment.c

  Log Message:
  -----------
  Revert "[Clang] Propagate guaranteed alignment for malloc and others"

The above change assumed that malloc (and friends) would always
allocate memory to getNewAlign(), even for allocations which have a
smaller size. This is not actually required by spec (a 1-byte
allocation may validly have 1-byte alignment).

Some real-world malloc implementations do not provide this guarantee,
and thus this optimization is breaking programs.

Fixes #53540

This reverts commit c2297544c04764237cedc523083c7be2fb3833d4.

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

(cherry picked from commit 9545976ff160e19805a84a06a7e59d446f9994d9)




More information about the All-commits mailing list