diff options
author | Richard Biener <rguenther@suse.de> | 2023-12-04 13:31:35 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-12-05 08:27:36 +0100 |
commit | e00c00730912cd6072954cd2c29ca44e33dbb598 (patch) | |
tree | 93d1b256be3496cd5a9f353fb9431cf4fb2b7108 /gcc | |
parent | 50f2a3370d177f8fe9bea0461feb710523e048a2 (diff) | |
download | gcc-e00c00730912cd6072954cd2c29ca44e33dbb598.zip gcc-e00c00730912cd6072954cd2c29ca44e33dbb598.tar.gz gcc-e00c00730912cd6072954cd2c29ca44e33dbb598.tar.bz2 |
c/86869 - preserve address-space info when building qualified ARRAY_TYPE
The following adjusts the C FE specific qualified type building
to preserve address-space info also for ARRAY_TYPE.
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/c-typeck.cc | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/avr/pr86869.c | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index a6edbc8..8368939 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -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))) diff --git a/gcc/testsuite/gcc.target/avr/pr86869.c b/gcc/testsuite/gcc.target/avr/pr86869.c new file mode 100644 index 0000000..fbfb378 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/pr86869.c @@ -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; +} |