summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/ipa-sra-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/ipa-sra-1.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ipa-sra-1.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/ipa-sra-1.c b/gcc/testsuite/gcc.c-torture/execute/ipa-sra-1.c
new file mode 100644
index 000000000..777ed2a83
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ipa-sra-1.c
@@ -0,0 +1,29 @@
+/* Trivially making sure IPA-SRA does not introduce segfaults where they should
+ not be. */
+
+struct bovid
+{
+ float red;
+ int green;
+ void *blue;
+};
+
+static int
+__attribute__((noinline))
+ox (int fail, struct bovid *cow)
+{
+ int r;
+ if (fail)
+ r = cow->red;
+ else
+ r = 0;
+ return r;
+}
+
+int main (int argc, char *argv[])
+{
+ int r;
+
+ r = ox ((argc > 2000), (void *) 0);
+ return r;
+}