public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102213] New: Incorrect executable produced from valid input code with virtual consteval
@ 2021-09-06  8:51 fchelnokov at gmail dot com
  2021-11-25 18:51 ` [Bug c++/102213] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fchelnokov at gmail dot com @ 2021-09-06  8:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102213
           Summary: Incorrect executable produced from valid input code
                    with virtual consteval
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

Consider the program
```
#include <compare>

struct A { 
    virtual consteval std::strong_ordering operator <=>(const A &) const =
default; 
};

struct B : A {
    virtual consteval bool operator==(const A&) const noexcept override {
return false; }
};

int main() {
    static constexpr B b;
    static constexpr const A & a = b;
    static_assert( (a <=> a) == 0 );
    static_assert( a != a );
    return (a <=> a) == 0; 
}
```
It shall return 1, but after making in GCC it fails with return code 139:
https://gcc.godbolt.org/z/EjdWa61W9

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

* [Bug c++/102213] Incorrect executable produced from valid input code with virtual consteval
  2021-09-06  8:51 [Bug c++/102213] New: Incorrect executable produced from valid input code with virtual consteval fchelnokov at gmail dot com
@ 2021-11-25 18:51 ` pinskia at gcc dot gnu.org
  2021-11-25 18:52 ` pinskia at gcc dot gnu.org
  2023-01-19  2:07 ` [Bug c++/102213] virtual consteval is not being stored in the vtable pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-25 18:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
      Known to fail|                            |11.1.0, 11.2.0
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-11-25

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, at -O1 it is constant evulated in the front-end and it works.

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

* [Bug c++/102213] Incorrect executable produced from valid input code with virtual consteval
  2021-09-06  8:51 [Bug c++/102213] New: Incorrect executable produced from valid input code with virtual consteval fchelnokov at gmail dot com
  2021-11-25 18:51 ` [Bug c++/102213] " pinskia at gcc dot gnu.org
@ 2021-11-25 18:52 ` pinskia at gcc dot gnu.org
  2023-01-19  2:07 ` [Bug c++/102213] virtual consteval is not being stored in the vtable pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-25 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note GCC 10 did a sorry message:
sorry, unimplemented: 'virtual' 'consteval'

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

* [Bug c++/102213] virtual consteval is not being stored in the vtable
  2021-09-06  8:51 [Bug c++/102213] New: Incorrect executable produced from valid input code with virtual consteval fchelnokov at gmail dot com
  2021-11-25 18:51 ` [Bug c++/102213] " pinskia at gcc dot gnu.org
  2021-11-25 18:52 ` pinskia at gcc dot gnu.org
@ 2023-01-19  2:07 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-19  2:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Incorrect executable        |virtual consteval is not
                   |produced from valid input   |being stored in the vtable
                   |code with virtual consteval |

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced further to show the issue is not related to operator <=> or operator
==:
```
struct A { 
    virtual consteval bool f(const A &) const { return true; }; 
};

struct B : A {
    virtual consteval bool f(const A&) const noexcept override { return false;
}
};

int main() {
    static constexpr B b;
    static constexpr const A & a = b;
    static_assert (a.f(a) == 0);
    if (a.f(a) != 0)
    __builtin_abort();
    return 0;
}
```

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

end of thread, other threads:[~2023-01-19  2:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06  8:51 [Bug c++/102213] New: Incorrect executable produced from valid input code with virtual consteval fchelnokov at gmail dot com
2021-11-25 18:51 ` [Bug c++/102213] " pinskia at gcc dot gnu.org
2021-11-25 18:52 ` pinskia at gcc dot gnu.org
2023-01-19  2:07 ` [Bug c++/102213] virtual consteval is not being stored in the vtable 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).