Tool/software: TI C/C++ Compiler
Hello,
We found minor issue, which manifested with newer CGT (older CGT isn't affected). We're not sure, if this is bug or improvement in new compiler. Here is sample code, which triggers error:
typedef unsigned int u32;
template <bool TYPE> struct TestStruct {};
template <> struct TestStruct<false>
{
static const u32 value = 0;
};
template <> struct TestStruct<true>
{
u32 value;
void init(u32 val) { value = val; }
};
int main()
{
u32 i=0;
TestStruct<false> TF;
TestStruct<true> TT;
if(i < TF.value)
{
;
}
TT.init(0);
if(i < TT.value)
{
;
}
TT.init(3);
if(i < TT.value)
{
;
}
return 0;
}
signedUnsignedTemplate_issue_for_TI.zip
In our case, we have "for" loop with template member to be checked in condition and this could be problematic, because it disturbs templatization. What is also worth to mention is fact, that putting "volatile" additionally to line 7 "solves" issue, so it means, that probably aggresive optimisation takes place here. On the other hand, affected code based on bad design rather and we need to refactor it somehow. Nevertheless, we would like to know, if new compiler isn't too overprotective in this respect.
If this is a bug, then please include fix together with RSA intrinsics in new release.
Best Regards,
ZD