I've realized a strange code generation behavior I cannot explain and I think to be a bug. It's merely about that a function calls to another one with a parameter read from a constant array. The constant array superfluously gets copied onto the stack.
I've attached the test code with one can reproduce the problem. Compile it with command: gnatmake -c -s bug.adb (copying "manually" byte for byte) gnatmake -c -Os -s bug.adb (copying by calling to memcpy) with objdump -D bug.o you can check the result. -- Summary: Code generation problem with gnat-4.1.2 Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: theorizer at freemail dot hu GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31824