GCC Rust Weekly Status Report 61

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

Milestone Progress

One major change the compiler saw this week was the integration of Faisal Abbas’ constant evaluation work! This PR marks a huge step towards our Const generics milestone and allows us to perform function evaluation, conditional blocks, arithmetics or even calls to builtin functions in constant contexts! This is the culmination of months of work and we are extremely proud of Faisal. Congratulations!

We now need to add more constant folding test cases and stress the implementation out in multiple ways. This will hopefully expose bugs that Faisal will be able to fix as the remaining part of his project.

Philip also took the time to send out our initial compiler patches to the gcc-patches mailing list. We are looking forward to the reviews and feedback!

As a reminder, we will be present at the Linux Plumbers Conference, Kangrejos and GNU Cauldron in September. Feel free to come and say hi!

Completed Activities

  • Add missing language selection for rs6000 PR1512
  • rustc_attrs: Allow `rustc_inherit_overflow_checks` as a builtin attribute PR1510
  • constexpr: Fix warning in sorry fmt string PR1509
  • Desugar double borrows into two HIR:BorrowExpr’s PR1507
  • Fix up missing jump_target handling PR1504
  • Fix port of NOP_EXPR PR1501
  • Remove missed target hooks code PR1500
  • Constant folding in gccrs: port over rest of the code from CP frontend PR1499
  • Merge from GCC upstream PR1498
  • Refactor our casts to follow the Rustc implemention PR1497
  • Fix ICE in dyn impl block PR1493
  • Improve AST dump PR1473

Contributors this week

Overall Task Status

CategoryLast WeekThis WeekDelta
TODO167168+1
In Progress3028-2
Completed445452+7
GitHub Issues

Test Cases

CategoryLast WeekThis WeekDelta
Passing66756732+56
Failed
XFAIL5151
XPASS
make check-rust

Bugs

CategoryLast WeekThis WeekDelta
TODO5252
In Progress1716-1
Completed193199+6
GitHub Bugs

Milestone 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 Matching100%100%20th Sept 20219th Dec 202129th Nov 2021
Macros and cfg expansion100100%1st Dec 202131st Mar 202228th Mar 2022
Imports and Visibility100%100%29th Mar 202213th Jul 202227th May 2022
Const Generics60%74%++14%30th May 202217th Oct 2022
Intrinsics0%15%+15%6th Sept 202214th Nov 2022
GitHub Milestones

Risks

RiskImpact (1-3)Likelihood (0-10)Risk (I * L)Mitigation
Rust Language Changes2714Target specific Rustc version for first go
Missing GCC 13 upstream window166Merge in GCC 14 and be proactive about reviews

Planned Activities

  • Prepare our talks for the three upcoming conferences we’ll attend

Detailed changelog

Const evaluation

As we mentioned, we merged Faisal Abbas GSoC 2022 project which now allows us to do constant evaluation of expressions and function calls within the front-end. This is akin to C++ constexpr and enforces constant expressions do not allocate. Below is an example test case of what this allows us to do. Here you can see we have a constant function and inside the main function we can see that the gimple we are feeding the GCC middle-end has already evaluated this function to a value. Note this is the behaviour regardless of optimisation level.

const A: i32 = 1;

const fn test(a: i32) -> i32 {
    let b = A + a;
    if b == 2 {
        return b + 2;
    }
    a
}

const B: i32 = test(1);
const C: i32 = test(12);

fn main() {
    // { dg-final { scan-tree-dump-times {a = 1} 1 gimple } }
    let a = A;
    // { dg-final { scan-tree-dump-times {b = 4} 1 gimple } }
    let b = B;
    // { dg-final { scan-tree-dump-times {c = 12} 1 gimple } }
    let c = C;
}

Leave a Reply

Your email address will not be published.