Skip to content

Commit 55004d8

Browse files
committed
Fix float initializations
1 parent 119592f commit 55004d8

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Diff for: .github/workflows/main.yml

-6
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ jobs:
7373
args: --release
7474

7575
- name: Test
76-
continue-on-error: true # TODO: remove when this pass.
7776
run: |
7877
# Enable backtraces for easier debugging
7978
export RUST_BACKTRACE=1
@@ -83,8 +82,3 @@ jobs:
8382
export RUN_RUNS=2
8483
8584
./test.sh --release
86-
87-
- name: libcore's tests
88-
run: |
89-
cd build_sysroot/sysroot_src/library/core/tests/
90-
CHANNEL=release ../../../../../cargo.sh test -- --skip num::dec2flt::special_code_paths

Diff for: src/common.rs

+10
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,16 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
236236
}
237237
Scalar::Int(int) => {
238238
let data = int.assert_bits(layout.value.size(self));
239+
240+
// FIXME: there's some issues with using the u128 code that follows, so hard-code
241+
// the paths for floating-point values.
242+
if ty == self.float_type {
243+
return self.context.new_rvalue_from_double(ty, f32::from_bits(data as u32) as f64);
244+
}
245+
else if ty == self.double_type {
246+
return self.context.new_rvalue_from_double(ty, f64::from_bits(data as u64));
247+
}
248+
239249
let value = self.const_uint_big(self.type_ix(bitsize), data);
240250
if layout.value == Pointer {
241251
self.inttoptr(self.current_block.borrow().expect("block"), value, ty)

0 commit comments

Comments
 (0)