bugLiberty Eiffel - Bugs: bug #62119, deep_twin triggers invariant...


bug #62119: deep_twin triggers invariant violation

Submitter:  Paolo Redaelli <Tybor>
Submitted:  Sat 26 Feb 2022 05:56:36 PM UTC
Category:  Kernel libraries Severity:  4 - Important
Priority:  * 5 - Normal Status:  In Progress
Assigned to:  Tybor Open/Closed:  Open
Release:  None Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 07 Apr 2022 03:28:34 PM UTC, comment #1: 

I've been working on this bug extensively.

It has at least two causes:
1) the content of a STRING is stored in a NATIVE_ARRAY[CHARACTER] which is markedat the end with a "storage_signature", the sequence 0,3,9,27 beyond the nominal end of the array.
2) each deep_twin feature is created by the compiler

The problem is that deep_twin, does not call invoke copy but just copies field-by-field and AFAICS does some assumptions on STRING implementations that are not true when the storage_signature has been applied.

This bug can't be solved at library level but my knowledge of the C back-end is not strong enough.

I have moved the storage_signature logic into debug statement so "normal" compilation modes work fine.

deep_twin also badly interacts with profiling.

I thought to commit the changes into the main trunk but there is too many changes. I will push branch "deep-twin-in-pure-eiffel" to work on all those changes.

Deep_twin also does not work with TUPLEs

Paolo Redaelli <Tybor>
Group administrator
Sat 26 Feb 2022 05:56:36 PM UTC, original submission:  

test/language/memory/test_deep_twin.e compiles but when run it triggers an invariant violation:

* Error at Run Time *: Class Invariant Violation.
* Error at Run Time *: storage_signature_count > 0 implies (has_storage_signature implies check_valid_storage_signature)
3 frames in run-time stack.

Bottom of run-time stack

<system root>
Current = TEST_DEEP_TWIN#0x55d8d3677308
[ assertion_level = 0
line 13 column 4 file /mnt/dati/paolo/liberty-eiffel/test/language/memory/test_deep_twin.e
Current = TEST_DEEP_TWIN#0x55d8d3677308
[ assertion_level = 0
foo = "text2"
aux = AUX_DEEP_TWIN#0x55d8d3679318
[ item = "text2"
aux_twin = AUX_DEEP_TWIN#0x55d8d3679330
[ item = "text2"
aux_deep_twin = AUX_DEEP_TWIN#0x55d8d3679348
[ item = "text1"
line 34 column 45 file /mnt/dati/paolo/liberty-eiffel/test/language/memory/test_deep_twin.e
invariant STRING
Current = "text1"
line 305 column 71 file /home/paolo/liberty-eiffel/src/lib/string/natively_stored_string.e

Top of run-time stack

* Error at Run Time *: Class Invariant Violation.
* Error at Run Time *: storage_signature_count > 0 implies (has_storage_signature implies check_valid_storage_signature)

Paolo Redaelli <Tybor>
Group administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by Tybor (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-0159.
    Corresponding source code