public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Fwd: [X-POST] Alignas broken when used with constexpr array data member for structure
       [not found] <2182301d-14b8-287d-bf6b-d9ed22e34726@warwick.ac.uk>
@ 2018-01-09 13:39 ` Alec Teal
  2018-01-09 13:41   ` Jonathan Wakely
  2018-01-09 14:26   ` Mason
  0 siblings, 2 replies; 9+ messages in thread
From: Alec Teal @ 2018-01-09 13:39 UTC (permalink / raw)
  To: gcc-help

Per recommendation asking on GCC help



-------- Forwarded Message --------
Subject: 	Alignas broken when used with constexpr array data member for 
structure
Date: 	Tue, 9 Jan 2018 13:15:37 +0000
From: 	Alec Teal <a.teal@warwick.ac.uk>
To: 	gcc@gcc.gnu.org <gcc@gcc.gnu.org>



[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]

Hi there,

In GCC 4.8.4 I have something like the following:

constexpr int x = 5;

constexpr int y = 4;

struct alignas(y) my_data_block {

    char data[x];

};


And it causes some weird errors to the tune of "size of array ‘data’ is
not an integral constant-expression" in the presence of the alignas

This is a pretty nasty bug and means it's not implemented as I thought.
I don't know the front-ends (but I do actually know GIMPLE-low and below
quite well, love the pattern matching) and I'd like to dig more, it's
almost certainly fixed - this is just for personal curiosity.

Where would I look? A 1 line reply with a directory would be a great
start; even if it's just a guess.

I did ask in #gcc on freenode - it didn't go so well, sorry to ping you
all for this.


Alec

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

* Re: [X-POST] Alignas broken when used with constexpr array data member for structure
  2018-01-09 13:39 ` Fwd: [X-POST] Alignas broken when used with constexpr array data member for structure Alec Teal
@ 2018-01-09 13:41   ` Jonathan Wakely
  2018-01-09 13:49     ` Alec Teal
  2018-01-09 14:26   ` Mason
  1 sibling, 1 reply; 9+ messages in thread
From: Jonathan Wakely @ 2018-01-09 13:41 UTC (permalink / raw)
  To: Alec Teal; +Cc: gcc-help

And I've now told you both on IRC and in reply to your original email,
the directory is gcc/cp

On 9 January 2018 at 13:39, Alec Teal <a.teal@warwick.ac.uk> wrote:
> Per recommendation asking on GCC help
>
>
>
> -------- Forwarded Message --------
> Subject:        Alignas broken when used with constexpr array data member
> for structure
> Date:   Tue, 9 Jan 2018 13:15:37 +0000
> From:   Alec Teal <a.teal@warwick.ac.uk>
> To:     gcc@gcc.gnu.org <gcc@gcc.gnu.org>
>
>
>
> [This sender failed our fraud detection checks and may not be who they
> appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]
>
>
> Hi there,
>
> In GCC 4.8.4 I have something like the following:
>
> constexpr int x = 5;
>
> constexpr int y = 4;
>
> struct alignas(y) my_data_block {
>
>    char data[x];
>
> };
>
>
> And it causes some weird errors to the tune of "size of array ‘data’ is
> not an integral constant-expression" in the presence of the alignas
>
> This is a pretty nasty bug and means it's not implemented as I thought.
> I don't know the front-ends (but I do actually know GIMPLE-low and below
> quite well, love the pattern matching) and I'd like to dig more, it's
> almost certainly fixed - this is just for personal curiosity.
>
> Where would I look? A 1 line reply with a directory would be a great
> start; even if it's just a guess.
>
> I did ask in #gcc on freenode - it didn't go so well, sorry to ping you
> all for this.
>
>
> Alec
>

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

* Re: [X-POST] Alignas broken when used with constexpr array data member for structure
  2018-01-09 13:41   ` Jonathan Wakely
@ 2018-01-09 13:49     ` Alec Teal
  2018-01-09 13:56       ` Jonathan Wakely
  0 siblings, 1 reply; 9+ messages in thread
From: Alec Teal @ 2018-01-09 13:49 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

More specific please, there's a lot in here.

For example I had a look in constexpr - seems like a good place to 
start! 7k lines; things may have moved.

It seems I might have been wrong, I need more than a directory!

I'm currently trying to set a breakpoint where errors are emitted (and 
hopefully find something on the stack, even if it's a function doing the 
passes!) - it's hard to find!

Usually I'd take more of a guess but this bug means I'm very far off the 
mark with the implementation.

Alec


On 09/01/18 13:40, Jonathan Wakely wrote:
> And I've now told you both on IRC and in reply to your original email,
> the directory is gcc/cp
>
> On 9 January 2018 at 13:39, Alec Teal <a.teal@warwick.ac.uk> wrote:
>> Per recommendation asking on GCC help
>>
>>
>>
>> -------- Forwarded Message --------
>> Subject:        Alignas broken when used with constexpr array data member
>> for structure
>> Date:   Tue, 9 Jan 2018 13:15:37 +0000
>> From:   Alec Teal <a.teal@warwick.ac.uk>
>> To:     gcc@gcc.gnu.org <gcc@gcc.gnu.org>
>>
>>
>>
>> [This sender failed our fraud detection checks and may not be who they
>> appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]
>>
>>
>> Hi there,
>>
>> In GCC 4.8.4 I have something like the following:
>>
>> constexpr int x = 5;
>>
>> constexpr int y = 4;
>>
>> struct alignas(y) my_data_block {
>>
>>     char data[x];
>>
>> };
>>
>>
>> And it causes some weird errors to the tune of "size of array ‘data’ is
>> not an integral constant-expression" in the presence of the alignas
>>
>> This is a pretty nasty bug and means it's not implemented as I thought.
>> I don't know the front-ends (but I do actually know GIMPLE-low and below
>> quite well, love the pattern matching) and I'd like to dig more, it's
>> almost certainly fixed - this is just for personal curiosity.
>>
>> Where would I look? A 1 line reply with a directory would be a great
>> start; even if it's just a guess.
>>
>> I did ask in #gcc on freenode - it didn't go so well, sorry to ping you
>> all for this.
>>
>>
>> Alec
>>

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

* Re: [X-POST] Alignas broken when used with constexpr array data member for structure
  2018-01-09 13:49     ` Alec Teal
@ 2018-01-09 13:56       ` Jonathan Wakely
  2018-01-09 14:04         ` Alec Teal
  0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Wakely @ 2018-01-09 13:56 UTC (permalink / raw)
  To: Alec Teal; +Cc: gcc-help

On 9 January 2018 at 13:48, Alec Teal <a.teal@warwick.ac.uk> wrote:
> More specific please, there's a lot in here.
>
> For example I had a look in constexpr - seems like a good place to start! 7k
> lines; things may have moved.
>
> It seems I might have been wrong, I need more than a directory!
>
> I'm currently trying to set a breakpoint where errors are emitted (and
> hopefully find something on the stack, even if it's a function doing the
> passes!) - it's hard to find!
>
> Usually I'd take more of a guess but this bug means I'm very far off the
> mark with the implementation.
>
> Alec


As I told you on IRC, search bugzilla for "alignas".

One of the results will be a meta-bug for alignas issues. Look at the
linked issues that are closed as fixed, I bet one of them will be the
fix for this bug. It will have a patch that fixed it.

You keep saying you want pointers, and then ignoring them. Search
bugzilla, as I suggested an hour ago.

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

* Re: [X-POST] Alignas broken when used with constexpr array data member for structure
  2018-01-09 13:56       ` Jonathan Wakely
@ 2018-01-09 14:04         ` Alec Teal
  2018-01-09 14:06           ` Jonathan Wakely
  0 siblings, 1 reply; 9+ messages in thread
From: Alec Teal @ 2018-01-09 14:04 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

If someone else could reply I'd be very grateful, especially if someone 
who actually knows the area could spare a few words, I need a shovel to 
dig with not spoon feeding.

Thanks,
Alec


On 09/01/18 13:55, Jonathan Wakely wrote:
> On 9 January 2018 at 13:48, Alec Teal <a.teal@warwick.ac.uk> wrote:
>> More specific please, there's a lot in here.
>>
>> For example I had a look in constexpr - seems like a good place to start! 7k
>> lines; things may have moved.
>>
>> It seems I might have been wrong, I need more than a directory!
>>
>> I'm currently trying to set a breakpoint where errors are emitted (and
>> hopefully find something on the stack, even if it's a function doing the
>> passes!) - it's hard to find!
>>
>> Usually I'd take more of a guess but this bug means I'm very far off the
>> mark with the implementation.
>>
>> Alec
>
> As I told you on IRC, search bugzilla for "alignas".
>
> One of the results will be a meta-bug for alignas issues. Look at the
> linked issues that are closed as fixed, I bet one of them will be the
> fix for this bug. It will have a patch that fixed it.
>
> You keep saying you want pointers, and then ignoring them. Search
> bugzilla, as I suggested an hour ago.

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

* Re: [X-POST] Alignas broken when used with constexpr array data member for structure
  2018-01-09 14:04         ` Alec Teal
@ 2018-01-09 14:06           ` Jonathan Wakely
  0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Wakely @ 2018-01-09 14:06 UTC (permalink / raw)
  To: Alec Teal; +Cc: gcc-help

Why not just try searching in bugzilla and looking at the fixed bugs
linked to from the meta-bug?

Why should people waste time helping you when you won't do that, and
when you post example code that doesn't show the error you claim to
see?







On 9 January 2018 at 14:04, Alec Teal <a.teal@warwick.ac.uk> wrote:
> If someone else could reply I'd be very grateful, especially if someone who
> actually knows the area could spare a few words, I need a shovel to dig with
> not spoon feeding.
>
> Thanks,
> Alec
>
>
>
> On 09/01/18 13:55, Jonathan Wakely wrote:
>>
>> On 9 January 2018 at 13:48, Alec Teal <a.teal@warwick.ac.uk> wrote:
>>>
>>> More specific please, there's a lot in here.
>>>
>>> For example I had a look in constexpr - seems like a good place to start!
>>> 7k
>>> lines; things may have moved.
>>>
>>> It seems I might have been wrong, I need more than a directory!
>>>
>>> I'm currently trying to set a breakpoint where errors are emitted (and
>>> hopefully find something on the stack, even if it's a function doing the
>>> passes!) - it's hard to find!
>>>
>>> Usually I'd take more of a guess but this bug means I'm very far off the
>>> mark with the implementation.
>>>
>>> Alec
>>
>>
>> As I told you on IRC, search bugzilla for "alignas".
>>
>> One of the results will be a meta-bug for alignas issues. Look at the
>> linked issues that are closed as fixed, I bet one of them will be the
>> fix for this bug. It will have a patch that fixed it.
>>
>> You keep saying you want pointers, and then ignoring them. Search
>> bugzilla, as I suggested an hour ago.
>
>

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

* Re: Alignas broken when used with constexpr array data member for structure
  2018-01-09 13:39 ` Fwd: [X-POST] Alignas broken when used with constexpr array data member for structure Alec Teal
  2018-01-09 13:41   ` Jonathan Wakely
@ 2018-01-09 14:26   ` Mason
  2018-01-09 14:29     ` Jonathan Wakely
  2018-01-12 16:50     ` Alec Teal
  1 sibling, 2 replies; 9+ messages in thread
From: Mason @ 2018-01-09 14:26 UTC (permalink / raw)
  To: Alec Teal; +Cc: GCC help

On 09/01/2018 14:39, Alec Teal wrote:

> In GCC 4.8.4 I have something like the following:

FWIW, 4.8 is no longer supported (2013)

> constexpr int x = 5;
> constexpr int y = 4;
> struct alignas(y) my_data_block {
>     char data[x];
> };
> 
> 
> And it causes some weird errors to the tune of "size of array 'data' is
> not an integral constant-expression" in the presence of the alignas

A good support request should specify
- exact compiler version (GCC 4.8.4)
- a small testcase (given above)
- exact compilation flags (missing)
- exact error message


Compiling the above source on godbolt using:
gcc 4.8.4 -Wall -Wextra

1 : <source>:1:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++0x-compat]
 constexpr int x = 5;
 ^
1 : <source>:1:1: error: 'constexpr' does not name a type
1 : <source>:1:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
2 : <source>:2:1: error: 'constexpr' does not name a type
 constexpr int y = 4;
 ^
2 : <source>:2:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
3 : <source>:3:19: error: expected initializer before 'my_data_block'
 struct alignas(y) my_data_block {
                   ^
Compiler returned: 1



Compiling the above source on godbolt using:
gcc 4.8.4 -Wall -Wextra -std=c++11

No errors.


So it seems I can't reproduce the issue?

Looking at Bugzilla as jwakely suggested turns up
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58601
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70124


Regards.

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

* Re: Alignas broken when used with constexpr array data member for structure
  2018-01-09 14:26   ` Mason
@ 2018-01-09 14:29     ` Jonathan Wakely
  2018-01-12 16:50     ` Alec Teal
  1 sibling, 0 replies; 9+ messages in thread
From: Jonathan Wakely @ 2018-01-09 14:29 UTC (permalink / raw)
  To: Mason; +Cc: Alec Teal, GCC help

On 9 January 2018 at 14:26, Mason wrote:
> On 09/01/2018 14:39, Alec Teal wrote:
>
>> In GCC 4.8.4 I have something like the following:
>
> FWIW, 4.8 is no longer supported (2013)
>
>> constexpr int x = 5;
>> constexpr int y = 4;
>> struct alignas(y) my_data_block {
>>     char data[x];
>> };
>>
>>
>> And it causes some weird errors to the tune of "size of array 'data' is
>> not an integral constant-expression" in the presence of the alignas
>
> A good support request should specify
> - exact compiler version (GCC 4.8.4)
> - a small testcase (given above)
> - exact compilation flags (missing)
> - exact error message
>
>
> Compiling the above source on godbolt using:
> gcc 4.8.4 -Wall -Wextra
>
> 1 : <source>:1:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++0x-compat]
>  constexpr int x = 5;
>  ^
> 1 : <source>:1:1: error: 'constexpr' does not name a type
> 1 : <source>:1:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
> 2 : <source>:2:1: error: 'constexpr' does not name a type
>  constexpr int y = 4;
>  ^
> 2 : <source>:2:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
> 3 : <source>:3:19: error: expected initializer before 'my_data_block'
>  struct alignas(y) my_data_block {
>                    ^
> Compiler returned: 1
>
>
>
> Compiling the above source on godbolt using:
> gcc 4.8.4 -Wall -Wextra -std=c++11
>
> No errors.
>
>
> So it seems I can't reproduce the issue?
>
> Looking at Bugzilla as jwakely suggested turns up
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58601
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70124

Don't give a help vampire a direct answer, see
http://slash7.com/2006/12/22/vampires/

You just enable their bad behaviour.

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

* Re: Alignas broken when used with constexpr array data member for structure
  2018-01-09 14:26   ` Mason
  2018-01-09 14:29     ` Jonathan Wakely
@ 2018-01-12 16:50     ` Alec Teal
  1 sibling, 0 replies; 9+ messages in thread
From: Alec Teal @ 2018-01-12 16:50 UTC (permalink / raw)
  To: Mason; +Cc: GCC help

So I can't reproduce this via godbolt

For example both the example given and:

classX {
private:
staticconstexprintx = 5;
staticconstexprinty = 4;
public:
structalignas(y) S {
chardata[x];
};
}; BOTH give errors for me - I'm just going to leave it at this point. 
It's obviously fixed whatever it was. Thanks for your time. Alec

On 09/01/18 14:26, Mason wrote:
> On 09/01/2018 14:39, Alec Teal wrote:
>
>> In GCC 4.8.4 I have something like the following:
> FWIW, 4.8 is no longer supported (2013)
>
>> constexpr int x = 5;
>> constexpr int y = 4;
>> struct alignas(y) my_data_block {
>>      char data[x];
>> };
>>
>>
>> And it causes some weird errors to the tune of "size of array 'data' is
>> not an integral constant-expression" in the presence of the alignas
> A good support request should specify
> - exact compiler version (GCC 4.8.4)
> - a small testcase (given above)
> - exact compilation flags (missing)
> - exact error message
>
>
> Compiling the above source on godbolt using:
> gcc 4.8.4 -Wall -Wextra
>
> 1 : <source>:1:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++0x-compat]
>   constexpr int x = 5;
>   ^
> 1 : <source>:1:1: error: 'constexpr' does not name a type
> 1 : <source>:1:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
> 2 : <source>:2:1: error: 'constexpr' does not name a type
>   constexpr int y = 4;
>   ^
> 2 : <source>:2:1: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
> 3 : <source>:3:19: error: expected initializer before 'my_data_block'
>   struct alignas(y) my_data_block {
>                     ^
> Compiler returned: 1
>
>
>
> Compiling the above source on godbolt using:
> gcc 4.8.4 -Wall -Wextra -std=c++11
>
> No errors.
>
>
> So it seems I can't reproduce the issue?
>
> Looking at Bugzilla as jwakely suggested turns up
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58601
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70124
>
>
> Regards.

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

end of thread, other threads:[~2018-01-12 16:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2182301d-14b8-287d-bf6b-d9ed22e34726@warwick.ac.uk>
2018-01-09 13:39 ` Fwd: [X-POST] Alignas broken when used with constexpr array data member for structure Alec Teal
2018-01-09 13:41   ` Jonathan Wakely
2018-01-09 13:49     ` Alec Teal
2018-01-09 13:56       ` Jonathan Wakely
2018-01-09 14:04         ` Alec Teal
2018-01-09 14:06           ` Jonathan Wakely
2018-01-09 14:26   ` Mason
2018-01-09 14:29     ` Jonathan Wakely
2018-01-12 16:50     ` Alec Teal

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).