http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51622
Bug #: 51622 Summary: GCC generates bad code that generate big executable sizes when using _Decimal* Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: mingo...@gmail.com Created attachment 26140 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26140 Program and a batch file to show how strange is gcc code generation when using _Decimal* The main point here is to demonstrate that gcc is capable to generate good code size when using _Decimal* but for some reason it get lost with some code combinations and generates very big executables unnecessarily making a bad balance between functionality/size. Here is a program that demonstrate that gcc is generating bad code resulting in big executables when using _Decimal*. There is a main.c with several operations on _Decimal64, few on _Decimal128 with some combination of the code (with all operations) the final executable file is 8KB but with a different combination (again with all operations) the executable is 2.206KB or 2.2MB. This last one is very strange because the diference betwen then is calling a printf to print several existing _Decimal64 variable (the biggest 2.2MB) and calling a printf to print only one existing _Decimal64 variable ((double)discount_over_sales the smallest 8KB but if we try to any other existing variables it goes to 2.2MB). gcc -s -O2 -DWITH_TMP main.c -o smallest.exe -> 8KB gcc -s -O2 -DWITH_ONE_BIG_PRINTF -DWITH_TMP main.c -o strange-big-size-jump.exe -> 2.206KB or 2.2MB gcc -s -O2 main.c -o good1.exe -> 8KB gcc -s -O2 -DWITH_DEC128 -DWITH_ISNAN -DWITH_MPRINTF main.c printf.c -o biggest.exe -> 2.444KB or 2.4MB gcc -s -O2 -DWITH_MPRINTF main.c printf.c -o optimus.exe -> 154KB gcc -s -O2 -DWITH_DEC128 -DWITH_MPRINTF main.c printf.c -o good2.exe -> 367KB