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

Integer overflows in corner cases of moebius_ #430

Closed
tueda opened this issue Dec 15, 2022 · 2 comments
Closed

Integer overflows in corner cases of moebius_ #430

tueda opened this issue Dec 15, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@tueda
Copy link
Collaborator

tueda commented Dec 15, 2022

On 64-bit machines, the following code does not work (unless you have plenty of memory space ~ O(10EB)?):

L F = moebius_(2^31-1);
P;
.end
FORM 4.3.0 (Dec 12 2022, v4.3.0-7-ga580a7c) 64-bits  Run: Thu Dec 15 11:36:21 2022
    L F = moebius_(2^31-1);
    P;
    .end
test.frm Line 4 ==> No memory while allocating  Moebius
Program terminating at test.frm Line 2 -->
  0.00 sec out of 0.00 sec
tueda added a commit to tueda/form that referenced this issue Dec 15, 2022
* Build issue on 32-bit machines.

* Corner cases where n ~ MAXPOSITIVE.
@tueda tueda added the bug Something isn't working label Dec 15, 2022
@tueda
Copy link
Collaborator Author

tueda commented Dec 15, 2022

28e15ea passes the following corner case test:

*--#[ moebius_3 :
* corner cases, see #430
#do i=1,9
  L F`i' = moebius_(2^15-`i');
#enddo
#do i=1,9
  L G`i' = moebius_(2^31-`i');
#enddo
P;
.end
assert succeeded?
if wordsize >= 2
  assert result("F1") =~ expr("-1")
  assert result("F2") =~ expr("1")
  assert result("F3") =~ expr("1")
  assert result("F4") =~ expr("0")
  assert result("F5") =~ expr("-1")
  assert result("F6") =~ expr("1")
  assert result("F7") =~ expr("0")
  assert result("F8") =~ expr("0")
  assert result("F9") =~ expr("-1")
end
if wordsize >= 4
  assert result("G1") =~ expr("-1")
  assert result("G2") =~ expr("0")
  assert result("G3") =~ expr("-1")
  assert result("G4") =~ expr("0")
  assert result("G5") =~ expr("1")
  assert result("G6") =~ expr("-1")
  assert result("G7") =~ expr("1")
  assert result("G8") =~ expr("0")
  assert result("G9") =~ expr("-1")
end
*--#] moebius_3 :

though I haven't put this test into the repository because it easily leads to a timeout.

Maybe check.rb needs some way to extend the default timeout for specific tests.

@tueda tueda closed this as completed in 6cc038c Dec 23, 2022
@dave1667
Copy link

nexus@nexus:~/Projects/form-master$ form test_430.frm
FORM 4.3 (Dec 28 2022) 64-bits Run: Thu Dec 29 08:07:43 2022
*--#[ moebius_3 :
* corner cases, see #430
#do i=1,9
L Fi' = moebius_(2^15-i');
#enddo
#do i=1,9
L Gi' = moebius_(2^31-i');
#enddo
P;
.end

Time = 0.00 sec Generated terms = 1
F1 Terms in output = 1
Bytes used = 20

Time = 0.00 sec Generated terms = 1
F2 Terms in output = 1
Bytes used = 20

Time = 0.00 sec Generated terms = 1
F3 Terms in output = 1
Bytes used = 20

Time = 0.00 sec Generated terms = 0
F4 Terms in output = 0
Bytes used = 4

Time = 0.00 sec Generated terms = 1
F5 Terms in output = 1
Bytes used = 20

Time = 0.00 sec Generated terms = 1
F6 Terms in output = 1
Bytes used = 20

Time = 0.00 sec Generated terms = 0
F7 Terms in output = 0
Bytes used = 4

Time = 0.00 sec Generated terms = 0
F8 Terms in output = 0
Bytes used = 4

Time = 0.00 sec Generated terms = 1
F9 Terms in output = 1
Bytes used = 20

Time = 1.29 sec Generated terms = 1
G1 Terms in output = 1
Bytes used = 20

Time = 1.29 sec Generated terms = 0
G2 Terms in output = 0
Bytes used = 4

Time = 1.29 sec Generated terms = 1
G3 Terms in output = 1
Bytes used = 20

Time = 1.29 sec Generated terms = 0
G4 Terms in output = 0
Bytes used = 4

Time = 1.29 sec Generated terms = 1
G5 Terms in output = 1
Bytes used = 20

Time = 1.29 sec Generated terms = 1
G6 Terms in output = 1
Bytes used = 20

Time = 1.29 sec Generated terms = 1
G7 Terms in output = 1
Bytes used = 20

Time = 1.29 sec Generated terms = 0
G8 Terms in output = 0
Bytes used = 4

Time = 1.29 sec Generated terms = 1
G9 Terms in output = 1
Bytes used = 20

F1 =
- 1;

F2 =
1;

F3 =
1;

F4 = 0;

F5 =
- 1;

F6 =
1;

F7 = 0;

F8 = 0;

F9 =
- 1;

G1 =
- 1;

G2 = 0;

G3 =
- 1;

G4 = 0;

G5 =
1;

G6 =
- 1;

G7 =
1;

G8 = 0;

G9 =
- 1;

1.29 sec out of 1.30 sec
nexus@nexus:~/Projects/form-master$

Fenyutanchan added a commit to Fenyutanchan/Yggdrasil that referenced this issue Feb 19, 2023
Platforms `armv6l-linux-gnueabihf`, `armv7l-linux-gnueabihf`, `armv6l-linux-musleabihf` and `armv7l-linux-musleabihf` are done.
Platforms `i686-linux-gnu` and `i686-linux-musl` are not supported yet.
Platforms for Windows are not supported yet.
Fenyutanchan added a commit to Fenyutanchan/Yggdrasil that referenced this issue Feb 19, 2023
Platforms `armv6l-linux-gnueabihf`, `armv7l-linux-gnueabihf`, `armv6l-linux-musleabihf` and `armv7l-linux-musleabihf` are done.
Platforms `i686-linux-gnu` and `i686-linux-musl` are not supported yet.
Platforms for Windows are not supported yet.
Fenyutanchan added a commit to Fenyutanchan/Yggdrasil that referenced this issue Feb 21, 2023
Platforms `armv6l-linux-gnueabihf`, `armv7l-linux-gnueabihf`, `armv6l-linux-musleabihf` and `armv7l-linux-musleabihf` are done.
Platforms `i686-linux-gnu` and `i686-linux-musl` are not supported yet.
Platforms for Windows are not supported yet.
giordano added a commit to JuliaPackaging/Yggdrasil that referenced this issue Feb 21, 2023
* New Recipe: FORM v4.3.0

* add `MicrosoftMPI_jll` for Windows.

* Switch to git for 32-bit (vermaseren/form#422 and vermaseren/form#430)
Platforms `armv6l-linux-gnueabihf`, `armv7l-linux-gnueabihf`, `armv6l-linux-musleabihf` and `armv7l-linux-musleabihf` are done.
Platforms `i686-linux-gnu` and `i686-linux-musl` are not supported yet.
Platforms for Windows are not supported yet.

* Add some information for non-unsupported platforms

* All platforms except Windows.

Co-authored-by: Mosè Giordano <[email protected]>

* Change the flags.

It seems to be `--disable-native` instead of `--enable_native=no`.

---------

Co-authored-by: Mosè Giordano <[email protected]>
tueda added a commit that referenced this issue Apr 20, 2023
* Build issue on 32-bit machines.

* Corner cases where n ~ MAXPOSITIVE.

Repatched 28e15ea (#441)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants