[PATCH] Use default type_for_size langhook

2021-08-15 Thread Mark Wielaard
The gcc constant folding code uses the type_for_size langhook. Use the default implementation instead of crashing when the langhook is called. Add a new testcase "prims_struct_eq.rs" that creates trees that triggers the constant folding. Also remove the write_globals langhook which was removed whe

[PATCH] Add support for const bool and const float

2021-08-15 Thread Mark Wielaard
Handle BOOL and FLOAT in ConstFoldExpr::visit (HIR::LiteralExpr) to make it possible to create const bool, f32 and f64 constants. Add a new testcase "primconsts.rs". Not yet handled are const char and &str types. --- gcc/rust/typecheck/rust-hir-const-fold.h | 30 .../rust/compile/tor

[PATCH] Suppress uninitialized candidate_type warning in process_traits_for_candidates

2021-08-15 Thread Mark Wielaard
Without handling the default case in the switch statement gcc 10.2.1 will warn: rust-hir-path-probe.h:75:40: warning: ‘candidate_type’ may be used uninitialized in this function [-Wmaybe-uninitialized] --- gcc/rust/typecheck/rust-hir-path-probe.h | 1 + 1 file changed, 1 insertion(+) diff --gi