Bug 9 - local class and -O1
Summary: local class and -O1
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 3.0.x
Assignee: Jason Merrill
Keywords: rejects-valid
Depends on:
Reported: 2000-02-29 02:06 UTC by martin
Modified: 2019-01-18 00:55 UTC (History)
3 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description martin 2000-02-29 02:06:00 UTC
[Original report in <38B5D906.B3544CB9@mbox337.swipnet.se>]
I'm not sure if this a bug, but g++ with -O0 accept it but fail to link
with -O1.

g++ --verbose -O1 prog.cc
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/specs
gcc version 2.95.1 19990816 (release)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/cpp -lang-c++ -v
-D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__
-Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__
-D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -D__OPTIMIZE__
-Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686
-Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ prog.cc
GNU CPP version 2.95.1 19990816 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:


End of search list.
The following default directories have been omitted from the search
End of omitted list.
/tmp/cc1V6mke.ii -quiet -dumpbase prog.cc -O1 -version -o
GNU C++ version 2.95.1 19990816 (release) (i686-pc-linux-gnu) compiled
by GNU C version 2.95.1 19990816 (release).
 as -V -Qy -o /tmp/ccMLXzsi.o /tmp/cc9xhG3f.s
GNU assembler version 2.9.1 (i386-redhat-linux), using BFD version
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/collect2 -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o
-L/usr/local/i686-pc-linux-gnu/lib -L/usr/local/lib /tmp/ccMLXzsi.o
-lstdc++ -lm -lgcc -lc -lgcc
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/crtend.o /usr/lib/crtn.o
/tmp/ccMLXzsi.o(.gnu.linkonce.d.__vt_Q29bar__Fv.0_1D+0x8): undefined
reference to `f__CQ29bar__Fv.0_1D.6'
collect2: ld returned 1 exit status

gcc version 2.96 20000221 (experimental) gives the same result.


System: Linux mira 2.3.48 #4 Sun Feb 27 23:26:02 CET 2000 i586 unknown
Architecture: i586

class B
    virtual void f() const = 0;

foo(B const &)


  class D : public B
    void f() const

 foo (D());

  return 0;
Comment 1 Martin v. Loewis 2000-03-08 23:02:06 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed as a bug
Comment 2 Martin v. Loewis 2000-03-09 07:02:06 UTC
From: loewis@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, martin@loewis.home.cs.tu-berlin.de,
  nobody@gcc.gnu.org, ulf.larsson@mbox337.swipnet.se
Subject: Re: c++/9
Date: 9 Mar 2000 07:02:06 -0000

 Synopsis: local class and -O1
 State-Changed-From-To: open->analyzed
 State-Changed-By: loewis
 State-Changed-When: Wed Mar  8 23:02:06 2000
     Confirmed as a bug 

Comment 3 Jason Merrill 2000-07-11 12:37:38 UTC
Severity-Changed-From-To: critical-serious
Severity-Changed-Why: Can work around with -O0.
Comment 4 Jason Merrill 2000-08-08 17:43:03 UTC
Responsible-Changed-From-To: unassigned->jason
Comment 5 Jason Merrill 2000-08-08 17:43:12 UTC
State-Changed-From-To: analyzed-feedback
State-Changed-Why: Fixed for gcc 3.0.
Comment 6 Neil Booth 2000-11-25 07:25:01 UTC
State-Changed-From-To: feedback->closed
State-Changed-Why: Fixed in CVS.  No feedback is forthcoming; I don't think
    we need to wait for it (we don't for other fixes).
Comment 7 Neil Booth 2000-11-25 15:25:01 UTC
From: neil@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, jason@gcc.gnu.org,
  martin@loewis.home.cs.tu-berlin.de, ulf.larsson@mbox337.swipnet.se
Subject: Re: c++/9
Date: 25 Nov 2000 15:25:01 -0000

 Synopsis: local class and -O1
 State-Changed-From-To: feedback->closed
 State-Changed-By: neil
 State-Changed-When: Sat Nov 25 07:25:01 2000
     Fixed in CVS.  No feedback is forthcoming; I don't think
     we need to wait for it (we don't for other fixes).
Comment 8 Steve Kargl 2019-01-18 00:01:53 UTC
On Thu, Jan 17, 2019 at 11:55:38PM +0000, sje at gcc dot gnu.org wrote:
> --- Comment #4 from Steve Ellcey <sje at gcc dot gnu.org> ---
> I think this is my fault.  My patch shouldn't have affected x86 at all but I
> see my build/test on x86 only tested C and C++, I didn't have Fortran
> configured in when I checked for regressions.

Thanks for the quick reply.  Your commit and Andrew's
came in about the same time.  I haven't had a chance
to backout different revisions to narrow down the
Comment 9 Steve Kargl 2019-01-18 00:55:11 UTC
On Fri, Jan 18, 2019 at 12:42:12AM +0000, sje at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88898
> --- Comment #6 from Steve Ellcey <sje at gcc dot gnu.org> ---
> Author: sje
> Date: Fri Jan 18 00:41:40 2019
> New Revision: 268054
> URL: https://gcc.gnu.org/viewcvs?rev=268054&root=gcc&view=rev
> Log:
> 2018-01-17  Steve Ellcey  <sellcey@cavium.com>
>         PR fortran/88898
>         * gfortran.dg/gomp/declare-simd-2.f90: Add aarch64 target specifier to
>         warning checks.
>         * gfortran.dg/gomp/pr79154-1.f90: Ditto.
>         * gfortran.dg/gomp/pr83977.f90: Ditto.
> Modified:
>     trunk/gcc/testsuite/ChangeLog
>     trunk/gcc/testsuite/gfortran.dg/gomp/declare-simd-2.f90
>     trunk/gcc/testsuite/gfortran.dg/gomp/pr79154-1.f90
>     trunk/gcc/testsuite/gfortran.dg/gomp/pr83977.f90

I can confirm that the patch has fixed the regression.
Do you want to close the PR or would you rather have
me do it?