public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65009] New: g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os
@ 2015-02-10 23:23 truckman at FreeBSD dot org
  2015-02-11  0:11 ` [Bug c++/65009] " truckman at FreeBSD dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: truckman at FreeBSD dot org @ 2015-02-10 23:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65009

            Bug ID: 65009
           Summary: g++ 4.9 sometimes leaves inline methods undefined when
                    compiling with -Os
           Product: gcc
           Version: 4.9.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: truckman at FreeBSD dot org

# g++49 -v
Using built-in specs.
COLLECT_GCC=g++49
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc49/gcc/i386-portbld-freebsd8.4/4.9.3/lto-wrapper
Target: i386-portbld-freebsd8.4
Configured with: ./../gcc-4.9-20150204/configure
--with-build-config=bootstrap-debug --disable-nls
--enable-gnu-indirect-function --libdir=/usr/local/lib/gcc49
--libexecdir=/usr/local/libexec/gcc49 --program-suffix=49
--with-as=/usr/local/bin/as --with-gmp=/usr/local
--with-gxx-include-dir=/usr/local/lib/gcc49/include/c++/
--with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local
--with-pkgversion='FreeBSD Ports Collection' --with-system-zlib
--with-ecj-jar=/usr/local/share/java/ecj-4.5.jar
--enable-languages=c,c++,objc,fortran,java --prefix=/usr/local
--mandir=/usr/local/man --infodir=/usr/local/info/gcc49
--build=i386-portbld-freebsd8.4
Thread model: posix
gcc version 4.9.3 20150204 (prerelease) (FreeBSD Ports Collection) 


When compiling at the -Os optimization level, g++ 4.9 sometimes leaves
undefined symbols in the resulting .o file.  In the example below, this causing
a fatal linker error when trying to build a shared library that includes this
.o file.  This problem does not occur when compiling with -O0 optimization, and
does not occur with g++ 4.8.

In this example, the following class methods are inline:
  KeyListenerMultiplexer::acquire()
  FocusListenerMultiplexer::acquire()
  MouseListenerMultiplexer::acquire()
  PaintListenerMultiplexer::acquire()
  WindowListenerMultiplexer::acquire()
  MouseMotionListenerMultiplexer::acquire()

When the code is compiled with g++ 4.9 and -Os, the .o file contains undefined
symbols for them.  This does not happen with g++ 4.8 or when compiling with
-O0.

Broken:

# g++49 -fPIC -fmessage-length=0 -fno-common -fno-strict-aliasing
-fno-use-cxa-atexit -fvisibility-inlines-hidden -fvisibility=hidden
-fexceptions -fno-enforce-eh-specs -Os -c fmgridif.ii -Wall -o fmgridif.o
# nm fmgridif.o | grep 'ListenerMultiplexer'              U
_ZThn24_N22KeyListenerMultiplexer7acquireEv
         U _ZThn24_N24FocusListenerMultiplexer7acquireEv
         U _ZThn24_N24MouseListenerMultiplexer7acquireEv
         U _ZThn24_N24PaintListenerMultiplexer7acquireEv
         U _ZThn24_N25WindowListenerMultiplexer7acquireEv
         U _ZThn24_N30MouseMotionListenerMultiplexer7acquireEv
#


Works:

# g++49 -fPIC -fmessage-length=0 -fno-common -fno-strict-aliasing
-fno-use-cxa-atexit -fvisibility-inlines-hidden -fvisibility=hidden
-fexceptions -fno-enforce-eh-specs -O0 -c fmgridif.ii -Wall -o fmgridif.o
# nm fmgridif.o | grep 'ListenerMultiplexer'
#

Works:

# g++48 -fPIC -fmessage-length=0 -fno-common -fno-strict-aliasing
-fno-use-cxa-atexit -fvisibility-inlines-hidden -fvisibility=hidden
-fexceptions -fno-enforce-eh-specs -Os -c fmgridif.ii -Wall -o fmgridif.o
# nm fmgridif.o | grep 'ListenerMultiplexer'
#


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

* [Bug c++/65009] g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os
  2015-02-10 23:23 [Bug c++/65009] New: g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os truckman at FreeBSD dot org
@ 2015-02-11  0:11 ` truckman at FreeBSD dot org
  2015-02-11  9:20 ` [Bug c++/65009] [4.9 Regression] " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: truckman at FreeBSD dot org @ 2015-02-11  0:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65009

--- Comment #1 from Don Lewis <truckman at FreeBSD dot org> ---
Created attachment 34719
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34719&action=edit
example code that generates undefined symbols for inline methods when compiled
with -Os


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

* [Bug c++/65009] [4.9 Regression] g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os
  2015-02-10 23:23 [Bug c++/65009] New: g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os truckman at FreeBSD dot org
  2015-02-11  0:11 ` [Bug c++/65009] " truckman at FreeBSD dot org
@ 2015-02-11  9:20 ` jakub at gcc dot gnu.org
  2015-02-11  9:43 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-11  9:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65009

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-02-11
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |4.9.3
            Summary|g++ 4.9 sometimes leaves    |[4.9 Regression] g++ 4.9
                   |inline methods undefined    |sometimes leaves inline
                   |when compiling with -Os     |methods undefined when
                   |                            |compiling with -Os
     Ever confirmed|0                           |1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Bisected to r206042, related to devirtualization.  Since that commit there is:
         U _ZThn24_N22KeyListenerMultiplexer7acquireEv
         U _ZThn24_N24FocusListenerMultiplexer7acquireEv
         U _ZThn24_N24MouseListenerMultiplexer7acquireEv
         U _ZThn24_N24PaintListenerMultiplexer7acquireEv
         U _ZThn24_N25WindowListenerMultiplexer7acquireEv
         U _ZThn24_N30MouseMotionListenerMultiplexer7acquireEv
Stopped on the trunk with r215902, since then there is:
00000000 W _ZN22KeyListenerMultiplexer7acquireEv
00000000 W _ZN23ListenerMultiplexerBase7acquireEv
00000000 W _ZN24FocusListenerMultiplexer7acquireEv
00000000 W _ZN24MouseListenerMultiplexer7acquireEv
00000000 W _ZN24PaintListenerMultiplexer7acquireEv
00000000 W _ZN25WindowListenerMultiplexer7acquireEv
00000000 W _ZN30MouseMotionListenerMultiplexer7acquireEv
00000009 W _ZThn24_N22KeyListenerMultiplexer7acquireEv
00000009 W _ZThn24_N24FocusListenerMultiplexer7acquireEv
00000009 W _ZThn24_N24MouseListenerMultiplexer7acquireEv
00000009 W _ZThn24_N24PaintListenerMultiplexer7acquireEv
00000009 W _ZThn24_N25WindowListenerMultiplexer7acquireEv
00000009 W _ZThn24_N30MouseMotionListenerMultiplexer7acquireEv
Still reproduceable on the 4.9 branch.


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

* [Bug c++/65009] [4.9 Regression] g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os
  2015-02-10 23:23 [Bug c++/65009] New: g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os truckman at FreeBSD dot org
  2015-02-11  0:11 ` [Bug c++/65009] " truckman at FreeBSD dot org
  2015-02-11  9:20 ` [Bug c++/65009] [4.9 Regression] " jakub at gcc dot gnu.org
@ 2015-02-11  9:43 ` rguenth at gcc dot gnu.org
  2015-06-26 20:01 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-11  9:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65009

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Priority|P3                          |P2
      Known to work|                            |4.8.3, 5.0
      Known to fail|                            |4.9.0


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

* [Bug c++/65009] [4.9 Regression] g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os
  2015-02-10 23:23 [Bug c++/65009] New: g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os truckman at FreeBSD dot org
                   ` (2 preceding siblings ...)
  2015-02-11  9:43 ` rguenth at gcc dot gnu.org
@ 2015-06-26 20:01 ` jakub at gcc dot gnu.org
  2015-06-26 20:31 ` jakub at gcc dot gnu.org
  2015-09-05  5:59 ` truckman at FreeBSD dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-26 20:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65009

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.9.3 has been released.


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

* [Bug c++/65009] [4.9 Regression] g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os
  2015-02-10 23:23 [Bug c++/65009] New: g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os truckman at FreeBSD dot org
                   ` (3 preceding siblings ...)
  2015-06-26 20:01 ` jakub at gcc dot gnu.org
@ 2015-06-26 20:31 ` jakub at gcc dot gnu.org
  2015-09-05  5:59 ` truckman at FreeBSD dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-26 20:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65009

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.9.3                       |4.9.4


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

* [Bug c++/65009] [4.9 Regression] g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os
  2015-02-10 23:23 [Bug c++/65009] New: g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os truckman at FreeBSD dot org
                   ` (4 preceding siblings ...)
  2015-06-26 20:31 ` jakub at gcc dot gnu.org
@ 2015-09-05  5:59 ` truckman at FreeBSD dot org
  5 siblings, 0 replies; 7+ messages in thread
From: truckman at FreeBSD dot org @ 2015-09-05  5:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65009

--- Comment #4 from Don Lewis <truckman at FreeBSD dot org> ---
Still fails with:

% gcc49 --version
gcc49 (FreeBSD Ports Collection) 4.9.4 20150819 (prerelease)
Copyright (C) 2015 Free Software Foundation, Inc.


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

end of thread, other threads:[~2015-09-05  5:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-10 23:23 [Bug c++/65009] New: g++ 4.9 sometimes leaves inline methods undefined when compiling with -Os truckman at FreeBSD dot org
2015-02-11  0:11 ` [Bug c++/65009] " truckman at FreeBSD dot org
2015-02-11  9:20 ` [Bug c++/65009] [4.9 Regression] " jakub at gcc dot gnu.org
2015-02-11  9:43 ` rguenth at gcc dot gnu.org
2015-06-26 20:01 ` jakub at gcc dot gnu.org
2015-06-26 20:31 ` jakub at gcc dot gnu.org
2015-09-05  5:59 ` truckman at FreeBSD 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).