polserver/testsuite/escript/opt
turleypol 56ebd666e6
Fix ShortCircuit jump optimization corrupting assignments (#904)
* Fix ShortCircuit jump optimization corrupting assignments

The short-circuit jump optimizer threaded a logical jump past an
opposite-type logical jump (offset++). That target pops the value on
fall-through (Executor::ins_logical_jump), so skipping it left a stray
value on the stack, which corrupts a following stack-addressed assignment:

    var x := ( a && b ) || ( c && d );

left x uninitialized whenever the first clause was false (i.e. the
deciding clause is not the first operand). The same chain works as an
if() condition or when declaration and assignment are split
( var x; x := ... ).

Only thread same-type logical jumps; keep targeting opposite-type ones so
their fall-through pop still runs.

Adds testsuite/escript/opt/shortcircuit7 exercising the value / assignment
context (companion to shortcircuit6's if()-condition tests).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* removed other unsafe jump merges
additional test

* adapted testdata

* core changes xml

---------

Co-authored-by: Oleksii Rebreniuk <oleksii.rebreniuk@shopit.se>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 12:02:39 +02:00
..
listfile.inc Write filenames and lines into ecompile .lst files (again) (#846) 2026-01-07 22:19:25 +01:00
lstopt01.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt01.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt02.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt02.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt03.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt03.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt04.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt04.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt05.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt05.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt06.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt06.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt07.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt07.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt08.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt08.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt09.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt09.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt10.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt10.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt11.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt11.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt12.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt12.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt13.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt13.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt14.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt14.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt15.out Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
lstopt15.src Escript Optimizer more types and operator (#794) 2025-07-10 22:32:29 +02:00
opt001.out Unit Tests: putting some orde rin escript unit tests 2015-12-19 02:31:08 +01:00
opt001.src Format testsuite scripts, pol-core support modules (#713) 2024-10-04 10:29:55 +02:00
opt002.out Unit Tests: putting some orde rin escript unit tests 2015-12-19 02:31:08 +01:00
opt002.src Format testsuite scripts, pol-core support modules (#713) 2024-10-04 10:29:55 +02:00
opt003.out Unit Tests: putting some orde rin escript unit tests 2015-12-19 02:31:08 +01:00
opt003.src Format testsuite scripts, pol-core support modules (#713) 2024-10-04 10:29:55 +02:00
opt004.out Unit Tests: putting some orde rin escript unit tests 2015-12-19 02:31:08 +01:00
opt004.src Format testsuite scripts, pol-core support modules (#713) 2024-10-04 10:29:55 +02:00
opt005-stopped-optimizing-early.src Format testsuite scripts, pol-core support modules (#713) 2024-10-04 10:29:55 +02:00
opt006.out Add uninit, true, false keywords to grammar (#596) 2024-01-20 05:38:25 +01:00
opt006.src Format testsuite scripts, pol-core support modules (#713) 2024-10-04 10:29:55 +02:00
shortcircuit.out Short Circuit Optimizer (#797) 2025-07-28 21:48:34 +02:00
shortcircuit.src Short Circuit Optimizer (#797) 2025-07-28 21:48:34 +02:00
shortcircuit2.optimized.out Short Circuit Optimizer (#797) 2025-07-28 21:48:34 +02:00
shortcircuit2.out Short Circuit Optimizer (#797) 2025-07-28 21:48:34 +02:00
shortcircuit2.src Short Circuit Optimizer (#797) 2025-07-28 21:48:34 +02:00
shortcircuit3.optimized.out Fix ShortCircuit jump optimization corrupting assignments (#904) 2026-07-23 12:02:39 +02:00
shortcircuit3.out further optimize shortcircuits (#800) 2025-08-12 08:52:50 +02:00
shortcircuit3.src further optimize shortcircuits (#800) 2025-08-12 08:52:50 +02:00
shortcircuit4.optimized.out Fix ShortCircuit jump optimization corrupting assignments (#904) 2026-07-23 12:02:39 +02:00
shortcircuit4.out further optimize shortcircuits (#800) 2025-08-12 08:52:50 +02:00
shortcircuit4.src further optimize shortcircuits (#800) 2025-08-12 08:52:50 +02:00
shortcircuit5.optimized.out Fix ShortCircuit jump optimization corrupting assignments (#904) 2026-07-23 12:02:39 +02:00
shortcircuit5.out Fixed shortcircuit optimization for consecutive jumps (#898) 2026-07-22 12:58:56 +02:00
shortcircuit5.src Fixed shortcircuit optimization for consecutive jumps (#898) 2026-07-22 12:58:56 +02:00
shortcircuit6.optimized.out Fixed shortcircuit optimization for consecutive jumps (#898) 2026-07-22 12:58:56 +02:00
shortcircuit6.out Fixed shortcircuit optimization for consecutive jumps (#898) 2026-07-22 12:58:56 +02:00
shortcircuit6.src Fixed shortcircuit optimization for consecutive jumps (#898) 2026-07-22 12:58:56 +02:00
shortcircuit7.optimized.out Fix ShortCircuit jump optimization corrupting assignments (#904) 2026-07-23 12:02:39 +02:00
shortcircuit7.out Fix ShortCircuit jump optimization corrupting assignments (#904) 2026-07-23 12:02:39 +02:00
shortcircuit7.src Fix ShortCircuit jump optimization corrupting assignments (#904) 2026-07-23 12:02:39 +02:00
shortcircuit8.out Fix ShortCircuit jump optimization corrupting assignments (#904) 2026-07-23 12:02:39 +02:00
shortcircuit8.src Fix ShortCircuit jump optimization corrupting assignments (#904) 2026-07-23 12:02:39 +02:00