-
Notifications
You must be signed in to change notification settings - Fork 412
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
Console crash if break is evaluated on foreach-face loop #3991
Comments
That is not the expected behavior. The minimal code to reproduce it is:
|
… loop) Note: the root cause of the crash is not fixed.
In order to properly escape from nested code, throw an exception:
|
Thanks Doc, in that case I prefer to let the loop end completely, since I'm not sure if wrapping it with catch will have a higher computational cost, so when you can determine a way to break the loop, if there is one, I can always use it in my code. Reading the break help I thought it was applicable in foreach-face:
DESCRIPTION: REFINEMENTS: So it seems rather to indicate that it applies to all types of loop, which is very useful. |
The computational cost in an interactive environment should rarely matter. Users are slow. ;^) Applying to all types of loops is great in theory, but how do you determine what a loop is? e.g. |
Thanks Gregg, with Doc's explanation I clearly saw that it is my confusion It occurs to me that it could be a use-case, where it is interesting to break
|
There is zero overhead running code in a |
Thx Doc, I may test This days I'm replacing occurrences with much logical operators like |
@dockimbel I believe at this point ticket can be closed. |
@9214 The crash has not been fixed, just a workaround provided. Such crash should never happen, even with faulty Red code. |
* FIX: help error info will be printed to buffer * FIX: issue #3333 (dump-reactions instabilities and regression since march) where `is` produces a wrong excessive reaction * TESTS: for PR #3884 partly fixing issue #3333 * FIX: issues #3087 (Console size is not defined when script starts), #3678 (`help` is often useless when invoked from within a CLI script) * FIX: issue #3835 (wrong rounded cornors ) * FIX: issue #3835 (capture window with title bar) * FIX: issue #3951 (parse-macros don't get substituted anymore) Extra fix for #3927. * FIX: issue #3835 (combine title bar and nsview to avoid some lost area) * FIX: issue #3545 (set the text to "", if it has no value) * TESTS: add test for #3951. * FIX: issue #3883 (Compiled code does not follow standard operator precedence rules) * FIX: issue #3961 (gui-console crashed on macOS) * TESTS: adds test for issue #3961. * FIX: macOS: issue #3980 (`layout/parent` causes access violation) * FIX: issue #3776 (update button image) * FIX: issue #3776 (free the unused image list) * FIX: issue #3795 (dpi scale issue for event/offset) * FIX: issue #3741 (over/away's event/offset not right) * FIX: issue #3619 (event/picked return none, if menu's id not be set) * FIX: use more clear value * FIX: issue #3805 ([CRASH] when reactor!/on-change* is overridden) * FIX: issue #3768 (sort with comparator function returning number sorts incorrectly) * FIX: issue #3771 (Inside a function macros expand only once) * TESTS: adds runtime preprocessor tests. This file is not included yet in the tests suite, as it crashes badly, so need preliminary investigation and fixing. * TEST: update SORT tests. * FIX: issue #3759 (`round/to/floor -2.4 1.0` should equal `round/to/floor -2.4 1` ) * FEAT: round/to support time! * FIX: issue #1957 (REFLECT not defined on string! vector! binary! and hash!) * FEAT: code refactoring in port type to remove unnecessary extra code. * FIX: issue #2554 (Fields of error value can be set, with fatal result) * FIX: issue #2688 (SAVE does not accept binary! as destination) * FIX: make SAVE preserve the formatting of a molded argument value. Example: save %src.red :append print read %src.red * FIX: issue #2659 (Programming error and strange decision in comparing pairs) * FIX: issue #395 (Console crash if break is evaluated on foreach-face loop) Note: the root cause of the crash is not fixed. * FIX: issue #3991 (Console crash if break is evaluated on foreach-face loop) Note: the root cause of the crash is not fixed. * FIX: issue #2657 (Inconsistency in comparing object with error) * FIX: issue #2792 (revert #1558 e85962, and no crashing) * FIX: issue #2658 (Strange algorithm for comparing objects) * FIX: issue #2184 (Tests float-divide 37, 38, 47, & 48 fail on Windows.) * FIX: workaround float loading issues for tests in #2184. Cross-platform float loading issues documented in #3993. * FIX: additional workaround for ARM in float tests fro #2184. * FIX: issue #2662 (comparison of time and integer is inconsistent) * FIX: Win: flickering when drag the `drag me` button in view-test.red * FIX: gui-console doesn't quit properly in some cases. * FIX: paste text not be prompted on macOS * FIX: issue #3427 (`parse/part` meets `end` = strange behavior) * TESTS: adds regression tests for #3427. * FEAT: adds thread.reds in runtime. * FIX: issue #3653 (expand-directives allows a paren argument, but this always errors out) * FIX: issue #2556 (Wrong error message when setting event component other than type) * FIX: renames a few function names in %thread.reds. * FIX: rename %thread.reds to %threads.reds. * FIX: issue #2646 (make op! allows invalid construction syntax / returned op! causes crash) * FIX: issue #2660 (Pairs are wrongly compared for greater etc) * FIX: issue #3104 (map: same date keys treated differently because of hidden timezone state) * FIX: issue #3143 (trim/lines resulting in vertical block) * FIX: issue #3187 (DOC: Red/System literal arrays may contain c-strings, contrary to what is stated in the syntax) * TESTS: adds test for issue #3636 * FIX: issue #3356 (spec block in OBJECT! and FUNCTION! is used from head rather than from index) * FIX: issue #3395 (max and min are not compatible with > and <) * FIX: issue #3522 (return spec of modify action is incorrrect) * FIX: minor comments re-indentation. * FEAT: console support history * FIX: insert line at history head in cli console * FIX: rename save-cfg like internal function * FIX: update max if insert line on history * FIX: add cli config file to include.r * FIX: red.exe create cli issue * FIX: issue #3406 (`construct` result is order-dependent) * TESTS: add tests for #3406. * FIX: same ordering issue as #3406 for `make <obj> <proto>` pattern. * FEAT: check uncompressed data size in decompress/zlib. * FEAT: adds support for system/cpu/fence for setting a memory ordering barrier. The barrier is a sequentially consistent fence type. * FIX: removes some unused local words. * FEAT: preliminary support for atomic operations using system/atomic/* Note: system/cpu/fence was moved to system/atomic/fence. * FEAT: adds support for system/atomic/cas. * FEAT: adds get-word support for pointer argument after atomic/cas and atomic/<op>. * TESTS: add some tests for atomic operations. * TESTS: add test for CAS operation. * TEST: add some failed cases in atomic tests. * FEAT: improved the implementation of atomic operations. The pointer argument can now be any expression returning a pointer! value. * FEAT: adds support for system/atomic/<op>/old, returning the old value. * FEAT: adds a FIFO MPMC queue in R/S. * FEAT: implements system/atomic/fence for ARM. * FEAT: the queue.reds can be compiled now. * TESTS: add tests for R/S queue. * TESTS: add more tests for atomic operations. * FIX: issue #4005 ([View] regression in Windows backend). * FIX: issue #4006 (Pen 'OFF in Draw PUSH block turns the Pen off after the PUSH block on MacOS) * FIX: issue #3077 (`insert` key work for richtext) * FEAT: implements system/atomic/load & store for ARM. * FIX: properly set the Tag_CPU_arch in ELF/ARM for newer architectures. * FEAT: implements system/atomic/cas for ARM. * FEAT: minor code reduction. * FEAT: implements atomic math operations for ARM. * FIX: gui-console's context menu shortcuts on macOS * FIX: cannot create thread on POSIX. * FIX: `quit` console can't save config * FIX: extra print when called from other app * FIX: avoid to allocate buffer foreach console input * FIX: improve `terminal initial flow` * FIX: fixes and improves returned value handling in atomic math ops on IA-32. * DOCS: replaces default font Trebuchet MS by Arial. * DOCS: adds description of system/atomic/* intrinsics. * FIX: issue #3997 (Using `#include %file.red` in context will not be compiled successfully) * FIX: Windows: CLI console cannot be compiled. * TESTS: enables the atomic tests and queue tests. (#4011) * TESTS: adds atomic tests and queue tests into the testsuite. * TESTS: adds cdecl calling convention in thread functions on non-Windows platforms. * TESTS: atomic operations are not supported on ARMv5 yet. * TESTS: makes the test framework happy. * FIX: macOS: line properties cannot be set in some cases in DRAW.
FYI the crash output in relevant builds (before the workaround) was:
|
Describe the bug
The Red console crashes if BREAK is evaluated inside a FOREACH-FACE loop
To reproduce
Steps to reproduce the behavior:
Copy this code on console:
Expected behavior
The loop ends and return to the console prompt.
Platform version (please complete the following information)
Tested on W10
Red 0.6.4 for Windows built 15-Aug-2019/19:02:53+02:00 commit #b255dee
The text was updated successfully, but these errors were encountered: