public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Merge #814
@ 2022-06-08 11:54 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 11:54 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:717b6da459b26ace9a3c303cfa5e485ff8935709

commit 717b6da459b26ace9a3c303cfa5e485ff8935709
Merge: a41851dfb5b 8b36f2b80eb
Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
Date:   Tue Nov 23 23:09:25 2021 +0000

    Merge #814
    
    814: Set TREE_ADDRESSABLE when we need to borrow any expression r=philberty a=philberty
    
    GCC requires VAR_DECL's and PARAM_DECL's to be marked with TREE_ADDRESSABLE
    when the declaration will be used in borrow's ('&' getting the address).
    This takes into account the implicit addresses when we do autoderef in
    method resolution/operator-overloading.
    
    If it is not set we end up in cases like this:
    
    ```c
    i32 main ()
    {
      i32 a.1;
      i32 D.86;
      i32 a;
    
      a = 1;
      a.1 = a; // this is wrong
      <i32 as AddAssign>::add_assign (&a.1, 2);
      D.86 = 0;
      return D.86;
    }
    ```
    
    You can see GCC will automatically make a copy of the VAR_DECL resulting bad code-generation.
    
    Fixes #804
    
    
    Co-authored-by: Philip Herron <philip.herron@embecosm.com>

Diff:

 gcc/rust/Make-lang.in                              |   1 +
 gcc/rust/backend/rust-compile-fnparam.h            |  33 +++--
 gcc/rust/backend/rust-compile-var-decl.h           |  23 +--
 gcc/rust/hir/tree/rust-hir-item.h                  |   2 +-
 gcc/rust/typecheck/rust-autoderef.h                |  27 +++-
 gcc/rust/typecheck/rust-hir-address-taken.cc       |  65 +++++++++
 gcc/rust/typecheck/rust-hir-address-taken.h        | 159 +++++++++++++++++++++
 gcc/rust/typecheck/rust-hir-type-check-expr.h      |  18 ++-
 .../rust/execute/torture/operator_overload_6.rs    |  40 ++++++
 9 files changed, 344 insertions(+), 24 deletions(-)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 11:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 11:54 [gcc/devel/rust/master] Merge #814 Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).