public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94929] New: GCC 8 chokes on std::max in alignas
@ 2020-05-02 22:34 soap at gentoo dot org
  2020-05-03  8:44 ` [Bug c++/94929] [8 Regression] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: soap at gentoo dot org @ 2020-05-02 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94929
           Summary: GCC 8 chokes on std::max in alignas
           Product: gcc
           Version: 8.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: soap at gentoo dot org
  Target Milestone: ---

The following snippet

  #include <algorithm>

  struct One {};
  struct Two {};
  struct Foo { alignas(std::max(alignof(One), alignof(Two))) char value; };

compiles fine in GCC 9.3, but in GCC 8.4 fails with

test.cpp:5:65: error: requested alignment is not an integer constant
 struct Foo { alignas(std::max(alignof(One), alignof(Two))) char value; };
                                                                 ^~~~~

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

* [Bug c++/94929] [8 Regression] GCC 8 chokes on std::max in alignas
  2020-05-02 22:34 [Bug c++/94929] New: GCC 8 chokes on std::max in alignas soap at gentoo dot org
@ 2020-05-03  8:44 ` redi at gcc dot gnu.org
  2020-05-03  8:49 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-03  8:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
.

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

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

* [Bug c++/94929] [8 Regression] GCC 8 chokes on std::max in alignas
  2020-05-02 22:34 [Bug c++/94929] New: GCC 8 chokes on std::max in alignas soap at gentoo dot org
  2020-05-03  8:44 ` [Bug c++/94929] [8 Regression] " redi at gcc dot gnu.org
@ 2020-05-03  8:49 ` redi at gcc dot gnu.org
  2020-05-04  6:43 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-03  8:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |6.4.0, 7.5.0, 8.4.0
                 CC|                            |polacek at redhat dot com
     Ever confirmed|0                           |1
           Keywords|                            |rejects-valid
             Status|RESOLVED                    |NEW
      Known to work|                            |10.0, 11.0, 5.5.0, 9.2.0
   Last reconfirmed|                            |2020-05-03
         Resolution|DUPLICATE                   |---

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Hmm, although this was fixed for gcc 9.2 by the patch for PR 90736 it seems to
be a different root cause. This compiled with GCC 5 but not 6, 7 or 8:

template<typename T>
constexpr const T& max(const T& a, const T& b) { return a < b ? b : a; }

struct One {};
struct Two {};
struct Foo { alignas(max(alignof(One), alignof(Two))) char value; };

This regressed with r230365, "Merge C++ delayed folding branch."

Marek, looks like backporting r272219 would fix this.

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

* [Bug c++/94929] [8 Regression] GCC 8 chokes on std::max in alignas
  2020-05-02 22:34 [Bug c++/94929] New: GCC 8 chokes on std::max in alignas soap at gentoo dot org
  2020-05-03  8:44 ` [Bug c++/94929] [8 Regression] " redi at gcc dot gnu.org
  2020-05-03  8:49 ` redi at gcc dot gnu.org
@ 2020-05-04  6:43 ` rguenth at gcc dot gnu.org
  2020-05-04 15:12 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-04  6:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |8.5

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

* [Bug c++/94929] [8 Regression] GCC 8 chokes on std::max in alignas
  2020-05-02 22:34 [Bug c++/94929] New: GCC 8 chokes on std::max in alignas soap at gentoo dot org
                   ` (2 preceding siblings ...)
  2020-05-04  6:43 ` rguenth at gcc dot gnu.org
@ 2020-05-04 15:12 ` mpolacek at gcc dot gnu.org
  2020-05-04 17:28 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-04 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I'm going to backport the fix to 8 if it passes the usual testing.

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

* [Bug c++/94929] [8 Regression] GCC 8 chokes on std::max in alignas
  2020-05-02 22:34 [Bug c++/94929] New: GCC 8 chokes on std::max in alignas soap at gentoo dot org
                   ` (3 preceding siblings ...)
  2020-05-04 15:12 ` mpolacek at gcc dot gnu.org
@ 2020-05-04 17:28 ` mpolacek at gcc dot gnu.org
  2020-05-04 17:28 ` soap at gentoo dot org
  2020-05-04 17:37 ` mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-04 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Done in r8-10235-gf6965321b1c00bfb2b9c8407df56bcf38f096088.

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

* [Bug c++/94929] [8 Regression] GCC 8 chokes on std::max in alignas
  2020-05-02 22:34 [Bug c++/94929] New: GCC 8 chokes on std::max in alignas soap at gentoo dot org
                   ` (4 preceding siblings ...)
  2020-05-04 17:28 ` mpolacek at gcc dot gnu.org
@ 2020-05-04 17:28 ` soap at gentoo dot org
  2020-05-04 17:37 ` mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: soap at gentoo dot org @ 2020-05-04 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from David Seifert <soap at gentoo dot org> ---
(In reply to Marek Polacek from comment #3)
> I'm going to backport the fix to 8 if it passes the usual testing.

Hi Marek,
could you also test the inlined code. Defining some const and then using it
alignas worked previously, the problem comes from doing all of it in alignas().

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

* [Bug c++/94929] [8 Regression] GCC 8 chokes on std::max in alignas
  2020-05-02 22:34 [Bug c++/94929] New: GCC 8 chokes on std::max in alignas soap at gentoo dot org
                   ` (5 preceding siblings ...)
  2020-05-04 17:28 ` soap at gentoo dot org
@ 2020-05-04 17:37 ` mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-04 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to David Seifert from comment #5)
> (In reply to Marek Polacek from comment #3)
> > I'm going to backport the fix to 8 if it passes the usual testing.
> 
> Hi Marek,
> could you also test the inlined code. Defining some const and then using it
> alignas worked previously, the problem comes from doing all of it in
> alignas().

Both the original testcase in this PR and the test in Comment 2 now compile
even with GCC 8.

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

end of thread, other threads:[~2020-05-04 17:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-02 22:34 [Bug c++/94929] New: GCC 8 chokes on std::max in alignas soap at gentoo dot org
2020-05-03  8:44 ` [Bug c++/94929] [8 Regression] " redi at gcc dot gnu.org
2020-05-03  8:49 ` redi at gcc dot gnu.org
2020-05-04  6:43 ` rguenth at gcc dot gnu.org
2020-05-04 15:12 ` mpolacek at gcc dot gnu.org
2020-05-04 17:28 ` mpolacek at gcc dot gnu.org
2020-05-04 17:28 ` soap at gentoo dot org
2020-05-04 17:37 ` mpolacek 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).