Bug 62150

Summary: [5.0 regression] test case g++.dg/ext/arm-fp16/fp16-mangle-1.C failed on ARM
Product: gcc Reporter: bin.cheng <amker.cheng>
Component: c++Assignee: Jason Merrill <jason>
Status: RESOLVED FIXED    
Severity: normal CC: jason, ramana
Priority: P3 Keywords: wrong-code
Version: 5.0   
Target Milestone: ---   
Host: Target: arm
Build: Known to work: 4.8.3, 4.9.0, 4.9.1
Known to fail: 5.0 Last reconfirmed: 2014-08-19 00:00:00

Description bin.cheng 2014-08-15 02:25:45 UTC
Hi,
The test case is like below.
/* { 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;

But the generated assembly code is like.

	.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)"

In which _ZN1SIDhDhE1iE is weak, rather than global.

This starts from r213307 and as stated by Jason at https://gcc.gnu.org/ml/gcc-patches/2014-08/msg01483.html.  It is a bug?

I know little about c++, so better leave it to an expert.

Thanks very much.
Comment 1 Ramana Radhakrishnan 2014-08-19 13:58:54 UTC
Confirmed.
Comment 2 wangzheyu 2014-08-20 03:48:53 UTC
Also happened on thumb1/thumb2.
Comment 3 Jason Merrill 2014-08-22 20:04:22 UTC
Fixed by r214177.