public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13057] New: regparm attribute not applied to destructor
@ 2003-11-14 21:16 bryner at brianryner dot com
  2003-11-14 21:16 ` [Bug c++/13057] " bryner at brianryner dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: bryner at brianryner dot com @ 2003-11-14 21:16 UTC (permalink / raw)
  To: gcc-bugs

It appears that giving the regparm(1) attribute on a destructor does not cause
it to pass the |this| pointer in a register.  However, it will pass it in a
register if I give -mregparm=1 on the command line.

This works fine for normal methods, so it seems to be specific to destructors.

-- 
           Summary: regparm attribute not applied to destructor
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bryner at brianryner dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug c++/13057] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
@ 2003-11-14 21:16 ` bryner at brianryner dot com
  2003-11-14 21:20 ` bryner at brianryner dot com
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bryner at brianryner dot com @ 2003-11-14 21:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bryner at brianryner dot com  2003-11-14 21:16 -------
Created an attachment (id=5136)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5136&action=view)
testcase source


-- 


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


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

* [Bug c++/13057] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
  2003-11-14 21:16 ` [Bug c++/13057] " bryner at brianryner dot com
  2003-11-14 21:20 ` bryner at brianryner dot com
@ 2003-11-14 21:20 ` bryner at brianryner dot com
  2003-11-15  2:58 ` [Bug c++/13057] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bryner at brianryner dot com @ 2003-11-14 21:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bryner at brianryner dot com  2003-11-14 21:20 -------
Created an attachment (id=5138)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5138&action=view)
assembly output with -mregparm=1

Compiled the same as previous attachment but with -mregparm=1.

-- 


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


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

* [Bug c++/13057] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
  2003-11-14 21:16 ` [Bug c++/13057] " bryner at brianryner dot com
@ 2003-11-14 21:20 ` bryner at brianryner dot com
  2003-11-14 21:20 ` bryner at brianryner dot com
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bryner at brianryner dot com @ 2003-11-14 21:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bryner at brianryner dot com  2003-11-14 21:20 -------
Created an attachment (id=5137)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5137&action=view)
assembly output without -mregparm

Compiled with:
c++ -fno-exceptions -Os -S -o test_regparm_dtor1.S test_regparm_dtor.cpp

with a CVS trunk build from Oct 27.


-- 


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


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

* [Bug c++/13057] [3.3/3.4 Regression] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
                   ` (2 preceding siblings ...)
  2003-11-14 21:20 ` bryner at brianryner dot com
@ 2003-11-15  2:58 ` pinskia at gcc dot gnu dot org
  2003-11-16  2:22 ` bryner at brianryner dot com
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-15  2:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-15 02:58 -------
Regression from 2.95.3.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-15 02:58:30
               date|                            |
            Summary|regparm attribute not       |[3.3/3.4 Regression] regparm
                   |applied to destructor       |attribute not applied to
                   |                            |destructor
   Target Milestone|---                         |3.3.3
            Version|unknown                     |3.4


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


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

* [Bug c++/13057] [3.3/3.4 Regression] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
                   ` (3 preceding siblings ...)
  2003-11-15  2:58 ` [Bug c++/13057] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2003-11-16  2:22 ` bryner at brianryner dot com
  2003-11-16  3:59 ` bryner at brianryner dot com
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bryner at brianryner dot com @ 2003-11-16  2:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bryner at brianryner dot com  2003-11-16 02:22 -------
I attempted to debug this today... I didn't quite figure out the problem but
maybe this will trigger someone's memory:

The regparm attribute is successfully parsed and attached to the destructor via
decl_attributes().  This calls build_type_attribute_variant() which clones the
node; the attributes are attached to the cloned node.  This happens exactly the
same way for a destructor and a normal method.

When generating the assembly, init_cumulative_args() is called in i386.c which
checks the regparm attribute.  For a normal method, the fntype parameter to this
method is the cloned node from build_type_attribute_variant, which has the
attribute(s) attached to it.  For the destructor, however, fntype is neither the
node passed to decl_attributes nor the clone that was made.  Whatever it is, it
has a null attributes pointer, so no parameters are passed in registers.


-- 


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


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

* [Bug c++/13057] [3.3/3.4 Regression] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
                   ` (4 preceding siblings ...)
  2003-11-16  2:22 ` bryner at brianryner dot com
@ 2003-11-16  3:59 ` bryner at brianryner dot com
  2004-01-06  1:37 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bryner at brianryner dot com @ 2003-11-16  3:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bryner at brianryner dot com  2003-11-16 03:59 -------
(In reply to comment #5)
> attribute(s) attached to it.  For the destructor, however, fntype is neither the
> node passed to decl_attributes nor the clone that was made.  Whatever it is, it
> has a null attributes pointer, so no parameters are passed in registers.
> 

It looks like the node that init_cumulative_args() is called with for the
destructor call is allocated from here:

#1  0x082dc86b in make_node (code=METHOD_TYPE) at ../../gcc/gcc/tree.c:273
#2  0x082dd061 in build_method_type_directly (basetype=0x58,
    rettype=0x4022ac3c, argtypes=0x4022d94c) at ../../gcc/gcc/tree.c:3899
#3  0x08063dc2 in grokdeclarator (declarator=0x402f6640, declspecs=0x0,
    decl_context=FIELD, initialized=0, attrlist=0xbfffe570)
    at ../../gcc/gcc/cp/decl.c:8073
#4  0x0808651d in grokfield (declarator=0x58, declspecs=0x10, init=0x0,
    asmspec_tree=0x0, attrlist=0x402ec9d8) at ../../gcc/gcc/cp/decl2.c:874

This node does not get the destructor's attributes put onto it.

-- 


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


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

* [Bug c++/13057] [3.3/3.4 Regression] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
                   ` (5 preceding siblings ...)
  2003-11-16  3:59 ` bryner at brianryner dot com
@ 2004-01-06  1:37 ` mmitchel at gcc dot gnu dot org
  2004-01-06  2:26 ` cvs-commit at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-01-06  1:37 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/13057] [3.3/3.4 Regression] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
                   ` (6 preceding siblings ...)
  2004-01-06  1:37 ` mmitchel at gcc dot gnu dot org
@ 2004-01-06  2:26 ` cvs-commit at gcc dot gnu dot org
  2004-01-06  2:28 ` [Bug c++/13057] [3.3 " mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-06  2:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-01-06 02:26 -------
Subject: Bug 13057

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-01-06 02:26:14

Modified files:
	gcc/cp         : ChangeLog class.c 

Log message:
	PR c++/13057
	* class.c (build_clone): Copy type attributes from the original
	function to the clone.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3858&r2=1.3859
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.592&r2=1.593



-- 


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


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

* [Bug c++/13057] [3.3 Regression] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
                   ` (8 preceding siblings ...)
  2004-01-06  2:28 ` [Bug c++/13057] [3.3 " mmitchel at gcc dot gnu dot org
@ 2004-01-06  2:28 ` mmitchel at gcc dot gnu dot org
  2004-01-06 16:30 ` gdr at integrable-solutions dot net
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-01-06  2:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-01-06 02:28 -------
Fixed in GCC 3.4.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[3.3/3.4 Regression] regparm|[3.3 Regression] regparm
                   |attribute not applied to    |attribute not applied to
                   |destructor                  |destructor


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


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

* [Bug c++/13057] [3.3 Regression] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
                   ` (7 preceding siblings ...)
  2004-01-06  2:26 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-06  2:28 ` mmitchel at gcc dot gnu dot org
  2004-01-06  2:28 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-01-06  2:28 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|mark at codesourcery dot com|unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug c++/13057] [3.3 Regression] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
                   ` (9 preceding siblings ...)
  2004-01-06  2:28 ` mmitchel at gcc dot gnu dot org
@ 2004-01-06 16:30 ` gdr at integrable-solutions dot net
  2004-01-21  3:41 ` dhazeghi at yahoo dot com
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-01-06 16:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-01-06 16:30 -------
Subject: Re:  [3.3/3.4 Regression] regparm attribute not applied to destructor

"cvs-commit at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| 	PR c++/13057
| 	* class.c (build_clone): Copy type attributes from the original
| 	function to the clone.

I've looked at this patch.  I'm wondering if you believe a backport
would be safe for branch.

-- Gaby


-- 


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


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

* [Bug c++/13057] [3.3 Regression] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
                   ` (10 preceding siblings ...)
  2004-01-06 16:30 ` gdr at integrable-solutions dot net
@ 2004-01-21  3:41 ` dhazeghi at yahoo dot com
  2004-01-21  5:52 ` cvs-commit at gcc dot gnu dot org
  2004-01-21  5:52 ` gdr at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: dhazeghi at yahoo dot com @ 2004-01-21  3:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dhazeghi at yahoo dot com  2004-01-21 03:41 -------
Patch applies cleanly to branch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug c++/13057] [3.3 Regression] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
                   ` (12 preceding siblings ...)
  2004-01-21  5:52 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-21  5:52 ` gdr at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-01-21  5:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-01-21 05:52 -------
Subject: Bug 13057

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	gdr@gcc.gnu.org	2004-01-21 05:52:30

Modified files:
	gcc/cp         : ChangeLog class.c 

Log message:
	Backport from mainline
	2004-01-05  Mark Mitchell  <mark@codesourcery.com>
	
	PR c++/13057
	* class.c (build_clone): Copy type attributes from the original
	function to the clone.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.239&r2=1.3076.2.240
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.499.2.26&r2=1.499.2.27


------- Additional Comments From gdr at gcc dot gnu dot org  2004-01-21 05:52 -------
Fixed with backport from mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug c++/13057] [3.3 Regression] regparm attribute not applied to destructor
  2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
                   ` (11 preceding siblings ...)
  2004-01-21  3:41 ` dhazeghi at yahoo dot com
@ 2004-01-21  5:52 ` cvs-commit at gcc dot gnu dot org
  2004-01-21  5:52 ` gdr at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-21  5:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-01-21 05:52 -------
Subject: Bug 13057

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	gdr@gcc.gnu.org	2004-01-21 05:52:30

Modified files:
	gcc/cp         : ChangeLog class.c 

Log message:
	Backport from mainline
	2004-01-05  Mark Mitchell  <mark@codesourcery.com>
	
	PR c++/13057
	* class.c (build_clone): Copy type attributes from the original
	function to the clone.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.239&r2=1.3076.2.240
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.499.2.26&r2=1.499.2.27


------- Additional Comments From gdr at gcc dot gnu dot org  2004-01-21 05:52 -------
Fixed with backport from mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2004-01-21  5:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-14 21:16 [Bug c++/13057] New: regparm attribute not applied to destructor bryner at brianryner dot com
2003-11-14 21:16 ` [Bug c++/13057] " bryner at brianryner dot com
2003-11-14 21:20 ` bryner at brianryner dot com
2003-11-14 21:20 ` bryner at brianryner dot com
2003-11-15  2:58 ` [Bug c++/13057] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
2003-11-16  2:22 ` bryner at brianryner dot com
2003-11-16  3:59 ` bryner at brianryner dot com
2004-01-06  1:37 ` mmitchel at gcc dot gnu dot org
2004-01-06  2:26 ` cvs-commit at gcc dot gnu dot org
2004-01-06  2:28 ` [Bug c++/13057] [3.3 " mmitchel at gcc dot gnu dot org
2004-01-06  2:28 ` mmitchel at gcc dot gnu dot org
2004-01-06 16:30 ` gdr at integrable-solutions dot net
2004-01-21  3:41 ` dhazeghi at yahoo dot com
2004-01-21  5:52 ` cvs-commit at gcc dot gnu dot org
2004-01-21  5:52 ` gdr at gcc dot gnu dot 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).