------- Comment #2 from rguenth at gcc dot gnu dot org  2009-12-11 14:25 -------
The issue with strcpy-chk.c is that with WHOPR we end up streaming

const char s1[] = "123";

as DECL_WEAK which causes string_constant () to not look at DECL_INITIAL
and thus the test fails.  Likely the other two are similar.

We do that here:

make_decl_one_only (decl=0xb77d0000, comdat_group=0xb77c8a64)
    at /home/richard/src/trunk/gcc/varasm.c:5765
5762    #ifdef MAKE_DECL_ONE_ONLY
5763          MAKE_DECL_ONE_ONLY (decl);
5764    #endif

which sets DECL_WEAK on elfos.  Called from

#0  make_decl_one_only (decl=0xb77d0000, comdat_group=0xb77c8a64)
    at /home/richard/src/trunk/gcc/varasm.c:5765
#1  0x083cbd8e in write_global_stream (ob=0x8dd8478, encoder=0x8d9a18c)
    at /home/richard/src/trunk/gcc/lto-streamer-out.c:2174

                  if (pointer_set_insert (decls_already_emitted, t))
                    make_decl_one_only (t, DECL_ASSEMBLER_NAME (t));

rather than making the decl one-only we should emit true external references
here (or for this particular case localize the variable if we know its
address is not refered to).  We could maybe also resort to TREE_ASM_WRITTEN
(that's the only thing that "fixes" this testcase).

This bug isn't particularly bad but the testsuite FAILs are annoying at least.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dnovillo at gcc dot gnu dot
                   |                            |org
  GCC build triplet|hppa-unknown-linux-gnu      |
   GCC host triplet|hppa-unknown-linux-gnu      |
 GCC target triplet|hppa-unknown-linux-gnu      |
           Keywords|                            |lto, missed-optimization


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

Reply via email to