On Sun, 23 Jan 2022, Vishal Subramanyam via Gcc-help wrote:
is there a specific name for the type of optimization where the compiler simply decides to drop the return value.
Gcc handles this as part of dead code elimination (among others). A simpler example would be
int main(){ 1/0; } which does not crash either.If you want to make your function func opaque to the optimizers, you may be interested in __attribute__((noipa)). Using volatile would also avoid some optimizations.
-- Marc Glisse