public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60642] New: abi_tag attribute doesn't work on explicit specializations of class templates
@ 2014-03-25  2:21 lukeallardyce at gmail dot com
  2014-03-25 18:41 ` [Bug c++/60642] Unclear diagnostic with invalid use of abi_tag attribute on explicit instantiation redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: lukeallardyce at gmail dot com @ 2014-03-25  2:21 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4341 bytes --]

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

            Bug ID: 60642
           Summary: abi_tag attribute doesn't work on explicit
                    specializations of class templates
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lukeallardyce at gmail dot com

This seems to not be working again in trunk?
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55275)

template<typename T>
class __attribute((abi_tag("foo"))) test{  };

template class __attribute((abi_tag("foo"))) test<int>;

int main() { }

abi_test.cpp:4:46: error: redeclaration of ‘class test<int>’ adds abi tag "foo"
 template class __attribute((abi_tag("foo"))) test<int>;
                                              ^
abi_test.cpp:2:37: note: previous declaration here
 class __attribute((abi_tag("foo"))) test{  };
>From gcc-bugs-return-447344-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 25 03:26:57 2014
Return-Path: <gcc-bugs-return-447344-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 1039 invoked by alias); 25 Mar 2014 03:26:56 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 1022 invoked by uid 48); 25 Mar 2014 03:26:51 -0000
From: "hongxu.jia at windriver dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/60643] New: ICE with -O1 and -g on mips (internal compiler error: in dwarf2out_var_location, at dwarf2out.c:20810)
Date: Tue, 25 Mar 2014 03:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: debug
X-Bugzilla-Version: 4.8.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hongxu.jia at windriver dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-60643-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-03/txt/msg02213.txt.bz2
Content-length: 1455

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`643

            Bug ID: 60643
           Summary: ICE with -O1 and -g on mips (internal compiler error:
                    in dwarf2out_var_location, at dwarf2out.c:20810)
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hongxu.jia at windriver dot com

Created attachment 32440
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id2440&actioníit
the config.log of mips-poky-linux-gcc

I have hit a ICE and could reduce it to the following minimal example:

1. Only the size of array assigned with 2 caused the issue:
$ cat > mipgcc-test.c << END

#include <stdio.h>

#define ARRAY_SIZE_MAX  2

int main (int argc, char **argv)
{
        char *pStrArry[ARRAY_SIZE_MAX] = {"hello"};
        int i = 0;

        while(pStrArry[i] && i<ARRAY_SIZE_MAX)
        {
                printf("%s\n", pStrArry[i]);
                i++;
        }

        return 0;
}

END

2. Only -O1 and -g on mips caused the issue:
$ mips-poky-linux-gcc -O1 -g -o mipgcc-test mipgcc-test.c
mipgcc-test.c: In function 'main':
mipgcc-test.c:18:1: internal compiler error: in dwarf2out_var_location, at
dwarf2out.c:20810
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/60642] Unclear diagnostic with invalid use of abi_tag attribute on explicit instantiation
  2014-03-25  2:21 [Bug c++/60642] New: abi_tag attribute doesn't work on explicit specializations of class templates lukeallardyce at gmail dot com
@ 2014-03-25 18:41 ` redi at gcc dot gnu.org
  2014-03-25 23:51 ` lukeallardyce at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-25 18:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-25
            Summary|abi_tag attribute doesn't   |Unclear diagnostic with
                   |work on explicit            |invalid use of abi_tag
                   |specializations of class    |attribute on explicit
                   |templates                   |instantiation
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
That's not a specialization, it's an explicit instantiation, and so you don't
need the tag, it should be simply:

template class test<int>;

The error message could be clearer though, so confirming as a diagnostic bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/60642] Unclear diagnostic with invalid use of abi_tag attribute on explicit instantiation
  2014-03-25  2:21 [Bug c++/60642] New: abi_tag attribute doesn't work on explicit specializations of class templates lukeallardyce at gmail dot com
  2014-03-25 18:41 ` [Bug c++/60642] Unclear diagnostic with invalid use of abi_tag attribute on explicit instantiation redi at gcc dot gnu.org
@ 2014-03-25 23:51 ` lukeallardyce at gmail dot com
  2014-03-26  2:52 ` lukeallardyce at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: lukeallardyce at gmail dot com @ 2014-03-25 23:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Luke Allardyce <lukeallardyce at gmail dot com> ---
I thought the symbols weren't being mangled with the attribute on the
instantiation without the extra tag, but as it turns out they are, sorry.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/60642] Unclear diagnostic with invalid use of abi_tag attribute on explicit instantiation
  2014-03-25  2:21 [Bug c++/60642] New: abi_tag attribute doesn't work on explicit specializations of class templates lukeallardyce at gmail dot com
  2014-03-25 18:41 ` [Bug c++/60642] Unclear diagnostic with invalid use of abi_tag attribute on explicit instantiation redi at gcc dot gnu.org
  2014-03-25 23:51 ` lukeallardyce at gmail dot com
@ 2014-03-26  2:52 ` lukeallardyce at gmail dot com
  2014-03-26 10:53 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: lukeallardyce at gmail dot com @ 2014-03-26  2:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Luke Allardyce <lukeallardyce at gmail dot com> ---
On further inspection it looks like vtable symbols for template classes are not
being tagged

struct __attribute((abi_tag("test"))) foo 
{ 
  void f(); 
  virtual ~foo(); 
};

template<typename>
struct __attribute((abi_tag("test"))) bar
{ 
  void f(); 
  virtual ~bar();
};

extern template class bar<int>;

int main()
{
  foo f;
  f.f();

  bar<int> b;
  b.f();
}

$ g++ test.cpp -c
$ nm test.o 

0000000000000108 s EH_frame1
00000000000000c2 s GCC_except_table0
                 U __Unwind_Resume
                 U __ZN3barB4testIiE1fEv
00000000000000a6 S __ZN3barB4testIiEC1Ev
                 U __ZN3barB4testIiED1Ev
                 U __ZN3fooB4test1fEv
000000000000008a S __ZN3fooB4testC1Ev
                 U __ZN3fooB4testD1Ev
                 U __ZTV3barIiE
                 U __ZTV3fooB4test
                 U ___gxx_personality_v0
0000000000000000 T _main


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/60642] Unclear diagnostic with invalid use of abi_tag attribute on explicit instantiation
  2014-03-25  2:21 [Bug c++/60642] New: abi_tag attribute doesn't work on explicit specializations of class templates lukeallardyce at gmail dot com
                   ` (2 preceding siblings ...)
  2014-03-26  2:52 ` lukeallardyce at gmail dot com
@ 2014-03-26 10:53 ` redi at gcc dot gnu.org
  2014-03-27 21:16 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-26 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Luke Allardyce from comment #3)
> On further inspection it looks like vtable symbols for template classes are
> not being tagged

Let's ask Jason to take a look at that.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/60642] Unclear diagnostic with invalid use of abi_tag attribute on explicit instantiation
  2014-03-25  2:21 [Bug c++/60642] New: abi_tag attribute doesn't work on explicit specializations of class templates lukeallardyce at gmail dot com
                   ` (3 preceding siblings ...)
  2014-03-26 10:53 ` redi at gcc dot gnu.org
@ 2014-03-27 21:16 ` jason at gcc dot gnu.org
  2014-04-01 17:50 ` jason at gcc dot gnu.org
  2014-04-01 19:20 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2014-03-27 21:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ABI
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/60642] Unclear diagnostic with invalid use of abi_tag attribute on explicit instantiation
  2014-03-25  2:21 [Bug c++/60642] New: abi_tag attribute doesn't work on explicit specializations of class templates lukeallardyce at gmail dot com
                   ` (4 preceding siblings ...)
  2014-03-27 21:16 ` jason at gcc dot gnu.org
@ 2014-04-01 17:50 ` jason at gcc dot gnu.org
  2014-04-01 19:20 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2014-04-01 17:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Apr  1 17:49:38 2014
New Revision: 208992

URL: http://gcc.gnu.org/viewcvs?rev=208992&root=gcc&view=rev
Log:
    PR c++/60642
    * decl2.c (is_late_template_attribute): Don't defer abi_tag.
    * mangle.c (write_unqualified_name): Fix abi_tag on templates.
    * pt.c (get_template_info): Handle NAMESPACE_DECL.
    (most_general_template): Handle more kinds of template.
    * tree.c (handle_abi_tag_attribute): Ignore abi_tag on template
    instantiations and specializations.

Added:
    trunk/gcc/testsuite/g++.dg/abi/abi-tag6.C
    trunk/gcc/testsuite/g++.dg/abi/abi-tag7.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/mangle.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/tree.c
    trunk/gcc/doc/extend.texi
    trunk/gcc/testsuite/g++.dg/abi/abi-tag3.C


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/60642] Unclear diagnostic with invalid use of abi_tag attribute on explicit instantiation
  2014-03-25  2:21 [Bug c++/60642] New: abi_tag attribute doesn't work on explicit specializations of class templates lukeallardyce at gmail dot com
                   ` (5 preceding siblings ...)
  2014-04-01 17:50 ` jason at gcc dot gnu.org
@ 2014-04-01 19:20 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2014-04-01 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.0

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.9.  The compiler will now just warn that the attribute on the
explicit instantiation is ignored, and correctly emit the tag on
instantiations.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-04-01 19:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-25  2:21 [Bug c++/60642] New: abi_tag attribute doesn't work on explicit specializations of class templates lukeallardyce at gmail dot com
2014-03-25 18:41 ` [Bug c++/60642] Unclear diagnostic with invalid use of abi_tag attribute on explicit instantiation redi at gcc dot gnu.org
2014-03-25 23:51 ` lukeallardyce at gmail dot com
2014-03-26  2:52 ` lukeallardyce at gmail dot com
2014-03-26 10:53 ` redi at gcc dot gnu.org
2014-03-27 21:16 ` jason at gcc dot gnu.org
2014-04-01 17:50 ` jason at gcc dot gnu.org
2014-04-01 19:20 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).