Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • T titan.EclipsePlug-ins
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 102
    • Issues 102
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Eclipse ProjectsEclipse Projects
  • Eclipse Titan
  • titan.EclipsePlug-ins
  • Issues
  • #431
Closed
Open
Issue created Jul 21, 2021 by Adam Knapp@aknappqwtMaintainer

CROSSTAG(OTHERWISE) one 1 field union generates incorrect Java code

Copy of titan.core#560 (closed)

Summary

CROSSTAG(OTHERWISE) one 1 field union generates incorrect C++ code and therefore it should be checked whether the generated Java code is ok or not

Steps and/or TTCN-3 code to reproduce

Following TTCN3 code compiles fine, but generates incorrect C++ code:

type union PCUIF_ContainerMsgUnion {
	octetstring	other
} with { variant "" };

type record PCUIF_container {
	uint8_t		msg_type,
	uint8_t		spare,
	uint16_t	len,
	PCUIF_ContainerMsgUnion	u
} with {
	variant (len) "LENGTHTO(u)"
	variant (u) "CROSSTAG(
			other, 	OTHERWISE)"
};

Then when C++ code is compiled:

g++  -c -DLINUX -DMAKEDEPEND_RUN -DUSE_SCTP -DLKSCTP_MULTIHOMING_ENABLED -I/usr/ttcn3/include -fPIC   -o RSL_Emulation.o RSL_Emulation.cc
PCUIF_Types.cc: In member function ‘int PCUIF__Types::PCUIF__container::RAW_decode(const TTCN_Typedescriptor_t&, TTCN_Buffer&, int, raw_order_t, boolean, int, boolean, const RAW_Force_Omit*)’:
PCUIF_Types.cc:31342:3: error: ‘else’ without a previous ‘if’
31342 |   else selected_field = 0;
      |   ^~~~

So it seems the TTCN3->C++ compiler is missing checking specific cases where the union (or the CROSSTAG) has only 1 OTHERWISE option.

Rationale for TTCN3 code shown above: I wrote that TTCN3 code since I'm implementing the container layer without having yet any specific message in top of it specified, which will come later. Hence I wanted to have some octetstring on top to send random data to test only up to the container layer, while leaving the TTCN3 records prepared to add new container payload data in the future.

Titan version

6.6.1

/cc @aknappqwt

Assignee
Assign to
Time tracking

Copyright © Eclipse Foundation, Inc. All Rights Reserved.     Privacy Policy | Terms of Use | Copyright Agent