Bug 1713865 - gcc 9 regression: "error: requested alignment is not an integer constant"
Summary: gcc 9 regression: "error: requested alignment is not an integer constant"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 30
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1675396
TreeView+ depends on / blocked
 
Reported: 2019-05-25 09:45 UTC by Kalev Lember
Modified: 2019-09-07 12:54 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-09-07 12:54:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 90736 0 None None None 2019-06-13 14:37:14 UTC

Description Kalev Lember 2019-05-25 09:45:05 UTC
The following code compiles fine on gcc 8, but errors out on gcc 9 with "error: requested alignment is not an integer constant":

#include <algorithm>
#include <cstddef>
struct One {};
struct Two {};
static constexpr const size_t ALIGNMENT = std::max(alignof(One), alignof(Two));
struct Foo { alignas(ALIGNMENT) char value; };

This is a minimal reproducer based on mmapper FTBFS from https://bugzilla.redhat.com/show_bug.cgi?id=1675396

Comment 1 Marek Polacek 2019-05-28 14:24:57 UTC
Looks like this regressed with r261971.  I'll open an upstream PR.

Comment 2 Kalev Lember 2019-05-28 15:07:00 UTC
Great, thanks for tracking that down!

Comment 3 Marek Polacek 2019-06-03 17:51:50 UTC
Reduced test by Matthew:

constexpr unsigned long a(const unsigned long b) { return b; }
const unsigned long c = a(alignof(int));
alignas(c) char d;

Comment 4 Marek Polacek 2019-06-13 14:37:51 UTC
Fixed for GCC 9.2 and 10.  Should be in the next Fedora update.

Comment 5 Kalev Lember 2019-06-13 14:46:50 UTC
Awesome, thanks!

Comment 6 Kalev Lember 2019-09-07 12:54:05 UTC
This is now fixed in gcc 9.2.1. Thanks!


Note You need to log in before you can comment on or make changes to this bug.