This patch fixes lto/55113 for powerpc.
Combining -fshort-double with -flto is now working fine.
I attach patch and testcase (unsure if testcase is in the right place).
Tested with target powerpc-abispe.
2014-03-01 Paulo Matos <[email protected]>
* c-family/c.opt: Add LTO FE support for fshort-double option.
* tree-streamer.c (record_common_node): Assert we don't record
nodes with type double.
(preload_common_node): Skip type double, complex double and
double pointer since it is now frontend dependent due to
fshort-double option.
2014-03-01 Paulo Matos <[email protected]>
* gcc.target/powerpc/pr55113.c: New testcase.
OK to commit?
--
PMatos
Index: gcc/c-family/c.opt
===================================================================
--- gcc/c-family/c.opt (revision 208249)
+++ gcc/c-family/c.opt (working copy)
@@ -1141,7 +1141,7 @@ C++ ObjC++ Optimization Var(flag_rtti) I
Generate run time type descriptor information
fshort-double
-C ObjC C++ ObjC++ Optimization Var(flag_short_double)
+C ObjC C++ ObjC++ LTO Optimization Var(flag_short_double)
Use the same size for double as for float
fshort-enums
Index: gcc/tree-streamer.c
===================================================================
--- gcc/tree-streamer.c (revision 208249)
+++ gcc/tree-streamer.c (working copy)
@@ -264,7 +264,8 @@ record_common_node (struct streamer_tree
gcc_checking_assert (node != boolean_type_node
&& node != boolean_true_node
- && node != boolean_false_node);
+ && node != boolean_false_node
+ && node != double_type_node);
/* We have to make sure to fill exactly the same number of
elements for all frontends. That can include NULL trees.
@@ -315,10 +316,14 @@ preload_common_nodes (struct streamer_tr
record_common_node (cache, sizetype_tab[i]);
for (i = 0; i < TI_MAX; i++)
- /* Skip boolean type and constants, they are frontend dependent. */
+ /* Skip boolean type and constants. They are frontend dependent.
+ Skip double type, frontend dependent due to -fshort-double. */
if (i != TI_BOOLEAN_TYPE
&& i != TI_BOOLEAN_FALSE
- && i != TI_BOOLEAN_TRUE)
+ && i != TI_BOOLEAN_TRUE
+ && i != TI_DOUBLE_TYPE
+ && i != TI_COMPLEX_DOUBLE_TYPE
+ && i != TI_DOUBLE_PTR_TYPE)
record_common_node (cache, global_trees[i]);
}
Index: gcc/testsuite/gcc.target/powerpc/pr55113.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/pr55113.c (revision 0)
+++ gcc/testsuite/gcc.target/powerpc/pr55113.c (working copy)
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+int main()
+{
+ static float f;
+ float a = 1.0;
+ float b = 2.0;
+ f = a + b * 1e-12;
+ printf("%f\n", f);
+ return 0;
+}