[all-commits] [llvm/llvm-project] dd9f79: [ObjC] avoid crashing when emitting synthesized ge...

Matt Jacobson via All-commits all-commits at lists.llvm.org
Wed Nov 9 23:11:06 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dd9f7963e434a53e8d70f607392ee9abf76f1d99
      https://github.com/llvm/llvm-project/commit/dd9f7963e434a53e8d70f607392ee9abf76f1d99
  Author: Matt Jacobson <mhjacobson at me.com>
  Date:   2022-11-10 (Thu, 10 Nov 2022)

  Changed paths:
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGObjC.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    A clang/test/CodeGen/avr/objc-property.m

  Log Message:
  -----------
  [ObjC] avoid crashing when emitting synthesized getter/setter and ptrdiff_t is smaller than long

On targets where ptrdiff_t is smaller than long, clang crashes when emitting
synthesized getters/setters that call objc_[gs]etProperty.  Explicitly emit a
zext/trunc of the ivar offset value (which is defined to long) to ptrdiff_t,
which objc_[gs]etProperty takes.

Add a test using the AVR target, where ptrdiff_t is smaller than long. Test
failed previously and passes now.

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




More information about the All-commits mailing list