Public bug reported: May be I made a mistake in the code, but the situation looks like a bug. The problem belongs to gcc-7 and gcc-8.
Local variable E is created. The constructor successfully fills the field E.t2.number with the value of -1.0. After calling of an empty function with a const reference to tuple, the value of E.t2.number is overwritten unexpectedly. The attached code stores the value of E.t2.number before calling and after calling of an empty function and then prints both. The following line is printed with the preprocessed code attached: v_before=-1.000000, v_after=0.000000 Compilation under Release configuration in Eclipse CDT generates another code. In this situation the variable E.t2.number is not initialized properly. In this case the following result is printed: v_before=0.000000, v_after=0.000000 Unfortunately, I failed to create such preprocessed code. If I use -E option and links the prerocessed code with g++-8, the value is initialized with -1.0 successfully and it corrupts only after the calling of an empty function. The suspicious code: ... void func(const std::tuple<int>& t) { } int main() { ... auto E=A(I,J)-B(J,I); double v_before=E.t2.number; func(std::tuple<int>(1)); double v_after=E.t2.number; printf("v_before=%lf, v_after=%lf\n",v_before, v_after); } ** Affects: gcc-7 (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1835536 Title: Stack-located variable is overwritten unexpectedly To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gcc-7/+bug/1835536/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs