summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-16 02:22:59 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-16 02:22:59 +0000
commit5c8ef8c3944ede38b7b4bfa36c9c2697c050d999 (patch)
treeb02900d53cb5f257d74a47dcc26cadd3b2198c39 /gcc/testsuite
parentd3d36188118a268c29a07839aced0771853130a7 (diff)
downloadppe42-gcc-5c8ef8c3944ede38b7b4bfa36c9c2697c050d999.tar.gz
ppe42-gcc-5c8ef8c3944ede38b7b4bfa36c9c2697c050d999.zip
PR middle-end/13400
* ifcvt.c (noce_process_if_block): Disable unconditional write optimizations if we could introduce a store to trapping memory that wasn't present previously. * gcc.c-torture/execute/20031215-1.c: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74663 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20031215-1.c38
2 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8862f109ff2..96c0ee8a93e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-12-15 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/13400
+ * gcc.c-torture/execute/20031215-1.c: New test case.
+
2003-12-15 Mark Mitchell <mark@codesourcery.com>
PR c++/13269
diff --git a/gcc/testsuite/gcc.c-torture/execute/20031215-1.c b/gcc/testsuite/gcc.c-torture/execute/20031215-1.c
new file mode 100644
index 00000000000..d62177b2618
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20031215-1.c
@@ -0,0 +1,38 @@
+/* PR middle-end/13400 */
+/* The following test used to fail at run-time with a write to read-only
+ memory, caused by if-conversion converting a conditional write into an
+ unconditional write. */
+
+typedef struct {int c, l; char ch[3];} pstr;
+const pstr ao = {2, 2, "OK"};
+const pstr * const a = &ao;
+
+void test1(void)
+{
+ if (a->ch[a->l]) {
+ ((char *)a->ch)[a->l] = 0;
+ }
+}
+
+void test2(void)
+{
+ if (a->ch[a->l]) {
+ ((char *)a->ch)[a->l] = -1;
+ }
+}
+
+void test3(void)
+{
+ if (a->ch[a->l]) {
+ ((char *)a->ch)[a->l] = 1;
+ }
+}
+
+int main(void)
+{
+ test1();
+ test2();
+ test3();
+ return 0;
+}
+
OpenPOWER on IntegriCloud