public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67772] New: wrong type_info emitted for cv-qualified pointer to member types
@ 2015-09-30  0:46 richard-gccbugzilla at metafoo dot co.uk
  2021-08-09 21:00 ` [Bug c++/67772] " pinskia at gcc dot gnu.org
  2021-08-09 21:02 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2015-09-30  0:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67772
           Summary: wrong type_info emitted for cv-qualified pointer to
                    member types
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richard-gccbugzilla at metafoo dot co.uk
  Target Milestone: ---

Consider:

  namespace std { struct type_info {}; }
  struct A {};
  auto x = typeid(void(A::*)() const);

Clang emits the type info as:

_ZTIM1AKFvvE:
        .quad   _ZTVN10__cxxabiv129__pointer_to_member_type_infoE+16
        .quad   _ZTSM1AKFvvE
        .long   0                       # 0x0
        .zero   4
        .quad   _ZTIKFvvE
        .quad   _ZTI1A

GCC emits it as:

_ZTIM1AKFvvE:
        .quad   _ZTVN10__cxxabiv129__pointer_to_member_type_infoE+16
        .quad   _ZTSM1AKFvvE
        .long   0
        .zero   4
        .quad   _ZTIFvvE
        .quad   _ZTI1A

It appears that Clang is correct here; the 'const' in this case is not a
qualifier, so should not be removed when forming the pointee type_info. If GCC
really did think this was a const qualifier applied to a function type, it
would be emitting the wrong flags (should be .long 1, not .long 0 in that
case).


This translates into a wrong-code bug in a case like this:

struct A;
extern "C" void puts(const char*);
int main() {
  try {
    throw (void(A::*)())0;
  } catch (void (A::*)() const) {
    puts("bad catch");
  }
}

... where GCC erroneously catches a pointer to non-const member function as a
pointer to const member function.


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

* [Bug c++/67772] wrong type_info emitted for cv-qualified pointer to member types
  2015-09-30  0:46 [Bug c++/67772] New: wrong type_info emitted for cv-qualified pointer to member types richard-gccbugzilla at metafoo dot co.uk
@ 2021-08-09 21:00 ` pinskia at gcc dot gnu.org
  2021-08-09 21:02 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |101603
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |wrong-code
   Last reconfirmed|                            |2021-08-09
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101603
[Bug 101603] [meta-bug] pointer to member functions issues

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

* [Bug c++/67772] wrong type_info emitted for cv-qualified pointer to member types
  2015-09-30  0:46 [Bug c++/67772] New: wrong type_info emitted for cv-qualified pointer to member types richard-gccbugzilla at metafoo dot co.uk
  2021-08-09 21:00 ` [Bug c++/67772] " pinskia at gcc dot gnu.org
@ 2021-08-09 21:02 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09 21:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is a dup of bug 52099.

*** This bug has been marked as a duplicate of bug 52099 ***

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

end of thread, other threads:[~2021-08-09 21:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-30  0:46 [Bug c++/67772] New: wrong type_info emitted for cv-qualified pointer to member types richard-gccbugzilla at metafoo dot co.uk
2021-08-09 21:00 ` [Bug c++/67772] " pinskia at gcc dot gnu.org
2021-08-09 21:02 ` 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).