TASTE bugtrack - Taste
View Issue Details
0000807Taste[All Projects] ASN.1 Compiler v4public2018-09-19 13:422019-03-18 17:20
normalminorhave not tried
0000807: Optional field and ACN size determinant
Consider this grammar : 1 │ D DEFINITIONS ::= 2 │ BEGIN 3 │ T1 ::= SEQUENCE { 4 │ a SEQUENCE (SIZE (1..10)) OF BOOLEAN OPTIONAL, 5 │ b BOOLEAN 6 │ } 7 │ T2 ::= T1 (WITH COMPONENTS { a ABSENT }) 8 │ END And the corresponding ACN : 1 │ D DEFINITIONS ::= BEGIN 2 │ 3 │ T1[] { 4 │ length INTEGER [size 32, encoding pos-int], 5 │ a [size length], 6 │ b [] 7 │ } 8 │ 9 │ T2[] The field "length" added in T1 to act as length determinant of the field "a" is inherited by T2. However T2 has no field "a" as it is optional in T1 and absent in T2. That's an issue: how can we exclude the "length" field from T2 ?
No tags attached.
related to 0000543closed gmamais "WITH COMPONENTS" and ACN 
Issue History
2018-09-19 13:42maximeNew Issue
2018-09-19 13:42maximeStatusnew => assigned
2018-09-19 13:42maximeAssigned To => gmamais
2018-09-22 12:31gmamaisNote Added: 0003472
2018-09-22 12:31gmamaisStatusassigned => resolved
2018-09-22 12:31gmamaisResolutionopen => fixed
2018-09-22 17:21maximeNote Added: 0003474
2018-09-22 17:21maximeNote Edited: 0003474View Revisions
2018-09-22 17:22maximeNote Edited: 0003474View Revisions
2018-09-22 17:23maximeNote Edited: 0003474View Revisions
2018-09-22 17:26maximeNote Edited: 0003474View Revisions
2018-09-22 17:27maximeNote Edited: 0003472View Revisions
2018-09-22 17:27maximeNote Edited: 0003472View Revisions
2018-09-23 05:50gmamaisNote Added: 0003477
2018-09-23 05:50gmamaisStatusresolved => assigned
2018-09-23 09:15maximeNote Added: 0003478
2018-09-23 09:15maximeNote Edited: 0003478View Revisions
2018-09-23 09:22maximeRelationship addedrelated to 0000543
2019-03-18 17:20gmamaisNote Added: 0003591
2019-03-18 17:20gmamaisStatusassigned => resolved

2018-09-22 12:31   
(edited on: 2018-09-22 17:27)
Issue fixed. What I did is not to copy the ACN spec information for reference types that have with components constraints. Before this fix, T2 copied T1 encoding spec (i.e. it had the length ACN field etc). Now, T2 does not copy the T1 ACN information. In this case, T2 will be encoded using the default behavior. It is possible to redefine T2 ACN spec by providing information e.g. T2[] { a [] dummy NULL [pattern '0100'B] b [true-value '1111'B] }
2018-09-22 17:21   
(edited on: 2018-09-22 17:26)
Amazing. Thanks. How about this grammar: 1 │ Non-Generic ::= SEQUENCE { 2 │ cmds SEQUENCE (SIZE (0 .. 10)) OF BOOLEAN 3 │ } 4 │ 5 │ Another-One ::= Non-Generic (WITH COMPONENTS { cmds (SIZE (1)) }) 6 │ in uPER the subtype constraint is ignored, but in ACN, it should replace the one of the super-type. If the size is fixed to size 1, the subtype Another-One should have no "length" field when encoded in ACN.
2018-09-23 05:50   
The fact is that when we initially designed ACN we introduced a "single basic rule" that when no ACN encoding properties are provided in a given type then this type should be encoded as in uPER. Then we discovered some issues with the above rule when using WITH COMPONENT constraints that restrict some fields to be always absent or present. Therefore ACN deviates from "single basic rule" that with component constraints that affect the presence/absence of fields are visible in ACN (although are not visible in uPER). However, the other type of WITH COMPONENT constraints that affect the type (not presence/absence) like the one you provide are still ignored by the current implementation of ACN. Probably, we should change this and make all WITH COMPONENT constraints visible to ACN (and not just the absence/presence). In this case, the encoding would behave exactly as you suggest. Please tell me if you wish to proceed with the above change. I realize that WITH COMPONENT constraints are used a lot in the real world grammars since they a provide a layer of abstraction and therefore are very important.
2018-09-23 09:15   
Agreed (with history and way forward). Let's go for it. This brings a lot of added value to ACN, which then can be used to produce encodings that are better than PER with no additional effort for the user. In the same spirit, CHOICE constraints could handle this case: 18 │ Choice-Generic ::= CHOICE { 19 │ a BOOLEAN, 20 │ b Non-Generic, 21 │ c Another-One 22 │ } 23 │ 24 │ Sub-Choice ::= Choice-Generic (WITH COMPONENTS { a ABSENT, c ABSENT }) Sub-Choice could have no determinant field (only one possible choice here), and if only a subset of choices is kept, the choice determinant would take it into account (this is not the case in the ICD right now).
2019-03-18 17:20   
all new issues are OK. Please see the new test case v4Tests/test-cases/acn/16-mantis/0000807b.asn1 which demonstrates the new features