Hi,
you are correct that Debug and Release build target are different. Default debug build target is suitable in project development phase, when you do not want to deal with assembler, compiler and linker settings.
Your notice about optimization is little bit worrying. If you set highest optimization level, C code should be executed without any errors.
Release build target is primary determined for project, which will not be debugged and will be loaded to final product. But from my point of view, if you are working on the project, you should edit compiler and linker settings on your own, because every project need own settings. This is the reason, why there is not any documentation or recommendation how to use build targets, because the ones, which are available are let's say "examples", how it could look like.
About optimization, I recommend you to read GCC documentation.
Using the GNU Compiler Collection (GCC)
If you have any other questions, please feel free to write me back.
Regards,
Martin