aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gimplify.c3
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr101437.c29
2 files changed, 31 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 75a4a9d..93a2121 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -15060,7 +15060,8 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
*expr_p = NULL;
}
else if (COMPLETE_TYPE_P (TREE_TYPE (*expr_p))
- && TYPE_MODE (TREE_TYPE (*expr_p)) != BLKmode)
+ && TYPE_MODE (TREE_TYPE (*expr_p)) != BLKmode
+ && !is_empty_type (TREE_TYPE (*expr_p)))
{
/* Historically, the compiler has treated a bare reference
to a non-BLKmode volatile lvalue as forcing a load. */
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr101437.c b/gcc/testsuite/gcc.c-torture/compile/pr101437.c
new file mode 100644
index 0000000..96e7df8
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr101437.c
@@ -0,0 +1,29 @@
+/* PR middle-end/101437 */
+
+struct S { int : 1; };
+
+void
+foo (volatile struct S *p)
+{
+ struct S s = {};
+ *p = s;
+}
+
+void
+bar (volatile struct S *p)
+{
+ *p;
+}
+
+void
+baz (volatile struct S *p)
+{
+ struct S s;
+ s = *p;
+}
+
+void
+qux (volatile struct S *p, volatile struct S *q)
+{
+ *p = *q;
+}