diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-06-20 13:17:31 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-06-23 15:44:42 +0200 |
| commit | 6b14ba5c2fbc2810bb62a87008e338cca571acf6 (patch) | |
| tree | 839b9faf7e13b849b8ae89618d3eecb80d8e4a84 /tests/auto/qml/qmlcppcodegen/data/Categorizer.qml | |
| parent | 32602bef7c40261cbe61d72e8cf043feb3734d3e (diff) | |
QmlCompiler: Discern between different kinds of side effects
A mere jump does not cause all value types and lists to be invalidated.
Only calls to other functions or writes to other properties do that.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-137540
Change-Id: I069c6873455c51bbea59cf876d2bc7ecd188f81b
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/data/Categorizer.qml')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/data/Categorizer.qml | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/data/Categorizer.qml b/tests/auto/qml/qmlcppcodegen/data/Categorizer.qml index 7ced17c37f..6650ce349c 100644 --- a/tests/auto/qml/qmlcppcodegen/data/Categorizer.qml +++ b/tests/auto/qml/qmlcppcodegen/data/Categorizer.qml @@ -2,9 +2,11 @@ pragma Strict import QtQml QtObject { + id: root + enum Parameters { Length = 32, - Iterations = 32768, + Iterations = 2, Category0 = 0xf0f, Category1 = 0xf0f0, @@ -29,4 +31,28 @@ QtObject { result[i] = randomNumber(); return result; } + + function sum() : list<double> { + var numbers = root.numbers; + + var cat1Sum = 0; + var cat2Sum = 0; + var cat3Sum = 0; + var huge = 0; + for (var i = 0; i < Categorizer.Iterations; ++i) { + for (var j = 0; j < Categorizer.Length; ++j) { + var num = numbers[j] & Categorizer.Mask; + if (num < Categorizer.Category0) + cat1Sum += num; + else if (num < Categorizer.Category1) + cat2Sum += num; + else if (num < Categorizer.Category2) + cat3Sum += num; + else + huge += num; + } + } + + return [cat1Sum, cat2Sum, cat3Sum, huge]; + } } |
