[Bug 305460]

2022-03-17 Thread Eyalroz1
(In reply to Jonathan Wakely from comment #20)
> No, but "the first non-pure, non-inline virtual function in the class" is
> easy for the user to find.

Well, yes, granted, that would be a huge improvement. But then, is
binutils allowed to make that assumption about the ABI?  ... actually,
never mind. Even if it isn't, they could still write something like "The
probable cause is a lack of definition of the first virtual method in
the class which isn't inline nor pure-virtual".

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/305460

Title:
  [PR42540] c++ error message [vtable undefined] is unhelpful

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/305460/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 305460]

2022-03-17 Thread Redi
No, but "the first non-pure, non-inline virtual function in the class"
is easy for the user to find.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/305460

Title:
  [PR42540] c++ error message [vtable undefined] is unhelpful

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/305460/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 305460]

2022-03-17 Thread Eyalroz1
(In reply to Jonathan Wakely from comment #17)
Ok, have read the wiki page.

> The linker could easily say that, with no changes from GCC.

Is the signature, or name, of the "key function" present in compiled
object files which have seen the class definition?

If the answer is yes, we could just go ahead and file a bug against
binutils...

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/305460

Title:
  [PR42540] c++ error message [vtable undefined] is unhelpful

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/305460/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 305460]

2022-03-17 Thread Redi
(In reply to Eyal Rozenberg from comment #16)
> I'm not quite sure what a key function is,

Then read the link I gave you in PR 104918 comment 1.


> Not just learners. If you have a large class with many methods, whose
> implementation is spread across many files, it can take quite a bit of time
> to figure out which method implementation is missing.

The first one. They key function is the first non-inline, non-pure
virtual function. Read the wiki page. I didn't write that page and
suggest you read it just for fun.

The linker could easily say that, with no changes from GCC. That belongs
in the binutils bugzilla though.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/305460

Title:
  [PR42540] c++ error message [vtable undefined] is unhelpful

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/305460/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 305460]

2022-03-17 Thread Redi
(In reply to Eyal Rozenberg from comment #16)
> The compiler could store information in the compiled object listing the
> virtual members for which no implementation was found, due to which reason
> the vtable was not defined already. In this specific example, storing the
> name of "A::B()" somewhere.

In every file that includes the header defining A?

Consider the case where you include the header in ten files, and define
the virtual functions in one of them. Nine out of ten files do not
contain a definitions of the virtual functions, so they would each
contain the same info naming every virtual function in the class. Then
do that for every polymorphic class in every object file. This is a lot
more info being written out, and most of it will never be used.

You have nine files saying "this function is missing" and one not saying
it. What exactly does the linker do with that information? Why would
that be better than comment 7 here?

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/305460

Title:
  [PR42540] c++ error message [vtable undefined] is unhelpful

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/305460/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 305460]

2022-03-17 Thread Eyalroz1
Some comments following my recent dupe...

(In reply to Andrew Pinski from comment #1)
> I don't know if there is anything there could be done here since the linker
> is what is producing the error.

The compiler could store information in the compiled object listing the
virtual members for which no implementation was found, due to which
reason the vtable was not defined already. In this specific example,
storing the name of "A::B()" somewhere. If that information is
available, we could then petition linker authors to use it and print the
missing virtual members in the error message.

(In reply to  Richard Earnshaw from comment #5)
> As suggested, there's no bug in the compiler here

Not passing sufficient information to the linker is a "bug", or at least
- a missing feature.

(In reply to Zhihao Yuan from comment #11)
> 2. Add extra information to name the key function, and pass it to the linker, 
> generate an error message to match MSVC's quality.

I'm not quite sure what a key function is, but it sounds like my
suggestion is similar to this one. So, I support your suggestion (2.)

> Calling this a "well-known issue" is irresponsible.  The issue significantly
> increases the bar to learners to consume and accept new paradigms in the
> language.

Not just learners. If you have a large class with many methods, whose
implementation is spread across many files, it can take quite a bit of
time to figure out which method implementation is missing.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/305460

Title:
  [PR42540] c++ error message [vtable undefined] is unhelpful

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/305460/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 305460]

2022-03-17 Thread Redi
*** Bug 104918 has been marked as a duplicate of this bug. ***

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/305460

Title:
  [PR42540] c++ error message [vtable undefined] is unhelpful

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/305460/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 305460]

2020-07-23 Thread Redi
*** Bug 96283 has been marked as a duplicate of this bug. ***

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/305460

Title:
  [PR42540] c++ error message [vtable undefined] is unhelpful

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/305460/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 305460]

2020-07-23 Thread Redi
(In reply to Zhihao Yuan from comment #11)
> 1. Adjust the error message to say, "The first non-inline, non-pure function
> may not have a definition in ."

That error comes from the linker. The linker is not part of GCC, so this
is the wrong place to ask for linker changes.

> 2. Add extra information to name the key function, and pass it to the
> linker, generate an error message to match MSVC's quality.

That's what comment 7 suggested. Comment 10 links to the response to
that.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/305460

Title:
  [PR42540] c++ error message [vtable undefined] is unhelpful

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/305460/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 305460]

2020-07-23 Thread Redi
(In reply to Jonathan Wakely from comment #3)
> The linker error alone doesn't make the root cause obvious, but it's a
> fairly well known and well documented problem:
> http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.10

A better link is now:
https://gcc.gnu.org/wiki/VerboseDiagnostics#undefined_reference_to_vtable_for_X

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/305460

Title:
  [PR42540] c++ error message [vtable undefined] is unhelpful

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/305460/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 305460]

2020-02-22 Thread lichray
The example in this bug is not as severe and frequent as the one in bug
44841.  Users are more likely to encounter this issue when adding a new
API to existing interface or type erasure.

Calling this a "well-known issue" is irresponsible.  The issue
significantly increases the bar to learners to consume and accept new
paradigms in the language.

The issue has not been fixed for ten years.  It is a shame rather than
some arcane knowledge that worth to be proud of.

MSVC has no such issue.  The error message reads as "undefined reference
to Class::that_virtual_function."

Some possible fixes:

1. Adjust the error message to say, "The first non-inline, non-pure function 
may not have a definition in ."
2. Add extra information to name the key function, and pass it to the linker, 
generate an error message to match MSVC's quality.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/305460

Title:
  [PR42540] c++ error message [vtable undefined] is unhelpful

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/305460/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 305460] Re: [PR42540] c++ error message [vtable undefined] is unhelpful

2011-03-21 Thread Bug Watch Updater
Launchpad has imported 11 comments from the remote bug at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42540.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.


On 2009-12-29T14:44:24+00:00 Debian GCC maintainers wrote:

class A {
A();

virtual void B();
};

A::A() {}
/* Whoops, I forgot to define A::B() */

$ g++ -Wall a.cc 
/usr/lib/../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/ccaVlePI.o: In function `A::A()':
a.cc:(.text+0xf): undefined reference to `vtable for A'
collect2: ld returned 1 exit status

bug submitter writes:
To be clear: the problem is that the error message only mentions the 
constructor, and the vtable. It doesn't mention the method A::B(), which is 
actually the problem. On a less-minimal example it could take much longer to 
work out what the real problem is.

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/2


On 2009-12-29T15:05:46+00:00 Pinskia wrote:

I don't know if there is anything there could be done here since the
linker is what is producing the error.

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/3


On 2009-12-29T19:26:52+00:00 Pinskia wrote:

In fact it depends on the key function being declared which depends on
the ABI really (ARM EABI has a slightly different key function than the
rest of the abis).

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/4


On 2010-01-06T10:42:05+00:00 Jwakely-gcc wrote:

The linker error alone doesn't make the root cause obvious, but it's a fairly 
well known and well documented problem:
http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.10

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/5


On 2010-02-24T13:25:46+00:00 Manu-gcc wrote:

Is it impossible to detect this in the compiler?

Can't we put the vtable somewhere else (or break it in pieces) such
triggering the error in the compiler?

Otherwise, we should just close this as WONTFIX.

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/6


On 2010-02-24T14:17:28+00:00 Rearnsha wrote:

As suggested, there's no bug in the compiler here, and the error message
comes from the linker.  The linker doesn't know what the key function
is, so I doubt it could issue a more accurate diagnostic.

In fact, the key function is just a trigger to the compiler to cause it
to emit the meta-data for the class exactly once -- and because there
the class could be used in multiple compilation units it can never know
which one should contain the meta data as any of them could have done.
As far as the linker is concerned, there really is no class for A; it's
the same as if there was no definition for a global extern variable.

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/7


On 2010-07-06T15:47:39+00:00 Pinskia wrote:

*** Bug 44841 has been marked as a duplicate of this bug. ***

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/8


On 2010-07-13T22:56:43+00:00 Jeffrey Yasskin wrote:

I'm working on a patch for this at http://gcc.gnu.org/ml/gcc-
patches/2010-07/msg01116.html. It works by emitting a fake use of the
key method any time a translation unit depends on an imported vtable or
typeinfo.

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/9


On 2010-07-13T22:58:07+00:00 Pinskia wrote:

Reopening 

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/10


On 2011-03-17T15:39:00+00:00 Manu-gcc wrote:

Pending for 4.7

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/11


On 2011-03-17T16:16:50+00:00 Jyasskin-gcc wrote:

Mark asked for a different implementation in http://gcc.gnu.org/ml/gcc-
patches/2010-08/msg00367.html, and I may not get a chance to do what he
asked for 4.7. Someone else is welcome to pick this up if they have
time.

Reply at: https://bugs.launchpad.net/gcc/+bug/305460/comments/12


** Changed in: gcc
   Importance: Unknown = Wishlist

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed

[Bug 305460] Re: [PR42540] c++ error message [vtable undefined] is unhelpful

2010-07-14 Thread Bug Watch Updater
** Changed in: gcc
   Status: Invalid = In Progress

-- 
[PR42540] c++ error message [vtable undefined] is unhelpful
https://bugs.launchpad.net/bugs/305460
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 305460] Re: [PR42540] c++ error message [vtable undefined] is unhelpful

2010-02-24 Thread Bug Watch Updater
** Changed in: gcc
   Status: New = Invalid

-- 
[PR42540] c++ error message [vtable undefined] is unhelpful
https://bugs.launchpad.net/bugs/305460
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 305460] Re: [PR42540] c++ error message [vtable undefined] is unhelpful

2010-01-04 Thread Matthias Klose
** Changed in: gcc-defaults (Ubuntu)
   Importance: Undecided = Low

** Changed in: gcc-defaults (Ubuntu)
   Status: New = Confirmed

-- 
[PR42540] c++ error message [vtable undefined] is unhelpful
https://bugs.launchpad.net/bugs/305460
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 305460] Re: c++ error message [vtable undefined] is unhelpful

2009-12-29 Thread Matthias Klose
** Bug watch added: GCC Bugzilla #42540
   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42540

** Also affects: gcc via
   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42540
   Importance: Unknown
   Status: Unknown

** Summary changed:

- c++ error message [vtable undefined] is unhelpful
+ [PR42540] c++ error message [vtable undefined] is unhelpful

-- 
[PR42540] c++ error message [vtable undefined] is unhelpful
https://bugs.launchpad.net/bugs/305460
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 305460] Re: [PR42540] c++ error message [vtable undefined] is unhelpful

2009-12-29 Thread Bug Watch Updater
** Changed in: gcc
   Status: Unknown = New

-- 
[PR42540] c++ error message [vtable undefined] is unhelpful
https://bugs.launchpad.net/bugs/305460
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 305460] Re: c++ error message [vtable undefined] is unhelpful

2008-12-26 Thread Terence Simpson
** Tags added: needs-upstream-report

-- 
c++ error message [vtable undefined] is unhelpful
https://bugs.launchpad.net/bugs/305460
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 305460] [NEW] c++ error message [vtable undefined] is unhelpful

2008-12-05 Thread Alan Jenkins
Public bug reported:

I've had response to g++ crash reports, so maybe you'd also like to know
about this confusing error message I found.

Thanks!
Alan

This is on an up-to-date install of Ubuntu 8.04.1.

apt-cache policy gcc
gcc:
  Installed: 4:4.2.3-1ubuntu6
  Candidate: 4:4.2.3-1ubuntu6
  Version table:
 *** 4:4.2.3-1ubuntu6 0
500 http://gb.archive.ubuntu.com hardy-updates/main Packages
100 /var/lib/dpkg/status
 4:4.2.3-1ubuntu3 0
500 http://gb.archive.ubuntu.com hardy/main Packages


Minimal test program:

class A {
A();

virtual void B();
};

A::A() {}
/* Whoops, I forgot to define A::B() */

Actual error message:

/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../lib/crt1.o: In function 
`_start':
(.text+0x20): undefined reference to `main'
/tmp/cc8P2uDq.o: In function `A::A()':
test.cpp:(.text+0x9): undefined reference to `vtable for A'
/tmp/cc8P2uDq.o: In function `A::A()':
test.cpp:(.text+0x1f): undefined reference to `vtable for A'
collect2: ld returned 1 exit status

Expected error message:

Something more like undefined reference to A::B()

** Affects: gcc-defaults (Ubuntu)
 Importance: Undecided
 Status: New

-- 
c++ error message [vtable undefined] is unhelpful
https://bugs.launchpad.net/bugs/305460
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 305460] Re: c++ error message [vtable undefined] is unhelpful

2008-12-05 Thread Alan Jenkins
To be clear: the problem is that the error message only mentions the
constructor, and the vtable.  It doesn't mention the method A::B(),
which is actually the problem.  On a less-minimal example it could take
much longer to work out what the real problem is.

-- 
c++ error message [vtable undefined] is unhelpful
https://bugs.launchpad.net/bugs/305460
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs