GCC Rust Weekly Status Report 29

Thanks again to Open Source Security, inc and Embecosm for their ongoing support for this project.

Milestone Progress

This week my focus was on the linux plumbers conference so I was not able to complete any tickets for the current milestone, though I have made some good progress in investigating closures in C++ and GO to gain an understanding of how they are implemented in GCC. I expect to see progress this week.

Monthly Community Call

We will be having our 7th community call on the first Friday of the month:

Linux Plumbers 2021 Talk

  • Please find the video of my talk here:

The slides are also available here: https://linuxplumbersconf.org/event/11/contributions/911/

Closure investigation

Since rust closures are similar to C++ in that they can be moved, I thought it makes sense to investigate how they work there first, for example, a C++ closure such as:

int test() {
    int capture = 456;
    auto a = [&](int a) -> int {
        return a + capture;
    return a(123);

Breaks down into the following:

int test ()
  int D.2400;
  int capture;
  struct ._anon_0 a;
  typedef struct ._anon_0 ._anon_0;

      capture = 456;
      a.__capture = &capture;
      D.2400 = test()::<lambda(int)>::operator() (&a, 123);
      return D.2400;
      capture = {CLOBBER};
      a = {CLOBBER};

int test()::<lambda(int)>::operator() (const struct ._anon_0 * const __closure, int a)
  int D.2403;
  int & capture [value-expr: __closure->__capture];

  _1 = __closure->__capture;
  _2 = *_1;
  D.2403 = a + _2;
  return D.2403;

This shows that you can break down a closure into a structure to hold onto captured data by reference. Then the actual lambda itself the variables which it captures are a type of “static chain” variable as you can see above. Where the capture variable was captured but refers to the parameter of the closure object’s reference.

Detailed changelog

Fix GCC Bootstrap builds

Thanks to our whole community who have worked on this to eliminate all the compiler warnings which allows us to perform a full GCC bootstrap build. See our tracking issue for all related fixes to get this working: https://github.com/Rust-GCC/gccrs/issues/336

We will need to add some automation to track compiler warnings in the CI build to catch regressions for bootstrap builds in PR’s.

Merge from upstream GCC

Thanks to Thomas Schwinge we have merged with the latest upstream GCC. The last merge was completed in and around six months ago, this means we get all the relevant updates for DCO contributions and ensure our front-end code is not drifting to become unmergeable. See below before what the –version looked like:

gccrs (GCC) 11.0.1 20210325 (experimental)
Copyright © 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO


gccrs (GCC) 12.0.0 20210917 (experimental)
Copyright © 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

Fix bug with out of range characters

Mark Wielaard identified a bug with our lexer which was incorrectly flagging byte with their high-bit set, this was due to a bad unsigned vs signed check.

bytecharstring.rs:3:14: error: ‘byte char’ ‘�’ out of range
    3 |   let _bc = b'\x80';
      |              ^
bytecharstring.rs:4:14: error: character ‘�’ in byte string out of range
    4 |   let _bs = b"foo\x80bar";
      |              ^

Completed Activities

Contributors this week

Excluding merges, 3 authors have pushed 6 commits to master and 6 commits to all branches. On master, 11,609 files have changed and there have been 673,665 additions and 375,942 deletions.

Overall Task Status

CategoryLast WeekThis WeekDelta
In Progress67+1
GitHub Issues

Test Cases

CategoryLast WeekThis WeekDelta
make check-rust


CategoryLast WeekThis WeekDelta
In Progress33
GitHub Bugs

Milestones Progress

MilestoneLast WeekThis WeekDeltaStart DateCompletion DateTarget
Data Structures 1 – Core100%100%30th Nov 202027th Jan 202129th Jan 2021
Control Flow 1 – Core100%100%28th Jan 202110th Feb 202126th Feb 2021
Data Structures 2 – Generics100%100%11th Feb 202114th May 202128th May 2021
Data Structures 3 – Traits100%100%20th May 202117th Sept 202127th Aug 2021
Control Flow 2 – Pattern Matching0%0%20th Sept 202129th Nov 2021
Imports and Visibility0%0%TBD
Macros and cfg expansion0%0%TBD
Const Generics0%0%TBD
GitHub Milestones

Planned Activities

  • Continue work on closure types
  • Fix docker automation issues
  • Add compiler warning automation for GHA

Leave a Reply

Your email address will not be published. Required fields are marked *