https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

bin.cheng <amker.cheng at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amker.cheng at gmail dot com

--- Comment #21 from bin.cheng <amker.cheng at gmail dot com> ---
(In reply to Jason Merrill from comment #18)
> Author: jason
> Date: Wed Jul 30 17:27:14 2014
> New Revision: 213307
> 
> URL: https://gcc.gnu.org/viewcvs?rev=213307&root=gcc&view=rev
> Log:
>       PR lto/53808
>       PR c++/61659
>       * pt.c (push_template_decl_real): Set DECL_COMDAT on templates.
>       (check_explicit_specialization): Clear it on specializations.
>       * decl.c (duplicate_decls, start_decl): Likewise.
>       (grokmethod, grokfndecl): Set DECL_COMDAT on inlines.
>       * method.c (implicitly_declare_fn): Set DECL_COMDAT.  Determine
>       linkage after setting the appropriate flags.
>       * tree.c (decl_linkage): Don't check DECL_COMDAT.
>       * decl2.c (mark_needed): Mark clones.
>       (import_export_decl): Not here.
> 
> Modified:
>     trunk/gcc/cp/ChangeLog
>     trunk/gcc/cp/decl.c
>     trunk/gcc/cp/decl2.c
>     trunk/gcc/cp/method.c
>     trunk/gcc/cp/pt.c
>     trunk/gcc/cp/tree.c
>     trunk/gcc/testsuite/g++.dg/opt/devirt4.C

Hi Jason,
After setting DECL_COMDAT, testcase g++.dg/ext/arm-fp16/fp16-mangle-1.C as
below no longer works.

/* { dg-do compile { target arm*-*-* } } */
/* { dg-options "-mfp16-format=ieee" } */

/* Test mangling */

/* { dg-final { scan-assembler "\t.global\t_Z1fPDh" } } */
void f (__fp16 *x) { }

/* { dg-final { scan-assembler "\t.global\t_Z1gPDhS_" } } */
void g (__fp16 *x, __fp16 *y) { }

/* { dg-final { scan-assembler "\t.global\t_ZN1SIDhDhE1iE" } } */
template <typename T, typename U> struct S { static int i; }; 
template <> int S<__fp16, __fp16>::i = 3;

Since g++ now outputs:

    .weak    _ZN1SIDhDhE1iE
    .section    .data._ZN1SIDhDhE1iE,"awG",%progbits,_ZN1SIDhDhE1iE,comdat
    .align    2
    .type    _ZN1SIDhDhE1iE, %object
    .size    _ZN1SIDhDhE1iE, 4
_ZN1SIDhDhE1iE:
    .word    3
    .ident    "GCC: (GNU) 4.10.0 20140811 (experimental)"

rather than ".global\t_ZN1SIDhDhE1iE".

I assume we should refine the testcase? 

Thanks.

Reply via email to