[Bug lto/55113] ICE with LTO and -fshort-double

pmatos at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 26 21:03:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55113

--- Comment #13 from pmatos at gcc dot gnu.org ---
(In reply to Richard Biener from comment #11)
> If double_type_node is FE dependent then it needs treatment in
> tree-streamer.c:preload_common_nodes:
> 
> static void
> preload_common_nodes (struct streamer_tree_cache_d *cache)
> {
>   unsigned i;
> 
>   for (i = 0; i < itk_none; i++)
>     /* Skip itk_char.  char_type_node is dependent on -f[un]signed-char.  */
>     if (i != itk_char)
>       record_common_node (cache, integer_types[i]);
> 
>   for (i = 0; i < stk_type_kind_last; i++)
>     record_common_node (cache, sizetype_tab[i]);
> 
>   for (i = 0; i < TI_MAX; i++)
>     /* Skip boolean type and constants, they are frontend dependent.  */
>     if (i != TI_BOOLEAN_TYPE
>         && i != TI_BOOLEAN_FALSE
>         && i != TI_BOOLEAN_TRUE)
>       record_common_node (cache, global_trees[i]);
> }

Richard,
I tried what you suggested but led me nowhere. In the meantime I noticed that
-fshort-double shows up in COLLECT_GCC_OPTIONS before collect2 is called:

COLLECT_GCC_OPTIONS='-fshort-double' '-flto' '-nostdlib' '-o' 'test'
'-save-temps' '-v' '-da' '-fdump-tree-all-all' '-mcpu=8540'

/home/pmatos/work/pr55113/top-4_8/toolchain/install/libexec/gcc/powerpc-eabispe/4.8.3/collect2
-plugin
/home/pmatos/work/pr55113/top-4_8/toolchain/install/libexec/gcc/powerpc-eabispe/4.8.3/liblto_plugin.so
-plugin-opt=/home/pmatos/work/pr55113/top-4_8/toolchain/install/libexec/gcc/powerpc-eabispe/4.8.3/lto-wrapper
-plugin-opt=-fresolution=pr55113.res -flto
--sysroot=/home/pmatos/work/pr55113/top-4_8/toolchain/prex_sysroot
--eh-frame-hdr -V -dn -Bstatic -o test
-L/home/pmatos/work/pr55113/top-4_8/toolchain/install/lib/gcc/powerpc-eabispe/4.8.3
-L/home/pmatos/work/pr55113/top-4_8/toolchain/install/lib/gcc/powerpc-eabispe/4.8.3/../../../../powerpc-eabispe/lib
pr55113.o

but not after when lto1 is called:
COLLECT_GCC_OPTIONS='-c' '-mcpu=8540' '-nostdlib' '-save-temps' '-v' '-da'
'-fdump-tree-all-all' '-mcpu=8540' '-dumpdir' './' '-dumpbase' 'test.wpa'
'-fltrans-output-list=test.ltrans.out' '-fwpa' '-fresolution=pr55113.res'

/home/pmatos/work/pr55113/top-4_8/toolchain/install/libexec/gcc/powerpc-eabispe/4.8.3/lto1
-quiet -da -dumpdir ./ -dumpbase test.wpa -mcpu=8540 -mcpu=8540 -auxbase
pr55113 -version -fdump-tree-all-all -fltrans-output-list=test.ltrans.out -fwpa
-fresolution=pr55113.res @/tmp/ccW7YQPl

Somewhere along the line the option is lost. It seems to be that only some
options are kept and optimization options are lost, like fshort-double.
However, in lto/lto-lang.c:lto_init you have:
  /* Create the basic integer types.  */
  build_common_tree_nodes (flag_signed_char, /*short_double=*/false);

This hardcodes short double to false. If I were to hardcode this to true,
Patricks example would work.

I think similarly to what we do in c-family/c-common.c:
  build_common_tree_nodes (flag_signed_char, flag_short_double);

we need to pass flag_short_double but the only way to do so is by letting
fshort-double pass through the flag filtering that goes on before lto1 is
called.

I will prepare a patch to add this exception, let me know if you think there's
a better way.



More information about the Gcc-bugs mailing list