Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x86_64-unknown-linux-gnux32 no longer works with 0.4.5 #311

Closed
trinity-1686a opened this issue Jun 27, 2024 · 1 comment · Fixed by #312
Closed

x86_64-unknown-linux-gnux32 no longer works with 0.4.5 #311

trinity-1686a opened this issue Jun 27, 2024 · 1 comment · Fixed by #312

Comments

@trinity-1686a
Copy link

x86_64-unknown-linux-gnux32 compiled fine with 0.4.4, but no longer does 0.4.5.

I don't actually use that target, but it happened to be in our CI, so i'm letting you know.

error[E0308]: arguments to this function are incorrect
  --> src/biguint/addition.rs:52:17
   |
52 |         carry = adc(carry, *a, *b, a);
   |                 ^^^        --  --  - expected `&mut u64`, found `&mut u32`
   |                            |   |
   |                            |   expected `u64`, found `u32`
   |                            expected `u64`, found `u32`
   |
   = note: expected mutable reference `&mut u64`
              found mutable reference `&mut u32`
note: function defined here
  --> src/biguint/addition.rs:13:4
   |
13 | fn adc(carry: u8, a: u64, b: u64, out: &mut u64) -> u8 {
   |    ^^^ ---------  ------  ------  -------------
help: you can convert a `u32` to a `u64`
   |
52 |         carry = adc(carry, (*a).into(), *b, a);
   |                            +  ++++++++
help: you can convert a `u32` to a `u64`
   |
52 |         carry = adc(carry, *a, (*b).into(), a);
   |                                +  ++++++++

error[E0308]: arguments to this function are incorrect
  --> src/biguint/addition.rs:57:21
   |
57 |             carry = adc(carry, *a, 0, a);
   |                     ^^^        --     - expected `&mut u64`, found `&mut u32`
   |                                |
   |                                expected `u64`, found `u32`
   |
   = note: expected mutable reference `&mut u64`
              found mutable reference `&mut u32`
note: function defined here
  --> src/biguint/addition.rs:13:4
   |
13 | fn adc(carry: u8, a: u64, b: u64, out: &mut u64) -> u8 {
   |    ^^^ ---------  ------  ------  -------------
help: you can convert a `u32` to a `u64`
   |
57 |             carry = adc(carry, (*a).into(), 0, a);
   |                                +  ++++++++

warning: formatting may not be suitable for sub-register argument
  --> src/biguint/division.rs:48:18
   |
48 |             "div {}",
   |                  ^^
49 |             in(reg) divisor,
   |                     ------- for this argument
   |
   = help: use `{0:e}` to have the register formatted as `eax` (for 32-bit values)
   = help: or use `{0:r}` to keep the default formatting of `rax` (for 64-bit values)
   = note: `#[warn(asm_sub_register)]` on by default

error[E0308]: arguments to this function are incorrect
  --> src/biguint/subtraction.rs:48:18
   |
48 |         borrow = sbb(borrow, *a, *b, a);
   |                  ^^^         --  --  - expected `&mut u64`, found `&mut u32`
   |                              |   |
   |                              |   expected `u64`, found `u32`
   |                              expected `u64`, found `u32`
   |
   = note: expected mutable reference `&mut u64`
              found mutable reference `&mut u32`
note: function defined here
  --> src/biguint/subtraction.rs:13:4
   |
13 | fn sbb(borrow: u8, a: u64, b: u64, out: &mut u64) -> u8 {
   |    ^^^ ----------  ------  ------  -------------
help: you can convert a `u32` to a `u64`
   |
48 |         borrow = sbb(borrow, (*a).into(), *b, a);
   |                              +  ++++++++
help: you can convert a `u32` to a `u64`
   |
48 |         borrow = sbb(borrow, *a, (*b).into(), a);
   |                                  +  ++++++++

error[E0308]: arguments to this function are incorrect
  --> src/biguint/subtraction.rs:53:22
   |
53 |             borrow = sbb(borrow, *a, 0, a);
   |                      ^^^         --     - expected `&mut u64`, found `&mut u32`
   |                                  |
   |                                  expected `u64`, found `u32`
   |
   = note: expected mutable reference `&mut u64`
              found mutable reference `&mut u32`
note: function defined here
  --> src/biguint/subtraction.rs:13:4
   |
13 | fn sbb(borrow: u8, a: u64, b: u64, out: &mut u64) -> u8 {
   |    ^^^ ----------  ------  ------  -------------
help: you can convert a `u32` to a `u64`
   |
53 |             borrow = sbb(borrow, (*a).into(), 0, a);
   |                                  +  ++++++++

error[E0308]: arguments to this function are incorrect
  --> src/biguint/subtraction.rs:75:18
   |
75 |         borrow = sbb(borrow, *ai, *bi, bi);
   |                  ^^^         ---  ---  -- expected `&mut u64`, found `&mut u32`
   |                              |    |
   |                              |    expected `u64`, found `u32`
   |                              expected `u64`, found `u32`
   |
   = note: expected mutable reference `&mut u64`
              found mutable reference `&mut u32`
note: function defined here
  --> src/biguint/subtraction.rs:13:4
   |
13 | fn sbb(borrow: u8, a: u64, b: u64, out: &mut u64) -> u8 {
   |    ^^^ ----------  ------  ------  -------------
help: you can convert a `u32` to a `u64`
   |
75 |         borrow = sbb(borrow, (*ai).into(), *bi, bi);
   |                              +   ++++++++
help: you can convert a `u32` to a `u64`
   |
75 |         borrow = sbb(borrow, *ai, (*bi).into(), bi);
   |                                   +   ++++++++

For more information about this error, try `rustc --explain E0308`.
warning: `num-bigint` (lib) generated 1 warning
error: could not compile `num-bigint` (lib) due to 5 previous errors; 1 warning emitted
@cuviper
Copy link
Member

cuviper commented Jun 27, 2024

I see, #300 made a bad assumption that "x86_64" always uses 64-bit digits, when we actually follow target_pointer_width. It might actually be desirable for x32 to use 64-bit digits, since it does have 64-bit ALU, but for the time being I'll just fix up these add/sub cfgs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants