Is it ok to compile files with different gcc optimization levels for same application?

Viewed 657

I have an application which generally used the gcc optimization flag -O0 (no optimization). Now I have a file opt.c which I would like to compile with -O1, and leave rest of the files with -O0.

To be more specific, opt.c has a large for loop, which performs some simple arithmetic.

Finally only 1 executable is created which has all the files plus the opt.c. I am not sure if this causes any issue!

1 Answers
Related