Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[4diac-dev] Error compiling EXPT function

Hello!

There is a problem with EXPT function if it is used with REAL variable
and a literal value (see attached test FB)

IDE: 1.14
FORTE: 1.14

Is this a known bug? As a workaround it is possible to use an internal
variable instead of the literal value.

BR
Zwax
<?xml version="1.0" encoding="UTF-8"?>
<FBType Name="ExptTest" Comment="Basic FB with empty ECC">
	<Identification Standard="61499-2">
	</Identification>
	<VersionInfo Version="1.0" Author="zwax" Date="2021-10-01">
	</VersionInfo>
	<InterfaceList>
		<EventInputs>
			<Event Name="REQ" Type="Event" Comment="">
				<With Var="INVAL"/>
			</Event>
		</EventInputs>
		<EventOutputs>
			<Event Name="CNF" Type="Event" Comment="">
				<With Var="OUTVAL"/>
			</Event>
		</EventOutputs>
		<InputVars>
			<VarDeclaration Name="INVAL" Type="REAL" Comment="" InitialValue="0"/>
		</InputVars>
		<OutputVars>
			<VarDeclaration Name="OUTVAL" Type="REAL" Comment="" InitialValue="0"/>
		</OutputVars>
	</InterfaceList>
	<BasicFB>
		<InternalVars>
			<VarDeclaration Name="EXP_VAL" Type="REAL" Comment="" InitialValue="0.42"/>
		</InternalVars>
		<ECC>
			<ECState Name="START" Comment="Initial State" x="550.0" y="425.0">
			</ECState>
			<ECState Name="REQ" Comment="" x="500.0" y="875.0">
				<ECAction Algorithm="TestExptAlg" Output="CNF"/>
			</ECState>
			<ECTransition Source="START" Destination="REQ" Condition="REQ" Comment="" x="850.0" y="743.75"/>
			<ECTransition Source="REQ" Destination="START" Condition="1" Comment="" x="306.25" y="700.0"/>
		</ECC>
		<Algorithm Name="TestExptAlg" Comment="">
			<ST><![CDATA[OUTVAL := EXPT(INVAL, 0.42);]]></ST>
		</Algorithm>
	</BasicFB>
</FBType>
/data/4diac/forte-1.14.0/src/core/iec61131_functions.h: In instantiation of ‘const T EXPT(const T&, const U&) [with T = CIEC_REAL; U = double]’:
/data/4diac/forte-1.14.0/src/modules/meo/ExptTest.cpp:56:38:   required from here
/data/4diac/forte-1.14.0/src/core/iec61131_functions.h:406:49: error: call of overloaded ‘pow(const CIEC_REAL&, const double&)’ is ambiguous
  406 |   return static_cast<typename T::TValueType>(pow(pa_roIN1, pa_roIN2));
      |                                              ~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdint.h:26,
                 from /usr/lib/gcc/x86_64-linux-gnu/9/include/stdint.h:9,
                 from /data/4diac/forte-1.14.0/src/arch/datatype.h:20,
                 from /data/4diac/forte-1.14.0/bin/posix/forte_config.h:17,
                 from /data/4diac/forte-1.14.0/src/core/funcbloc.h:20,
                 from /data/4diac/forte-1.14.0/src/core/basicfb.h:17,
                 from /data/4diac/forte-1.14.0/src/modules/meo/ExptTest.h:15,
                 from /data/4diac/forte-1.14.0/src/modules/meo/ExptTest.cpp:12:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:140:1: note: candidate: ‘double pow(double, double)’
  140 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
      | ^~~~~~~~~~~~~~
In file included from /usr/include/c++/9/math.h:36,
                 from /data/4diac/forte-1.14.0/src/core/datatypes/convert/convert_functions.h:45,
                 from /data/4diac/forte-1.14.0/src/core/iec61131_functions.h:20,
                 from /data/4diac/forte-1.14.0/src/core/funcbloc.h:27,
                 from /data/4diac/forte-1.14.0/src/core/basicfb.h:17,
                 from /data/4diac/forte-1.14.0/src/modules/meo/ExptTest.h:15,
                 from /data/4diac/forte-1.14.0/src/modules/meo/ExptTest.cpp:12:
/usr/include/c++/9/cmath:392:3: note: candidate: ‘constexpr long double std::pow(long double, long double)’
  392 |   pow(long double __x, long double __y)
      |   ^~~
/usr/include/c++/9/cmath:388:3: note: candidate: ‘constexpr float std::pow(float, float)’
  388 |   pow(float __x, float __y)
      |   ^~~


Back to the top