public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17530] New: 4.0: failure to emit inline function
@ 2004-09-17  2:39 gcc-bugzilla at gcc dot gnu dot org
  2004-09-17  3:26 ` [Bug c++/17530] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-09-17  2:39 UTC (permalink / raw)
  To: gcc-bugs



When the source below is compiled, gcc emits a reference to the
inline function `B::staticfunc' but not the definition:

$ ./cc1plus  -quiet x.cc
$ grep staticfunc x.s
        pushl   $_ZN1B10staticfuncEv
$

For this example, this happens only when optimization is off; when
optimization is on, everything gets completely inlined and the problem
disappears.  However, in the original source from which this example
was derived, the problem was observed even with optimization on.

Environment:
System: Linux karma 2.6.8.1 #20 Mon Sep 13 23:48:47 EDT 2004 i686 i686 i386 GNU/Linux
Architecture: i686

	<machine, os, target, libraries (multiple lines)>
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /home/sss/gcc/gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long --enable-languages=c,c++,f95

How-To-Repeat:

Compile the source below:

------------------------------------
typedef void (*Func) ();

struct A
{
  A (Func) {}
};

struct B
{
  static void staticfunc () {}
};

template <class T>
struct C
{
  C() : a (B::staticfunc) {}
  A a;
};

int main ()
{
  C<int> c;
  return 0;
}
------------------------------------
------- Additional Comments From snyder at fnal dot gov  2004-09-17 02:39 -------
Fix:
	<how to correct or work around the problem, if known (multiple lines)>

-- 
           Summary: 4.0: failure to emit inline function
           Product: gcc
           Version: 0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: snyder at fnal dot gov
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/17530] [4.0 Regression] failure to emit inline function
  2004-09-17  2:39 [Bug c++/17530] New: 4.0: failure to emit inline function gcc-bugzilla at gcc dot gnu dot org
@ 2004-09-17  3:26 ` pinskia at gcc dot gnu dot org
  2004-09-21  2:29 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-17  3:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-17 03:26 -------
Confirmed, here is a little smaller testcase which shows what is interacting with what:
typedef void (*Func) ();
void f (Func) {}
struct B
{
  static void staticfunc () {} // <-- moving the function out from the class
};
template <int>  // <-- removing the template fixes it
void C(){ f (B::staticfunc); }
int main ()
{
  C<0>();
  return 0;
}

using Phil's regresion hunter:
between 20040729 and 20040730 is where the problem started which is when Mark's change to move 
to always unit-at-a-time for C++.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-17 03:26:56
               date|                            |
            Summary|4.0: failure to emit inline |[4.0 Regression] failure to
                   |function                    |emit inline function
   Target Milestone|---                         |4.0.0
            Version|0.0                         |4.0.0


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


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

* [Bug c++/17530] [4.0 Regression] failure to emit inline function
  2004-09-17  2:39 [Bug c++/17530] New: 4.0: failure to emit inline function gcc-bugzilla at gcc dot gnu dot org
  2004-09-17  3:26 ` [Bug c++/17530] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-09-21  2:29 ` mmitchel at gcc dot gnu dot org
  2004-09-21  5:44 ` cvs-commit at gcc dot gnu dot org
  2004-09-21  5:57 ` mmitchel at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-09-21  2:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-09-21 02:29 -------
Working on a fix.

-- 
           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=17530


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

* [Bug c++/17530] [4.0 Regression] failure to emit inline function
  2004-09-17  2:39 [Bug c++/17530] New: 4.0: failure to emit inline function gcc-bugzilla at gcc dot gnu dot org
  2004-09-17  3:26 ` [Bug c++/17530] [4.0 Regression] " pinskia at gcc dot gnu dot org
  2004-09-21  2:29 ` mmitchel at gcc dot gnu dot org
@ 2004-09-21  5:44 ` cvs-commit at gcc dot gnu dot org
  2004-09-21  5:57 ` mmitchel at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-09-21  5:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-09-21 05:44 -------
Subject: Bug 17530

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-09-21 05:44:10

Modified files:
	gcc/cp         : ChangeLog pt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: static7.C 

Log message:
	PR c++/17530
	* pt.c (tsubst): Fix parentheses to accomodate emacs.
	(tsubst_baselink): If we get a single function, mark it as used.
	
	PR c++/17530
	* g++.dg/template/static7.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4368&r2=1.4369
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.924&r2=1.925
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4323&r2=1.4324
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static7.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/17530] [4.0 Regression] failure to emit inline function
  2004-09-17  2:39 [Bug c++/17530] New: 4.0: failure to emit inline function gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-09-21  5:44 ` cvs-commit at gcc dot gnu dot org
@ 2004-09-21  5:57 ` mmitchel at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-09-21  5:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-09-21 05:57 -------
Fixed in GCC 4.0.

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


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


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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-17  2:39 [Bug c++/17530] New: 4.0: failure to emit inline function gcc-bugzilla at gcc dot gnu dot org
2004-09-17  3:26 ` [Bug c++/17530] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-09-21  2:29 ` mmitchel at gcc dot gnu dot org
2004-09-21  5:44 ` cvs-commit at gcc dot gnu dot org
2004-09-21  5:57 ` mmitchel 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).