[lto/55113] Fix use of -fshort-double with -flto for powerpc
diff mbox

Message ID CAFiYyc10yNFWi-13e9BAv9WqR6FJtywWtR4=_efVrGHJNduM8Q@mail.gmail.com
State New
Headers show

Commit Message

Richard Biener March 3, 2014, 9:56 a.m. UTC
On Sat, Mar 1, 2014 at 11:23 PM, Paulo J. Matos <paulo@matos-sorge.com> wrote:
>
> 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  <paulo@matos-sorge.com>
>
>         * 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  <paulo@matos-sorge.com>
>
>         * gcc.target/powerpc/pr55113.c: New testcase.
>
>
> OK to commit?


that doesn't seem to be run with -flto nor -fshort-double.  The proper
place for a testcase is gcc.dg/lto/ with sth like

{ dg-lto-do link }
{ dg-lto-options { { -O2 -fshort-double -flto } } }

and naming the testcase pr55113_0.c.  Your testcase doens't use
doubles at all ... (well, ok, a + b * 1e-12 uses them implicitely, but
for that we have fsingle-precision-constant)

Richard.

> --
> PMatos

Patch
diff mbox

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

This hunk isn't needed.

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;
+}