diff mbox

[testcase] fix failure of g++.dg/ext/arm-fp16/fp16-mangle-1.C

Message ID 000f01cfb79a$36c94380$a45bca80$@arm.com
State New
Headers show

Commit Message

Bin Cheng Aug. 14, 2014, 8:31 a.m. UTC
Hi,
g++.dg/ext/arm-fp16/fp16-mangle-1.C is failed because GCC now sets
DECL_COMDAT on template instantiations if flag_implicit_templates is in
effect.  Then DECL_WEAK will be set accordingly.  As a result, checking for
".global xxxx" would fail on this case.

This patch fixes this by relaxing scanning string into ".global|weak xxxx"
just in case it's still global if some options are specified explicitly.

Since the change is made by
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=213307.
Hi Jason, could you help me here that I understood the issue correctly?
Thanks very much.

Thanks,
bin

gcc/testsuite/ChangeLog
2014-08-14  Bin Cheng  <bin.cheng@arm.com>

	* g++.dg/ext/arm-fp16/fp16-mangle-1.C: Also check .weak.

Comments

Jason Merrill Aug. 14, 2014, 3:18 p.m. UTC | #1
On 08/14/2014 04:31 AM, Bin Cheng wrote:
> g++.dg/ext/arm-fp16/fp16-mangle-1.C is failed because GCC now sets
> DECL_COMDAT on template instantiations if flag_implicit_templates is in
> effect.  Then DECL_WEAK will be set accordingly.   As a result, checking for
> ".global xxxx" would fail on this case.

But i in this testcase is an explicit specialization, not an 
instantiation, so this is a bug.

Jason
Bin.Cheng Aug. 15, 2014, 2:26 a.m. UTC | #2
On Thu, Aug 14, 2014 at 11:18 PM, Jason Merrill <jason@redhat.com> wrote:
> On 08/14/2014 04:31 AM, Bin Cheng wrote:
>>
>> g++.dg/ext/arm-fp16/fp16-mangle-1.C is failed because GCC now sets
>> DECL_COMDAT on template instantiations if flag_implicit_templates is in
>> effect.  Then DECL_WEAK will be set accordingly.   As a result, checking
>> for
>> ".global xxxx" would fail on this case.
>
>
> But i in this testcase is an explicit specialization, not an instantiation,
> so this is a bug.
Thanks for clarifying, I raised a bug at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62150

Thanks,
bin
>
> Jason
>
diff mbox

Patch

Index: gcc/testsuite/g++.dg/ext/arm-fp16/fp16-mangle-1.C
===================================================================
--- gcc/testsuite/g++.dg/ext/arm-fp16/fp16-mangle-1.C	(revision 213809)
+++ gcc/testsuite/g++.dg/ext/arm-fp16/fp16-mangle-1.C	(working copy)
@@ -9,6 +9,6 @@  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; }; 
+/* { dg-final { scan-assembler "\t.global|weak\t_ZN1SIDhDhE1iE" } } */
+template <typename T, typename U> struct S { static int i; };
 template <> int S<__fp16, __fp16>::i = 3;