You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a program that crashes on windows x64 with the latest dart beta version. The crash is likely related to the usage of typed_data.
It does not crash using the latest stable dart version.
Dart Version (installed using flutter upgrade)
> dart --version
Dart SDK version: 2.19.0-444.6.beta (beta) (Fri Jan 20 12:27:02 2023 +0000) on "windows_x64"
This is currently the smallest example I have which crashes.
import'dart:math';
import'dart:typed_data';
// COPIED FROM THE vector_math PACKAGE// INCLUDED HERE TO MAKE ANALYSIS EASIER// import 'package:vector_math/vector_math.dart';classVector2 {
finalFloat32List _v2storage;
factoryVector2(double x, double y) =>Vector2.zero()..setValues(x, y);
Vector2.zero() : _v2storage =Float32List(2);
voidsetValues(double x, double y) {
_v2storage[0] = x;
_v2storage[1] = y;
}
doubledot(Vector2 other) {
final otherStorage = other._v2storage;
double sum;
sum = _v2storage[0] * otherStorage[0];
sum += _v2storage[1] * otherStorage[1];
return sum;
}
doubleget length =>sqrt(length2);
doubleget length2 {
double sum;
sum = _v2storage[0] * _v2storage[0];
sum += _v2storage[1] * _v2storage[1];
return sum;
}
doublenormalize() {
final l = length;
if (l ==0.0) {
return0.0;
}
final d =1.0/ l;
_v2storage[0] *= d;
_v2storage[1] *= d;
return l;
}
}
voidmain() {
print("START main()");
var rng =Random(0);
var sum =0.0;
for (var i =0; i <10000; ++i) {
if (i %100==0) print("$i");
var theta1 = rng.nextDouble() * pi *2.0;
var theta2 = rng.nextDouble() * pi *2.0;
var a =Vector2(sin(theta1), cos(theta1));
var b =Vector2(sin(theta2), cos(theta2));
a.normalize();
sum += a.dot(b);
}
print("sum: $sum");
}
The following output is visible in console. Crash always happens between iteration 3700 and 3800. No error information is printed.
> dart run
Building package executable...
Built crashtest:crashtest.
START main()
0
100
< some lines omitted >
3600
3700
For completeness sake:
I cannot reproduce it on the dev channel (3.0.0-218.0.dev). It looks like it has indeed been fixed. Thank you your time and quick response.
We have a program that crashes on windows x64 with the latest dart beta version. The crash is likely related to the usage of
typed_data
.It does not crash using the latest stable dart version.
Dart Version (installed using
flutter upgrade
)This is currently the smallest example I have which crashes.
The following output is visible in console. Crash always happens between iteration 3700 and 3800. No error information is printed.
Crash details are visible in windows event log:
The text was updated successfully, but these errors were encountered: