public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67650] New: undef reference with -fdevirtualize
@ 2015-09-20 15:49 vincent.lextrait at gmail dot com
  2015-09-20 16:30 ` [Bug c++/67650] " vincent.lextrait at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vincent.lextrait at gmail dot com @ 2015-09-20 15:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67650
           Summary: undef reference with -fdevirtualize
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent.lextrait at gmail dot com
  Target Milestone: ---

I get an undefined symbol when using -O2, more specifically, after trying all
additional options on top of -O1, this is due to -fdevirtualize. With -O1
-devirtualize, the symbol is missing. It's not missing with just -O1.
The symbol is a virtual member function of a class template.
I checked that the issue does not occur with gcc-4.9.2, it is new in gcc-5.

Is it worth it to try reducing my code and produce a code snippet exhibiting
the issue? Or is the issue known already? I didn't find any track of it.

gcc version:
/usr/local/bin/g++-5 -v
Using built-in specs.
COLLECT_GCC=/usr/local/bin/g++-5
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/5.2.0/libexec/gcc/x86_64-apple-darwin14.4.0/5.2.0/lto-wrapper
Target: x86_64-apple-darwin14.4.0
Configured with: ../configure --build=x86_64-apple-darwin14.4.0
--prefix=/usr/local/Cellar/gcc/5.2.0
--libdir=/usr/local/Cellar/gcc/5.2.0/lib/gcc/5
--enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-5
--with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr
--with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl
--with-system-zlib --enable-libstdcxx-time=yes --enable-stage1-checking
--enable-checking=release --enable-lto --with-build-config=bootstrap-debug
--disable-werror --with-pkgversion='Homebrew gcc 5.2.0'
--with-bugurl=https://github.com/Homebrew/homebrew/issues --enable-plugin
--disable-nls --enable-multilib
Thread model: posix
gcc version 5.2.0 (Homebrew gcc 5.2.0)


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

* [Bug c++/67650] undef reference with -fdevirtualize
  2015-09-20 15:49 [Bug c++/67650] New: undef reference with -fdevirtualize vincent.lextrait at gmail dot com
@ 2015-09-20 16:30 ` vincent.lextrait at gmail dot com
  2015-09-20 22:06 ` vincent.lextrait at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vincent.lextrait at gmail dot com @ 2015-09-20 16:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Vincent <vincent.lextrait at gmail dot com> ---
Ok, working on it, thanks.


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

* [Bug c++/67650] undef reference with -fdevirtualize
  2015-09-20 15:49 [Bug c++/67650] New: undef reference with -fdevirtualize vincent.lextrait at gmail dot com
  2015-09-20 16:30 ` [Bug c++/67650] " vincent.lextrait at gmail dot com
@ 2015-09-20 22:06 ` vincent.lextrait at gmail dot com
  2015-09-20 22:24 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vincent.lextrait at gmail dot com @ 2015-09-20 22:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Vincent <vincent.lextrait at gmail dot com> ---
Created attachment 36355
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36355&action=edit
Test case

Compile using gcc 5.2.0:
g++-5 -O1 -std=c++11 main.ii -fdevirtualize

The function missing at link edition is:

AN<LR<I, IE, &ET>::LLC, BLKC>::rp()

Without -fdevirtualize, the function is there.


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

* [Bug c++/67650] undef reference with -fdevirtualize
  2015-09-20 15:49 [Bug c++/67650] New: undef reference with -fdevirtualize vincent.lextrait at gmail dot com
  2015-09-20 16:30 ` [Bug c++/67650] " vincent.lextrait at gmail dot com
  2015-09-20 22:06 ` vincent.lextrait at gmail dot com
@ 2015-09-20 22:24 ` pinskia at gcc dot gnu.org
  2015-09-20 22:33 ` vincent.lextrait at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-09-20 22:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> ((T*)0)->ax();

This is undefined behavior.


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

* [Bug c++/67650] undef reference with -fdevirtualize
  2015-09-20 15:49 [Bug c++/67650] New: undef reference with -fdevirtualize vincent.lextrait at gmail dot com
                   ` (2 preceding siblings ...)
  2015-09-20 22:24 ` pinskia at gcc dot gnu.org
@ 2015-09-20 22:33 ` vincent.lextrait at gmail dot com
  2015-09-20 22:43 ` vincent.lextrait at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vincent.lextrait at gmail dot com @ 2015-09-20 22:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Vincent <vincent.lextrait at gmail dot com> ---
The problem is static time, not dynamic time.
This artefact is just a result of source code reduction. In  my code there is
no "0", and the problem exists.
I can provide an alternative case without this artefact, but I do not believe
it harms investigations at all.


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

* [Bug c++/67650] undef reference with -fdevirtualize
  2015-09-20 15:49 [Bug c++/67650] New: undef reference with -fdevirtualize vincent.lextrait at gmail dot com
                   ` (3 preceding siblings ...)
  2015-09-20 22:33 ` vincent.lextrait at gmail dot com
@ 2015-09-20 22:43 ` vincent.lextrait at gmail dot com
  2015-09-21  7:42 ` rguenth at gcc dot gnu.org
  2021-09-10  7:39 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: vincent.lextrait at gmail dot com @ 2015-09-20 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Vincent <vincent.lextrait at gmail dot com> ---
Replace it with (new T())->ax() if you have doubts. Same thing.


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

* [Bug c++/67650] undef reference with -fdevirtualize
  2015-09-20 15:49 [Bug c++/67650] New: undef reference with -fdevirtualize vincent.lextrait at gmail dot com
                   ` (4 preceding siblings ...)
  2015-09-20 22:43 ` vincent.lextrait at gmail dot com
@ 2015-09-21  7:42 ` rguenth at gcc dot gnu.org
  2021-09-10  7:39 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-09-21  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Honza - can you please look at the few devirt issues we still have on trunk and
the gcc 5 branch?


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

* [Bug c++/67650] undef reference with -fdevirtualize
  2015-09-20 15:49 [Bug c++/67650] New: undef reference with -fdevirtualize vincent.lextrait at gmail dot com
                   ` (5 preceding siblings ...)
  2015-09-21  7:42 ` rguenth at gcc dot gnu.org
@ 2021-09-10  7:39 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-10  7:39 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |9.0
         Resolution|---                         |FIXED

--- Comment #36 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed for GCC 9 by the patch for PR 80916.  Tested even on the original
testcase.

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

end of thread, other threads:[~2021-09-10  7:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-20 15:49 [Bug c++/67650] New: undef reference with -fdevirtualize vincent.lextrait at gmail dot com
2015-09-20 16:30 ` [Bug c++/67650] " vincent.lextrait at gmail dot com
2015-09-20 22:06 ` vincent.lextrait at gmail dot com
2015-09-20 22:24 ` pinskia at gcc dot gnu.org
2015-09-20 22:33 ` vincent.lextrait at gmail dot com
2015-09-20 22:43 ` vincent.lextrait at gmail dot com
2015-09-21  7:42 ` rguenth at gcc dot gnu.org
2021-09-10  7:39 ` pinskia 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).