aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>2026-02-12 09:07:10 -0800
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>2026-02-12 15:23:37 -0800
commitbfeb09e591b2ae629277d4ec6578c24998c77c3b (patch)
tree7cd3cd8eae373b06fbb52f4cf2c2daea76d26073 /gcc/testsuite
parent12f461009b0e833e4a0404ab348c0fe5b7bbfc75 (diff)
downloadgcc-master.zip
gcc-master.tar.gz
gcc-master.tar.bz2
c: Handle REALPART_EXPR and IMAGPART_EXPR in fold_offsetof [PR105555]HEADtrunkmaster
In some cases the C front-end calls into fold_offsetof to fold an address but that does not handle REALPART_EXPR nor IMAGPART_EXPR so gcc produces an internal compiler error. For offsetof, REALPART_EXPR/IMAGPART_EXPR won't show up which is why they were not there before. Bootstrapped and tested on x86_64-linux-gnu. PR c/105555 gcc/c-family/ChangeLog: * c-common.cc (fold_offsetof): Handle REALPART_EXPR and IMAGPART_EXPR. gcc/testsuite/ChangeLog: * gcc.dg/complex-10.c: New test. Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.dg/complex-10.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/complex-10.c b/gcc/testsuite/gcc.dg/complex-10.c
new file mode 100644
index 0000000..b27f91f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/complex-10.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* PR c/105555 */
+
+struct C {
+ __complex int i;
+};
+struct C p[10];
+int *foo1(void) {
+ return &__real(p->i);
+}
+
+int *foo2(void) {
+ return &__imag(p->i);
+}