Re: [PATCH] Add scalar_storage_order support to C++

2023-06-20 Thread Andrew Pinski via Gcc-patches
On Thu, May 25, 2023 at 2:32 AM naveenh--- via Gcc-patches
 wrote:
>
> From: Naveen H S 
>
> This patch adds support scalar_storage_order attribute to C++ front-end.
> It treats the opposite order fields similar as the packed fields are
> treated such that they will not bind to references.
> For arrays, the attributes applies to the inner type rather than the array
> type similar. The code is similar to how it is handled in the C front-end.
>
> 2021-04-03  Andrew Pinski   
>
> Co-authored-by: Naveen H S 

First off, sorry this was sent multiple times to the list, Naveen
didn't know Marvell's internal email SMTP server was delaying the mail
so much; he didn't realize it went through so he sent it again. I let
him know next time to send it and come back in an hour to see if it
made it through for next time.

Ping?

Thanks,
Andrew


>
> gcc/ChangeLog:
>
> * c-family/c-attribs.cc (handle_scalar_storage_order_attribute):
> Do not reject the C++ cases.
> * cp/class.cc (layout_nonempty_base_or_field): Fix the type of
> arrays in C++.
> * cp/call.cc (reference_binding): Treat reversed field similar as
> packed fields.
> (build_temp): Likewise.
> (convert_like_internal): Emit error code for non binding reversed
> endian field.
> * cp/cp-tree.h (clk_implicit_rval) : Add clk_reversed.
> * cp/cp-tree.c (lvalue_kind) : Handle reverse storage ordered 
> operands.
>
> gcc/testsuite/ChangeLog:
>
> * c-c++-common/sso/dump.h: Move from gcc.dg/sso to c-c++-common/sso.
> * c-c++-common/sso/init1.h: Likewise.
> * c-c++-common/sso/init13.h: Likewise.
> * c-c++-common/sso/init2.h: Likewise.
> * c-c++-common/sso/init3.h: Likewise.
> * c-c++-common/sso/init4.h: Likewise.
> * c-c++-common/sso/init5.h: Likewise.
> * c-c++-common/sso/init6.h: Likewise.
> * c-c++-common/sso/init7.h: Likewise.
> * c-c++-common/sso/init8.h: Likewise.
> * c-c++-common/sso/init9.h: Likewise.
> * c-c++-common/sso/p1.c: Likewise.
> * c-c++-common/sso/p13.c: Likewise.
> * c-c++-common/sso/p2.c: Likewise.
> * c-c++-common/sso/p3.c: Likewise.
> * c-c++-common/sso/p4.c: Likewise.
> * c-c++-common/sso/p5.c: Likewise.
> * c-c++-common/sso/p6.c: Likewise.
> * c-c++-common/sso/p7.c: Likewise.
> * c-c++-common/sso/p8.c: Likewise.
> * c-c++-common/sso/p9.c: Likewise.
> * c-c++-common/sso/q1.c: Likewise.
> * c-c++-common/sso/q13.c: Likewise.
> * c-c++-common/sso/q2.c: Likewise.
> * c-c++-common/sso/q3.c: Likewise.
> * c-c++-common/sso/q4.c: Likewise.
> * c-c++-common/sso/q5.c: Likewise.
> * c-c++-common/sso/q6.c: Likewise.
> * c-c++-common/sso/q7.c: Likewise.
> * c-c++-common/sso/q8.c: Likewise.
> * c-c++-common/sso/q9.c: Likewise.
> * c-c++-common/sso/r3.c: Likewise.
> * c-c++-common/sso/r5.c: Likewise.
> * c-c++-common/sso/r6.c: Likewise.
> * c-c++-common/sso/r7.c: Likewise.
> * c-c++-common/sso/r8.c: Likewise.
> * c-c++-common/sso/s3.c: Likewise.
> * c-c++-common/sso/s5.c: Likewise.
> * c-c++-common/sso/s6.c: Likewise.
> * c-c++-common/sso/s7.c: Likewise.
> * c-c++-common/sso/s8.c: Likewise.
> * c-c++-common/sso/t1.c: Likewise.
> * c-c++-common/sso/t13.c: Likewise.
> * c-c++-common/sso/t2.c: Likewise.
> * c-c++-common/sso/t3.c: Likewise.
> * c-c++-common/sso/t4.c: Likewise.
> * c-c++-common/sso/t5.c: Likewise.
> * c-c++-common/sso/t6.c: Likewise.
> * c-c++-common/sso/t7.c: Likewise.
> * c-c++-common/sso/t8.c: Likewise.
> * c-c++-common/sso/t9.c: Likewise.
> * c-c++-common/sso/u5.c: Likewise.
> * c-c++-common/sso/t6.c: Likewise.
> * g++.dg/sso/sso.exp: New file.
> * g++.dg/sso/auto-1.C: New file.
> * g++.dg/sso/auto-2.C: New file.
> * g++.dg/sso/auto-3.C: New file.
> * g++.dg/sso/template-reference-1.C: New file.
> * g++.dg/sso/template-reference-2.C: New file.
> * g++.dg/sso/template-reference-3.C: New file.
> * g++.dg/sso/template-reference-4.C: New file.
> * g++.dg/sso-1.C: Modified.
> ---
>  gcc/c-family/c-attribs.cc |  2 +-
>  gcc/cp/call.cc| 17 ++-
>  gcc/cp/class.cc   | 22 ++
>  gcc/cp/cp-tree.h  |  3 +-
>  gcc/cp/tree.cc|  5 ++-
>  .../{gcc.dg => c-c++-common}/sso/dump.h   |  0
>  .../{gcc.dg => c-c++-common}/sso/init1.h  |  0
>  .../{gcc.dg => c-c++-common}/sso/init13.h |  0
>  .../{gcc.dg => c-c++-common}/sso/init2.h  |  0
>  .../{gcc.dg => c-c++-common}/sso/init3.h  |  0
>  .../{gcc.dg => 

[PATCH] Add scalar_storage_order support to C++

2023-05-25 Thread naveenh--- via Gcc-patches
From: Naveen H S 

This patch adds support scalar_storage_order attribute to C++ front-end.
It treats the opposite order fields similar as the packed fields are
treated such that they will not bind to references.
For arrays, the attributes applies to the inner type rather than the array
type similar. The code is similar to how it is handled in the C front-end.

2021-04-03  Andrew Pinski   

Co-authored-by: Naveen H S 

gcc/ChangeLog:

* c-family/c-attribs.cc (handle_scalar_storage_order_attribute):
Do not reject the C++ cases.
* cp/class.cc (layout_nonempty_base_or_field): Fix the type of
arrays in C++.
* cp/call.cc (reference_binding): Treat reversed field similar as
packed fields.
(build_temp): Likewise.
(convert_like_internal): Emit error code for non binding reversed
endian field.
* cp/cp-tree.h (clk_implicit_rval) : Add clk_reversed.
* cp/cp-tree.c (lvalue_kind) : Handle reverse storage ordered operands.

gcc/testsuite/ChangeLog:

* c-c++-common/sso/dump.h: Move from gcc.dg/sso to c-c++-common/sso.
* c-c++-common/sso/init1.h: Likewise.
* c-c++-common/sso/init13.h: Likewise.
* c-c++-common/sso/init2.h: Likewise.
* c-c++-common/sso/init3.h: Likewise.
* c-c++-common/sso/init4.h: Likewise.
* c-c++-common/sso/init5.h: Likewise.
* c-c++-common/sso/init6.h: Likewise.
* c-c++-common/sso/init7.h: Likewise.
* c-c++-common/sso/init8.h: Likewise.
* c-c++-common/sso/init9.h: Likewise.
* c-c++-common/sso/p1.c: Likewise.
* c-c++-common/sso/p13.c: Likewise.
* c-c++-common/sso/p2.c: Likewise.
* c-c++-common/sso/p3.c: Likewise.
* c-c++-common/sso/p4.c: Likewise.
* c-c++-common/sso/p5.c: Likewise.
* c-c++-common/sso/p6.c: Likewise.
* c-c++-common/sso/p7.c: Likewise.
* c-c++-common/sso/p8.c: Likewise.
* c-c++-common/sso/p9.c: Likewise.
* c-c++-common/sso/q1.c: Likewise.
* c-c++-common/sso/q13.c: Likewise.
* c-c++-common/sso/q2.c: Likewise.
* c-c++-common/sso/q3.c: Likewise.
* c-c++-common/sso/q4.c: Likewise.
* c-c++-common/sso/q5.c: Likewise.
* c-c++-common/sso/q6.c: Likewise.
* c-c++-common/sso/q7.c: Likewise.
* c-c++-common/sso/q8.c: Likewise.
* c-c++-common/sso/q9.c: Likewise.
* c-c++-common/sso/r3.c: Likewise.
* c-c++-common/sso/r5.c: Likewise.
* c-c++-common/sso/r6.c: Likewise.
* c-c++-common/sso/r7.c: Likewise.
* c-c++-common/sso/r8.c: Likewise.
* c-c++-common/sso/s3.c: Likewise.
* c-c++-common/sso/s5.c: Likewise.
* c-c++-common/sso/s6.c: Likewise.
* c-c++-common/sso/s7.c: Likewise.
* c-c++-common/sso/s8.c: Likewise.
* c-c++-common/sso/t1.c: Likewise.
* c-c++-common/sso/t13.c: Likewise.
* c-c++-common/sso/t2.c: Likewise.
* c-c++-common/sso/t3.c: Likewise.
* c-c++-common/sso/t4.c: Likewise.
* c-c++-common/sso/t5.c: Likewise.
* c-c++-common/sso/t6.c: Likewise.
* c-c++-common/sso/t7.c: Likewise.
* c-c++-common/sso/t8.c: Likewise.
* c-c++-common/sso/t9.c: Likewise.
* c-c++-common/sso/u5.c: Likewise.
* c-c++-common/sso/t6.c: Likewise.
* g++.dg/sso/sso.exp: New file.
* g++.dg/sso/auto-1.C: New file.
* g++.dg/sso/auto-2.C: New file.
* g++.dg/sso/auto-3.C: New file.
* g++.dg/sso/template-reference-1.C: New file.
* g++.dg/sso/template-reference-2.C: New file.
* g++.dg/sso/template-reference-3.C: New file.
* g++.dg/sso/template-reference-4.C: New file.
* g++.dg/sso-1.C: Modified.
---
 gcc/c-family/c-attribs.cc |  2 +-
 gcc/cp/call.cc| 17 ++-
 gcc/cp/class.cc   | 22 ++
 gcc/cp/cp-tree.h  |  3 +-
 gcc/cp/tree.cc|  5 ++-
 .../{gcc.dg => c-c++-common}/sso/dump.h   |  0
 .../{gcc.dg => c-c++-common}/sso/init1.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init13.h |  0
 .../{gcc.dg => c-c++-common}/sso/init2.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init3.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init4.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init5.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init6.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init7.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init8.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init9.h  |  0
 .../{gcc.dg => c-c++-common}/sso/p1.c |  0
 .../{gcc.dg => c-c++-common}/sso/p13.c|  1 +
 .../{gcc.dg => c-c++-common}/sso/p2.c |  0
 .../{gcc.dg => c-c++-common}/sso/p3.c |  0
 .../{gcc.dg => c-c++-common}/sso/p4.c |  0
 .../{gcc.dg => c-c++-common}/sso/p5.c |  0
 .../{gcc.dg => 

[PATCH] Add scalar_storage_order support to C++

2023-05-25 Thread naveenh--- via Gcc-patches
From: Naveen H S 

This patch adds support scalar_storage_order attribute to C++ front-end.
It treats the opposite order fields similar as the packed fields are
treated such that they will not bind to references.
For arrays, the attributes applies to the inner type rather than the array
type similar. The code is similar to how it is handled in the C front-end.

2021-04-03  Andrew Pinski   

gcc/ChangeLog:

* c-family/c-attribs.cc (handle_scalar_storage_order_attribute):
Do not reject the C++ cases.
* cp/class.cc (layout_nonempty_base_or_field): Fix the type of
arrays in C++.
* cp/call.cc (reference_binding): Treat reversed field similar as
packed fields.
(build_temp): Likewise.
(convert_like_internal): Emit error code for non binding reversed
endian field.
* cp/cp-tree.h (clk_implicit_rval) : Add clk_reversed.
* cp/cp-tree.c (lvalue_kind) : Handle reverse storage ordered operands.

gcc/testsuite/ChangeLog:

* c-c++-common/sso/dump.h: Move from gcc.dg/sso to c-c++-common/sso.
* c-c++-common/sso/init1.h: Likewise.
* c-c++-common/sso/init13.h: Likewise.
* c-c++-common/sso/init2.h: Likewise.
* c-c++-common/sso/init3.h: Likewise.
* c-c++-common/sso/init4.h: Likewise.
* c-c++-common/sso/init5.h: Likewise.
* c-c++-common/sso/init6.h: Likewise.
* c-c++-common/sso/init7.h: Likewise.
* c-c++-common/sso/init8.h: Likewise.
* c-c++-common/sso/init9.h: Likewise.
* c-c++-common/sso/p1.c: Likewise.
* c-c++-common/sso/p13.c: Likewise.
* c-c++-common/sso/p2.c: Likewise.
* c-c++-common/sso/p3.c: Likewise.
* c-c++-common/sso/p4.c: Likewise.
* c-c++-common/sso/p5.c: Likewise.
* c-c++-common/sso/p6.c: Likewise.
* c-c++-common/sso/p7.c: Likewise.
* c-c++-common/sso/p8.c: Likewise.
* c-c++-common/sso/p9.c: Likewise.
* c-c++-common/sso/q1.c: Likewise.
* c-c++-common/sso/q13.c: Likewise.
* c-c++-common/sso/q2.c: Likewise.
* c-c++-common/sso/q3.c: Likewise.
* c-c++-common/sso/q4.c: Likewise.
* c-c++-common/sso/q5.c: Likewise.
* c-c++-common/sso/q6.c: Likewise.
* c-c++-common/sso/q7.c: Likewise.
* c-c++-common/sso/q8.c: Likewise.
* c-c++-common/sso/q9.c: Likewise.
* c-c++-common/sso/r3.c: Likewise.
* c-c++-common/sso/r5.c: Likewise.
* c-c++-common/sso/r6.c: Likewise.
* c-c++-common/sso/r7.c: Likewise.
* c-c++-common/sso/r8.c: Likewise.
* c-c++-common/sso/s3.c: Likewise.
* c-c++-common/sso/s5.c: Likewise.
* c-c++-common/sso/s6.c: Likewise.
* c-c++-common/sso/s7.c: Likewise.
* c-c++-common/sso/s8.c: Likewise.
* c-c++-common/sso/t1.c: Likewise.
* c-c++-common/sso/t13.c: Likewise.
* c-c++-common/sso/t2.c: Likewise.
* c-c++-common/sso/t3.c: Likewise.
* c-c++-common/sso/t4.c: Likewise.
* c-c++-common/sso/t5.c: Likewise.
* c-c++-common/sso/t6.c: Likewise.
* c-c++-common/sso/t7.c: Likewise.
* c-c++-common/sso/t8.c: Likewise.
* c-c++-common/sso/t9.c: Likewise.
* c-c++-common/sso/u5.c: Likewise.
* c-c++-common/sso/t6.c: Likewise.
* g++.dg/sso/sso.exp: New file.
* g++.dg/sso/auto-1.C: New file.
* g++.dg/sso/auto-2.C: New file.
* g++.dg/sso/auto-3.C: New file.
* g++.dg/sso/template-reference-1.C: New file.
* g++.dg/sso/template-reference-2.C: New file.
* g++.dg/sso/template-reference-3.C: New file.
* g++.dg/sso/template-reference-4.C: New file.
* g++.dg/sso-1.C: Modified.
---
 gcc/c-family/c-attribs.cc |  2 +-
 gcc/cp/call.cc| 17 ++-
 gcc/cp/class.cc   | 22 ++
 gcc/cp/cp-tree.h  |  3 +-
 gcc/cp/tree.cc|  5 ++-
 .../{gcc.dg => c-c++-common}/sso/dump.h   |  0
 .../{gcc.dg => c-c++-common}/sso/init1.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init13.h |  0
 .../{gcc.dg => c-c++-common}/sso/init2.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init3.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init4.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init5.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init6.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init7.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init8.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init9.h  |  0
 .../{gcc.dg => c-c++-common}/sso/p1.c |  0
 .../{gcc.dg => c-c++-common}/sso/p13.c|  1 +
 .../{gcc.dg => c-c++-common}/sso/p2.c |  0
 .../{gcc.dg => c-c++-common}/sso/p3.c |  0
 .../{gcc.dg => c-c++-common}/sso/p4.c |  0
 .../{gcc.dg => c-c++-common}/sso/p5.c |  0
 .../{gcc.dg => c-c++-common}/sso/p6.c   

[PATCH] Add scalar_storage_order support to C++

2023-05-25 Thread naveenh--- via Gcc-patches
From: Naveen H S 

This patch adds support scalar_storage_order attribute to C++ front-end.
It treats the opposite order fields similar as the packed fields are
treated such that they will not bind to references.
For arrays, the attributes applies to the inner type rather than the array
type similar. The code is similar to how it is handled in the C front-end.

2021-04-03  Andrew Pinski   

gcc/ChangeLog:

* c-family/c-attribs.cc (handle_scalar_storage_order_attribute):
Do not reject the C++ cases.
* cp/class.cc (layout_nonempty_base_or_field): Fix the type of
arrays in C++.
* cp/call.cc (reference_binding): Treat reversed field similar as
packed fields.
(build_temp): Likewise.
(convert_like_internal): Emit error code for non binding reversed
endian field.
* cp/cp-tree.h (clk_implicit_rval) : Add clk_reversed.
* cp/cp-tree.c (lvalue_kind) : Handle reverse storage ordered operands.

gcc/testsuite/ChangeLog:

* c-c++-common/sso/dump.h: Move from gcc.dg/sso to c-c++-common/sso.
* c-c++-common/sso/init1.h: Likewise.
* c-c++-common/sso/init13.h: Likewise.
* c-c++-common/sso/init2.h: Likewise.
* c-c++-common/sso/init3.h: Likewise.
* c-c++-common/sso/init4.h: Likewise.
* c-c++-common/sso/init5.h: Likewise.
* c-c++-common/sso/init6.h: Likewise.
* c-c++-common/sso/init7.h: Likewise.
* c-c++-common/sso/init8.h: Likewise.
* c-c++-common/sso/init9.h: Likewise.
* c-c++-common/sso/p1.c: Likewise.
* c-c++-common/sso/p13.c: Likewise.
* c-c++-common/sso/p2.c: Likewise.
* c-c++-common/sso/p3.c: Likewise.
* c-c++-common/sso/p4.c: Likewise.
* c-c++-common/sso/p5.c: Likewise.
* c-c++-common/sso/p6.c: Likewise.
* c-c++-common/sso/p7.c: Likewise.
* c-c++-common/sso/p8.c: Likewise.
* c-c++-common/sso/p9.c: Likewise.
* c-c++-common/sso/q1.c: Likewise.
* c-c++-common/sso/q13.c: Likewise.
* c-c++-common/sso/q2.c: Likewise.
* c-c++-common/sso/q3.c: Likewise.
* c-c++-common/sso/q4.c: Likewise.
* c-c++-common/sso/q5.c: Likewise.
* c-c++-common/sso/q6.c: Likewise.
* c-c++-common/sso/q7.c: Likewise.
* c-c++-common/sso/q8.c: Likewise.
* c-c++-common/sso/q9.c: Likewise.
* c-c++-common/sso/r3.c: Likewise.
* c-c++-common/sso/r5.c: Likewise.
* c-c++-common/sso/r6.c: Likewise.
* c-c++-common/sso/r7.c: Likewise.
* c-c++-common/sso/r8.c: Likewise.
* c-c++-common/sso/s3.c: Likewise.
* c-c++-common/sso/s5.c: Likewise.
* c-c++-common/sso/s6.c: Likewise.
* c-c++-common/sso/s7.c: Likewise.
* c-c++-common/sso/s8.c: Likewise.
* c-c++-common/sso/t1.c: Likewise.
* c-c++-common/sso/t13.c: Likewise.
* c-c++-common/sso/t2.c: Likewise.
* c-c++-common/sso/t3.c: Likewise.
* c-c++-common/sso/t4.c: Likewise.
* c-c++-common/sso/t5.c: Likewise.
* c-c++-common/sso/t6.c: Likewise.
* c-c++-common/sso/t7.c: Likewise.
* c-c++-common/sso/t8.c: Likewise.
* c-c++-common/sso/t9.c: Likewise.
* c-c++-common/sso/u5.c: Likewise.
* c-c++-common/sso/t6.c: Likewise.
* g++.dg/sso/sso.exp: New file.
* g++.dg/sso/auto-1.C: New file.
* g++.dg/sso/auto-2.C: New file.
* g++.dg/sso/auto-3.C: New file.
* g++.dg/sso/template-reference-1.C: New file.
* g++.dg/sso/template-reference-2.C: New file.
* g++.dg/sso/template-reference-3.C: New file.
* g++.dg/sso/template-reference-4.C: New file.
* g++.dg/sso-1.C: Modified.

Co-authored-by: Naveen H S 
---
 gcc/c-family/c-attribs.cc |  2 +-
 gcc/cp/call.cc| 17 ++-
 gcc/cp/class.cc   | 22 ++
 gcc/cp/cp-tree.h  |  3 +-
 gcc/cp/tree.cc|  5 ++-
 .../{gcc.dg => c-c++-common}/sso/dump.h   |  0
 .../{gcc.dg => c-c++-common}/sso/init1.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init13.h |  0
 .../{gcc.dg => c-c++-common}/sso/init2.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init3.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init4.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init5.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init6.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init7.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init8.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init9.h  |  0
 .../{gcc.dg => c-c++-common}/sso/p1.c |  0
 .../{gcc.dg => c-c++-common}/sso/p13.c|  1 +
 .../{gcc.dg => c-c++-common}/sso/p2.c |  0
 .../{gcc.dg => c-c++-common}/sso/p3.c |  0
 .../{gcc.dg => c-c++-common}/sso/p4.c |  0
 .../{gcc.dg => c-c++-common}/sso/p5.c |  0
 .../{gcc.dg => 

[PATCH] Add scalar_storage_order support to C++

2023-05-25 Thread naveenh--- via Gcc-patches
From: Naveen H S 

This patch adds support scalar_storage_order attribute to C++ front-end.
It treats the opposite order fields similar as the packed fields are
treated such that they will not bind to references.
For arrays, the attributes applies to the inner type rather than the array
type similar. The code is similar to how it is handled in the C front-end.

2021-04-03  Andrew Pinski   

gcc/ChangeLog:

* c-family/c-attribs.cc (handle_scalar_storage_order_attribute):
Do not reject the C++ cases.
* cp/class.cc (layout_nonempty_base_or_field): Fix the type of
arrays in C++.
* cp/call.cc (reference_binding): Treat reversed field similar as
packed fields.
(build_temp): Likewise.
(convert_like_internal): Emit error code for non binding reversed
endian field.
* cp/cp-tree.h (clk_implicit_rval) : Add clk_reversed.
* cp/cp-tree.c (lvalue_kind) : Handle reverse storage ordered operands.

gcc/testsuite/ChangeLog:

* c-c++-common/sso/dump.h: Move from gcc.dg/sso to c-c++-common/sso.
* c-c++-common/sso/init1.h: Likewise.
* c-c++-common/sso/init13.h: Likewise.
* c-c++-common/sso/init2.h: Likewise.
* c-c++-common/sso/init3.h: Likewise.
* c-c++-common/sso/init4.h: Likewise.
* c-c++-common/sso/init5.h: Likewise.
* c-c++-common/sso/init6.h: Likewise.
* c-c++-common/sso/init7.h: Likewise.
* c-c++-common/sso/init8.h: Likewise.
* c-c++-common/sso/init9.h: Likewise.
* c-c++-common/sso/p1.c: Likewise.
* c-c++-common/sso/p13.c: Likewise.
* c-c++-common/sso/p2.c: Likewise.
* c-c++-common/sso/p3.c: Likewise.
* c-c++-common/sso/p4.c: Likewise.
* c-c++-common/sso/p5.c: Likewise.
* c-c++-common/sso/p6.c: Likewise.
* c-c++-common/sso/p7.c: Likewise.
* c-c++-common/sso/p8.c: Likewise.
* c-c++-common/sso/p9.c: Likewise.
* c-c++-common/sso/q1.c: Likewise.
* c-c++-common/sso/q13.c: Likewise.
* c-c++-common/sso/q2.c: Likewise.
* c-c++-common/sso/q3.c: Likewise.
* c-c++-common/sso/q4.c: Likewise.
* c-c++-common/sso/q5.c: Likewise.
* c-c++-common/sso/q6.c: Likewise.
* c-c++-common/sso/q7.c: Likewise.
* c-c++-common/sso/q8.c: Likewise.
* c-c++-common/sso/q9.c: Likewise.
* c-c++-common/sso/r3.c: Likewise.
* c-c++-common/sso/r5.c: Likewise.
* c-c++-common/sso/r6.c: Likewise.
* c-c++-common/sso/r7.c: Likewise.
* c-c++-common/sso/r8.c: Likewise.
* c-c++-common/sso/s3.c: Likewise.
* c-c++-common/sso/s5.c: Likewise.
* c-c++-common/sso/s6.c: Likewise.
* c-c++-common/sso/s7.c: Likewise.
* c-c++-common/sso/s8.c: Likewise.
* c-c++-common/sso/t1.c: Likewise.
* c-c++-common/sso/t13.c: Likewise.
* c-c++-common/sso/t2.c: Likewise.
* c-c++-common/sso/t3.c: Likewise.
* c-c++-common/sso/t4.c: Likewise.
* c-c++-common/sso/t5.c: Likewise.
* c-c++-common/sso/t6.c: Likewise.
* c-c++-common/sso/t7.c: Likewise.
* c-c++-common/sso/t8.c: Likewise.
* c-c++-common/sso/t9.c: Likewise.
* c-c++-common/sso/u5.c: Likewise.
* c-c++-common/sso/t6.c: Likewise.
* g++.dg/sso/sso.exp: New file.
* g++.dg/sso/auto-1.C: New file.
* g++.dg/sso/auto-2.C: New file.
* g++.dg/sso/auto-3.C: New file.
* g++.dg/sso/template-reference-1.C: New file.
* g++.dg/sso/template-reference-2.C: New file.
* g++.dg/sso/template-reference-3.C: New file.
* g++.dg/sso/template-reference-4.C: New file.
* g++.dg/sso-1.C: Modified.

Co-authored-by: Naveen H S 
---
 gcc/c-family/c-attribs.cc |  2 +-
 gcc/cp/call.cc| 17 ++-
 gcc/cp/class.cc   | 22 ++
 gcc/cp/cp-tree.h  |  3 +-
 gcc/cp/tree.cc|  5 ++-
 .../{gcc.dg => c-c++-common}/sso/dump.h   |  0
 .../{gcc.dg => c-c++-common}/sso/init1.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init13.h |  0
 .../{gcc.dg => c-c++-common}/sso/init2.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init3.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init4.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init5.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init6.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init7.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init8.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init9.h  |  0
 .../{gcc.dg => c-c++-common}/sso/p1.c |  0
 .../{gcc.dg => c-c++-common}/sso/p13.c|  1 +
 .../{gcc.dg => c-c++-common}/sso/p2.c |  0
 .../{gcc.dg => c-c++-common}/sso/p3.c |  0
 .../{gcc.dg => c-c++-common}/sso/p4.c |  0
 .../{gcc.dg => c-c++-common}/sso/p5.c |  0
 .../{gcc.dg => 

[PATCH] Add scalar_storage_order support to C++

2023-05-25 Thread naveenh--- via Gcc-patches
From: Naveen H S 

This patch adds support scalar_storage_order attribute to C++ front-end.
It treats the opposite order fields similar as the packed fields are
treated such that they will not bind to references.
For arrays, the attributes applies to the inner type rather than the array
type similar. The code is similar to how it is handled in the C front-end.

2021-04-03  Andrew Pinski   

gcc/ChangeLog:

* c-family/c-attribs.cc (handle_scalar_storage_order_attribute):
Do not reject the C++ cases.
* cp/class.cc (layout_nonempty_base_or_field): Fix the type of
arrays in C++.
* cp/call.cc (reference_binding): Treat reversed field similar as
packed fields.
(build_temp): Likewise.
(convert_like_internal): Emit error code for non binding reversed
endian field.
* cp/cp-tree.h (clk_implicit_rval) : Add clk_reversed.
* cp/cp-tree.c (lvalue_kind) : Handle reverse storage ordered operands.

gcc/testsuite/ChangeLog:

* c-c++-common/sso/dump.h: Move from gcc.dg/sso to c-c++-common/sso.
* c-c++-common/sso/init1.h: Likewise.
* c-c++-common/sso/init13.h: Likewise.
* c-c++-common/sso/init2.h: Likewise.
* c-c++-common/sso/init3.h: Likewise.
* c-c++-common/sso/init4.h: Likewise.
* c-c++-common/sso/init5.h: Likewise.
* c-c++-common/sso/init6.h: Likewise.
* c-c++-common/sso/init7.h: Likewise.
* c-c++-common/sso/init8.h: Likewise.
* c-c++-common/sso/init9.h: Likewise.
* c-c++-common/sso/p1.c: Likewise.
* c-c++-common/sso/p13.c: Likewise.
* c-c++-common/sso/p2.c: Likewise.
* c-c++-common/sso/p3.c: Likewise.
* c-c++-common/sso/p4.c: Likewise.
* c-c++-common/sso/p5.c: Likewise.
* c-c++-common/sso/p6.c: Likewise.
* c-c++-common/sso/p7.c: Likewise.
* c-c++-common/sso/p8.c: Likewise.
* c-c++-common/sso/p9.c: Likewise.
* c-c++-common/sso/q1.c: Likewise.
* c-c++-common/sso/q13.c: Likewise.
* c-c++-common/sso/q2.c: Likewise.
* c-c++-common/sso/q3.c: Likewise.
* c-c++-common/sso/q4.c: Likewise.
* c-c++-common/sso/q5.c: Likewise.
* c-c++-common/sso/q6.c: Likewise.
* c-c++-common/sso/q7.c: Likewise.
* c-c++-common/sso/q8.c: Likewise.
* c-c++-common/sso/q9.c: Likewise.
* c-c++-common/sso/r3.c: Likewise.
* c-c++-common/sso/r5.c: Likewise.
* c-c++-common/sso/r6.c: Likewise.
* c-c++-common/sso/r7.c: Likewise.
* c-c++-common/sso/r8.c: Likewise.
* c-c++-common/sso/s3.c: Likewise.
* c-c++-common/sso/s5.c: Likewise.
* c-c++-common/sso/s6.c: Likewise.
* c-c++-common/sso/s7.c: Likewise.
* c-c++-common/sso/s8.c: Likewise.
* c-c++-common/sso/t1.c: Likewise.
* c-c++-common/sso/t13.c: Likewise.
* c-c++-common/sso/t2.c: Likewise.
* c-c++-common/sso/t3.c: Likewise.
* c-c++-common/sso/t4.c: Likewise.
* c-c++-common/sso/t5.c: Likewise.
* c-c++-common/sso/t6.c: Likewise.
* c-c++-common/sso/t7.c: Likewise.
* c-c++-common/sso/t8.c: Likewise.
* c-c++-common/sso/t9.c: Likewise.
* c-c++-common/sso/u5.c: Likewise.
* c-c++-common/sso/t6.c: Likewise.
* g++.dg/sso/sso.exp: New file.
* g++.dg/sso/auto-1.C: New file.
* g++.dg/sso/auto-2.C: New file.
* g++.dg/sso/auto-3.C: New file.
* g++.dg/sso/template-reference-1.C: New file.
* g++.dg/sso/template-reference-2.C: New file.
* g++.dg/sso/template-reference-3.C: New file.
* g++.dg/sso/template-reference-4.C: New file.
* g++.dg/sso-1.C: Modified.

Co-authored-by: Naveen H S 
---
 gcc/c-family/c-attribs.cc |  2 +-
 gcc/cp/call.cc| 17 ++-
 gcc/cp/class.cc   | 22 ++
 gcc/cp/cp-tree.h  |  3 +-
 gcc/cp/tree.cc|  5 ++-
 .../{gcc.dg => c-c++-common}/sso/dump.h   |  0
 .../{gcc.dg => c-c++-common}/sso/init1.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init13.h |  0
 .../{gcc.dg => c-c++-common}/sso/init2.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init3.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init4.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init5.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init6.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init7.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init8.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init9.h  |  0
 .../{gcc.dg => c-c++-common}/sso/p1.c |  0
 .../{gcc.dg => c-c++-common}/sso/p13.c|  1 +
 .../{gcc.dg => c-c++-common}/sso/p2.c |  0
 .../{gcc.dg => c-c++-common}/sso/p3.c |  0
 .../{gcc.dg => c-c++-common}/sso/p4.c |  0
 .../{gcc.dg => c-c++-common}/sso/p5.c |  0
 .../{gcc.dg => 

[PATCH] Add scalar_storage_order support to C++

2023-05-25 Thread naveenh--- via Gcc-patches
From: Naveen H S 

This patch adds support scalar_storage_order attribute to C++ front-end.
It treats the opposite order fields similar as the packed fields are
treated such that they will not bind to references.
For arrays, the attributes applies to the inner type rather than the array
type similar. The code is similar to how it is handled in the C front-end.

2021-04-03  Andrew Pinski   

Co-authored-by: Naveen H S 

gcc/ChangeLog:

* c-family/c-attribs.cc (handle_scalar_storage_order_attribute):
Do not reject the C++ cases.
* cp/class.cc (layout_nonempty_base_or_field): Fix the type of
arrays in C++.
* cp/call.cc (reference_binding): Treat reversed field similar as
packed fields.
(build_temp): Likewise.
(convert_like_internal): Emit error code for non binding reversed
endian field.
* cp/cp-tree.h (clk_implicit_rval) : Add clk_reversed.
* cp/cp-tree.c (lvalue_kind) : Handle reverse storage ordered operands.

gcc/testsuite/ChangeLog:

* c-c++-common/sso/dump.h: Move from gcc.dg/sso to c-c++-common/sso.
* c-c++-common/sso/init1.h: Likewise.
* c-c++-common/sso/init13.h: Likewise.
* c-c++-common/sso/init2.h: Likewise.
* c-c++-common/sso/init3.h: Likewise.
* c-c++-common/sso/init4.h: Likewise.
* c-c++-common/sso/init5.h: Likewise.
* c-c++-common/sso/init6.h: Likewise.
* c-c++-common/sso/init7.h: Likewise.
* c-c++-common/sso/init8.h: Likewise.
* c-c++-common/sso/init9.h: Likewise.
* c-c++-common/sso/p1.c: Likewise.
* c-c++-common/sso/p13.c: Likewise.
* c-c++-common/sso/p2.c: Likewise.
* c-c++-common/sso/p3.c: Likewise.
* c-c++-common/sso/p4.c: Likewise.
* c-c++-common/sso/p5.c: Likewise.
* c-c++-common/sso/p6.c: Likewise.
* c-c++-common/sso/p7.c: Likewise.
* c-c++-common/sso/p8.c: Likewise.
* c-c++-common/sso/p9.c: Likewise.
* c-c++-common/sso/q1.c: Likewise.
* c-c++-common/sso/q13.c: Likewise.
* c-c++-common/sso/q2.c: Likewise.
* c-c++-common/sso/q3.c: Likewise.
* c-c++-common/sso/q4.c: Likewise.
* c-c++-common/sso/q5.c: Likewise.
* c-c++-common/sso/q6.c: Likewise.
* c-c++-common/sso/q7.c: Likewise.
* c-c++-common/sso/q8.c: Likewise.
* c-c++-common/sso/q9.c: Likewise.
* c-c++-common/sso/r3.c: Likewise.
* c-c++-common/sso/r5.c: Likewise.
* c-c++-common/sso/r6.c: Likewise.
* c-c++-common/sso/r7.c: Likewise.
* c-c++-common/sso/r8.c: Likewise.
* c-c++-common/sso/s3.c: Likewise.
* c-c++-common/sso/s5.c: Likewise.
* c-c++-common/sso/s6.c: Likewise.
* c-c++-common/sso/s7.c: Likewise.
* c-c++-common/sso/s8.c: Likewise.
* c-c++-common/sso/t1.c: Likewise.
* c-c++-common/sso/t13.c: Likewise.
* c-c++-common/sso/t2.c: Likewise.
* c-c++-common/sso/t3.c: Likewise.
* c-c++-common/sso/t4.c: Likewise.
* c-c++-common/sso/t5.c: Likewise.
* c-c++-common/sso/t6.c: Likewise.
* c-c++-common/sso/t7.c: Likewise.
* c-c++-common/sso/t8.c: Likewise.
* c-c++-common/sso/t9.c: Likewise.
* c-c++-common/sso/u5.c: Likewise.
* c-c++-common/sso/t6.c: Likewise.
* g++.dg/sso/sso.exp: New file.
* g++.dg/sso/auto-1.C: New file.
* g++.dg/sso/auto-2.C: New file.
* g++.dg/sso/auto-3.C: New file.
* g++.dg/sso/template-reference-1.C: New file.
* g++.dg/sso/template-reference-2.C: New file.
* g++.dg/sso/template-reference-3.C: New file.
* g++.dg/sso/template-reference-4.C: New file.
* g++.dg/sso-1.C: Modified.
---
 gcc/c-family/c-attribs.cc |  2 +-
 gcc/cp/call.cc| 17 ++-
 gcc/cp/class.cc   | 22 ++
 gcc/cp/cp-tree.h  |  3 +-
 gcc/cp/tree.cc|  5 ++-
 .../{gcc.dg => c-c++-common}/sso/dump.h   |  0
 .../{gcc.dg => c-c++-common}/sso/init1.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init13.h |  0
 .../{gcc.dg => c-c++-common}/sso/init2.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init3.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init4.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init5.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init6.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init7.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init8.h  |  0
 .../{gcc.dg => c-c++-common}/sso/init9.h  |  0
 .../{gcc.dg => c-c++-common}/sso/p1.c |  0
 .../{gcc.dg => c-c++-common}/sso/p13.c|  1 +
 .../{gcc.dg => c-c++-common}/sso/p2.c |  0
 .../{gcc.dg => c-c++-common}/sso/p3.c |  0
 .../{gcc.dg => c-c++-common}/sso/p4.c |  0
 .../{gcc.dg => c-c++-common}/sso/p5.c |  0
 .../{gcc.dg =>