RVO is always applied, if possible. For your case, assuming myFunction1() does not return different named objects depending on the path of execution, the compiler should perform RVO. If it returns different named objects with different execution path, then the compiler is not able to perform optimization.
I recommend to do your own experiments:
To disable optimization everywhere, use pragmas:
#pragma GCC push_options
#pragma GCC optimize (ARG)
//your code
#pragma GCC pop_options
To disable optimization for a specific function, use __attribute__(()):
void __attribute__((optimize(ARG))) foo(unsigned char data) {
// your code
}
ARG can either be numbers (i.e. an optimization level) or strings starting with 0 (i.e. an optimization option) and etc. For what you need, you can substitute ARG with "O0" Then run the both versions of your code using gcc -S to see the difference. I recommend you to read gcc 4.4 or newer doc.