maxime-esa / asn1scc

ASN1SCC: An open source ASN.1 compiler for embedded systems
https://www.thanassis.space/asn1.html
Other
267 stars 58 forks source link

ATC does not set `exists` correctly for PRESENT components #275

Closed sfiruch closed 11 months ago

sfiruch commented 11 months ago

Repro

./asn1scc -c --uper-enc -atc --field-prefix AUTO --type-prefix T PUS-14-10.asn1 DiagnosticParameterReportForwardControl.asn1 ApplicationProcess.asn1 DiagnosticParameterReportStructure.asn1 BasicTypes.asn1 SubsamplingRate.asn1

Service-14-10.zip

Build ATC with Visual Studio 2022 (v143), SDK 10.0, x64

Expected behaviour

Actual behaviour

Test case test_case_UPER_000001 failed in encoding.
========================================
Test case test_case_UPER_000002 failed in encoding.
========================================
Test case test_case_UPER_000003 failed in encoding.
========================================
Test case test_case_UPER_000004 failed in encoding.
========================================
Test case test_case_UPER_000005 failed in encoding.
========================================
Test case test_case_UPER_000006 failed in encoding.
========================================
Test case test_case_UPER_000010 failed in encoding.
========================================
Test case test_case_UPER_000011 failed in encoding.
========================================
Test case test_case_UPER_000016 failed in encoding.
========================================
Test case test_case_UPER_000017 failed in encoding.
========================================
Test case test_case_UPER_000100 failed in encoding.
========================================
Test case test_case_UPER_000101 failed in encoding.
========================================
12 out of 139 failed.

Analysis

TC(14,10) is defined using

DiagnosticParameterStructure-ID-ConfigurationSubsampling ::= DiagnosticParameterStructure-ID-ConfigurationGeneric
{DiagnosticParameterReportStructure-ID, NULL}
(WITH COMPONENTS
{
    subsamplingRate PRESENT
})

We see from this definition that the subsamplingRate must be present. However, the generated ATC code does not set exists to 1, which leads to the encoding failure.

usr3-1415 commented 11 months ago

fixed