public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr
       [not found] <bug-85944-4@http.gcc.gnu.org/bugzilla/>
@ 2022-01-14 14:21 ` ppalka at gcc dot gnu.org
  2022-07-06 10:37 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-14 14:21 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
The problem seems to be that maybe_nonzero_address doesn't return true for all
temporaries, only those created at function scope, but here the temporary for
'S{}' is created at namespace scope.

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

* [Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr
       [not found] <bug-85944-4@http.gcc.gnu.org/bugzilla/>
  2022-01-14 14:21 ` [Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr ppalka at gcc dot gnu.org
@ 2022-07-06 10:37 ` redi at gcc dot gnu.org
  2022-07-06 10:44 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-07-06 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fiesh at zefix dot tv

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 106212 has been marked as a duplicate of this bug. ***

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

* [Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr
       [not found] <bug-85944-4@http.gcc.gnu.org/bugzilla/>
  2022-01-14 14:21 ` [Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr ppalka at gcc dot gnu.org
  2022-07-06 10:37 ` redi at gcc dot gnu.org
@ 2022-07-06 10:44 ` redi at gcc dot gnu.org
  2022-10-25  6:57 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-07-06 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2021-12-06 00:00:00         |2022-7-6

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This affects the Debug Mode checks in std::array's operator== as reported in PR
106212:

namespace std
{
  struct array
  {
    constexpr const void* data() const { return this; }

    constexpr bool operator==(const array&) const
    {
      if (data() == nullptr)
        throw 1;
      return true;
    }
  };
}

struct P {
  bool operator==(P const &) const = default;
  std::array e;
};

void f() {
  static_assert(P() == P());
}

  static_assert(P() == P());



namespace std
{
  struct array
  {
    constexpr const void* data() const { return this; }

    constexpr bool operator==(const array&) const
    {
      if (data() == nullptr)
        throw 1;
      return true;
    }
  };
}

struct P {
  bool operator==(P const &) const = default;
  std::array e;
};

void f() {
  static_assert(P() == P()); // OK
}

  static_assert(P() == P()); // NOT OK

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

* [Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr
       [not found] <bug-85944-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2022-07-06 10:44 ` redi at gcc dot gnu.org
@ 2022-10-25  6:57 ` rguenth at gcc dot gnu.org
  2022-10-25 15:59 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-25  6:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johelegp at gmail dot com

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
*** Bug 107378 has been marked as a duplicate of this bug. ***

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

* [Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr
       [not found] <bug-85944-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-10-25  6:57 ` rguenth at gcc dot gnu.org
@ 2022-10-25 15:59 ` jakub at gcc dot gnu.org
  2023-02-23  3:10 ` ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-25 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I'm afraid the middle-end can't do here much.
maybe_nonzero_address handles file scope vars (vars in symbol table) and
automatic vars, but for the TARGET_EXPR temporaries created by
force_target_expr -> build_local_temp if they are built outside of the function
it doesn't know anything about them until they are gimplified.  They are
artificial VAR_DECLs with NULL DECL_CONTEXT, their DECL_CONTEXT will be set
only
during gimplification when the static ctors function is created.

So, either we'd need to mark such local temporaries some way that
maybe_nonzero_address could assume that while they don't look like automatic
vars yet, they will be ones later on (special attribute, or flag, etc.), or
constexpr.cc would need to handle folding those cases itself.

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

* [Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr
       [not found] <bug-85944-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2022-10-25 15:59 ` jakub at gcc dot gnu.org
@ 2023-02-23  3:10 ` ppalka at gcc dot gnu.org
  2023-04-18  9:55 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-02-23  3:10 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |danakj at orodu dot net

--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 108897 has been marked as a duplicate of this bug. ***

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

* [Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr
       [not found] <bug-85944-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2023-02-23  3:10 ` ppalka at gcc dot gnu.org
@ 2023-04-18  9:55 ` redi at gcc dot gnu.org
  2023-05-26  3:14 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2023-04-18  9:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |terra at gnome dot org

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 109517 has been marked as a duplicate of this bug. ***

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

* [Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr
       [not found] <bug-85944-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2023-04-18  9:55 ` redi at gcc dot gnu.org
@ 2023-05-26  3:14 ` pinskia at gcc dot gnu.org
  2023-05-26  3:28 ` [Bug c++/85944] Address of temporary " pinskia at gcc dot gnu.org
  2023-07-27 17:54 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-26  3:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ed at catmur dot uk

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 109975 has been marked as a duplicate of this bug. ***

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

* [Bug c++/85944] Address of temporary at global scope not considered constexpr
       [not found] <bug-85944-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2023-05-26  3:14 ` pinskia at gcc dot gnu.org
@ 2023-05-26  3:28 ` pinskia at gcc dot gnu.org
  2023-07-27 17:54 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-26  3:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 109976 has been marked as a duplicate of this bug. ***

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

* [Bug c++/85944] Address of temporary at global scope not considered constexpr
       [not found] <bug-85944-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2023-05-26  3:28 ` [Bug c++/85944] Address of temporary " pinskia at gcc dot gnu.org
@ 2023-07-27 17:54 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-27 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gccbugbjorn at fahller dot se

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 110828 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2023-07-27 17:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-85944-4@http.gcc.gnu.org/bugzilla/>
2022-01-14 14:21 ` [Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr ppalka at gcc dot gnu.org
2022-07-06 10:37 ` redi at gcc dot gnu.org
2022-07-06 10:44 ` redi at gcc dot gnu.org
2022-10-25  6:57 ` rguenth at gcc dot gnu.org
2022-10-25 15:59 ` jakub at gcc dot gnu.org
2023-02-23  3:10 ` ppalka at gcc dot gnu.org
2023-04-18  9:55 ` redi at gcc dot gnu.org
2023-05-26  3:14 ` pinskia at gcc dot gnu.org
2023-05-26  3:28 ` [Bug c++/85944] Address of temporary " pinskia at gcc dot gnu.org
2023-07-27 17:54 ` 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).