https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83032

--- Comment #2 from Antony Polukhin <antoshkka at gmail dot com> ---
> I don't think that's one of the cases where the C++ standard allows elision

Yes, you're right (currently I try to convince C++ standard pepole that
allowing it could be benefical).

But C does not forbit such optimization. Following code could benefit from it:


typedef struct big_ { char data[1024];} big;
struct ts {big a; big b; };
struct ts foo();

big testing1() {
    return foo().b;
}

> So it could only work if the region was at the extremity of the stack and the 
> stack grows in the right direction?

Yes, right. But in the above example it could save you from memcpy.

Reply via email to