Thanks for the review Marek;
I'll post the updated patch in a follow-on message and on bugzilla.
On Mon, Nov 15, 2021 at 8:03 PM Marek Polacek wrote:
> I also noticed the C++ FE rejects
>
> struct A { char x[4]; };
> struct B { struct A a; };
> struct B b = { .a.x = "abc" };
> but the C FE
V2 Patch
https://gcc.gnu.org/bugzilla/attachment.cgi?id=51828
On Wed, Nov 17, 2021 at 10:06 PM will wray wrote:
>
> Thanks for the review Marek;
> I'll post the updated patch in a follow-on message and on bugzilla.
>
> On Mon, Nov 15, 2021 at 8:03 PM Marek Polacek wrote:
>
> > I also noticed the
Also address "FIXME: this code is duplicated from reshape_init" in
cp_complete_array_type by always calling reshape_init on init-list.
PR c++/55227
gcc/cp/ChangeLog:
* decl.c (reshape_init_r): Only call has_designator_check when
first_initializer_p or for the inner constru
V2 Patch mailing list post
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584897.html
On Thu, Nov 18, 2021 at 10:36 AM Marek Polacek wrote:
>
> On Wed, Nov 17, 2021 at 10:23:58PM -0500, will wray wrote:
> > V2 Patch
> > https://gcc.gnu.org/bugzilla/attachment.cgi?id=51828
>
> Can you ple
([PATCH 1/3] already submitted fix for PR c++/55227, is a dependency here.)
These patches implement C++ proposal P1997 "Relaxing restrictions on array"
that adds:
C array copy semantics:
* array-array initializations
* array-array assignments
* array return-by-value from functions
Also address "FIXME: this code is duplicated from reshape_init" in
cp_complete_array_type by always calling reshape_init on init-list.
PR c++/55227
gcc/cp/ChangeLog:
* decl.c (reshape_init_r): Only call has_designator_check when
first_initializer_p or for the inner constru
This patch implements initializations of arrays from array values.
The first of two 'array-copy' patches, it adds the option -farray-copy
(flag_array_copy) to enable all features of P1997 (copy related or not),
documented as experimental extensions.
It deals with initialization of array variables
This second patch completes the work of the first 'array-copy' patch to
provide first-cut implementations of all P1997 features. It adds:
* Assignments to arrays from array values,a = b;
* Placeholder auto in array declarations, auto cp[] = a;
* Array as a return type from functions WIP
any standardization effort.
>
> The semantics of bit_cast is clear - it's just the resulting rvalue array
> itself is unfamiliar and tricky to handle within current language rules.
>
> On Mon, Nov 15, 2021 at 12:21 PM Jakub Jelinek wrote:
> >
> > On Mon, Nov 15
On Mon, Nov 22, 2021 at 3:42 PM Joseph Myers wrote:
>
> On Sun, 21 Nov 2021, Will Wray via Gcc-patches wrote:
>
> > gcc/c/ChangeLog:
> >
> > * c-decl.c (grokdeclarator): Don't complain of array returns.
>
> A C front-end change like this doesn'
This patch aims to fix PR 55227; two underlying bugs that have caused:
(1) Rejection of valid designated initialization of char array fields by
string literals (a) when enclosed in optional braces or (b) unbraced
when the string literal is shorter than the target char array field.
(2) Acceptance
This patch aims to fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55227.
There are two underlying bugs in the designated initialization of char array
fields by string literals that cause:
(1) Rejection of valid cases with:
(a) brace-enclosed string literal initializer (of any valid size), or
This patch allows __builtin_bit_cast to materialize a C array as its To type.
It was developed as part of an implementation of P1997, array copy-semantics,
but is independent, so makes sense to submit, review and merge ahead of it.
gcc/cp/ChangeLog:
* constexpr.c (check_bit_cast_type): h
Ping.
One motivation for allowing builtin bit_cast to builtin array is that
it enables direct bitwise constexpr comparisons via memcmp:
template
constexpr int bit_equal(A const& a, B const& b)
{
static_assert( sizeof a == sizeof b,
"bit_equal(a,b) requires same sizeof"
The fixes test out, as does the FIXME that's fixed based on the fixes...
Note that the bug causes bogus rejection of any designated initialization
of char array from a string literal, except for the singular case where the
string literal initializer size exactly matches the target char array size
2021 at 12:21 PM Jakub Jelinek wrote:
>
> On Mon, Nov 15, 2021 at 12:12:22PM -0500, will wray via Gcc-patches wrote:
> > One motivation for allowing builtin bit_cast to builtin array is that
> > it enables direct bitwise constexpr comparisons via memcmp:
> >
> >
V3 addresses Jason's review point - it.undoes unnecessary variable renames
(back from arr_init to str_init)
Also address "FIXME: this code is duplicated from reshape_init" in
cp_complete_array_type by always calling reshape_init on init-list.
PR c++/55227
gcc/cp/ChangeLog:
* decl.c (reshape_in
Attached
(the cut n paste looks like it removed some whitespace formatting)
0001-c-designated-init-of-char-array-by-string-constant-P.patch
Description: Binary data
18 matches
Mail list logo