Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • T titan.core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 49
    • Issues 49
    • 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 Projects
  • Eclipse Titan
  • titan.core
  • Issues
  • #560

Closed
Open
Created Jul 19, 2021 by Lenard Nagy@lnagyMaintainer

CROSSTAG(OTHERWISE) one 1 field union generates incorrect C++ code

Original Bugzilla bug written by Pau Espin Pedrol: https://bugs.eclipse.org/bugs/show_bug.cgi?id=574469

Summary

CROSSTAG(OTHERWISE) one 1 field union generates incorrect C++ code

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

Edited Jul 21, 2021 by Adam Knapp
Assignee
Assign to
Time tracking

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