c/86869 - preserve address-space info when building qualified ARRAY_TYPE
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Testing passed
|
Commit Message
The following adjusts the C FE specific qualified type building
to preserve address-space info also for ARRAY_TYPE.
Bootstrap / regtest running on x86_64-unknown-linux-gnu, OK?
Thanks,
Richard.
PR c/86869
gcc/c/
* c-typeck.cc (c_build_qualified_type): Preserve address-space
info for ARRAY_TYPE.
gcc/testsuite/
* gcc.target/avr/pr86869.c: New testcase.
---
gcc/c/c-typeck.cc | 1 +
gcc/testsuite/gcc.target/avr/pr86869.c | 9 +++++++++
2 files changed, 10 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/avr/pr86869.c
Comments
On Mon, 4 Dec 2023, Richard Biener wrote:
> The following adjusts the C FE specific qualified type building
> to preserve address-space info also for ARRAY_TYPE.
>
> Bootstrap / regtest running on x86_64-unknown-linux-gnu, OK?
OK.
@@ -16263,6 +16263,7 @@ c_build_qualified_type (tree type, int type_quals, tree orig_qual_type,
t = build_variant_type_copy (type);
TREE_TYPE (t) = element_type;
+ TYPE_ADDR_SPACE (t) = TYPE_ADDR_SPACE (element_type);
if (TYPE_STRUCTURAL_EQUALITY_P (element_type)
|| (domain && TYPE_STRUCTURAL_EQUALITY_P (domain)))
new file mode 100644
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+struct S {
+ char y[2];
+};
+
+void foo(const __memx struct S *s) {
+ const char (*p)[2] = &s->y;
+}