aboutsummaryrefslogtreecommitdiff
path: root/gcc/function-tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/function-tests.c')
-rw-r--r--gcc/function-tests.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/function-tests.c b/gcc/function-tests.c
index 4152cd386d5..049a07f9a86 100644
--- a/gcc/function-tests.c
+++ b/gcc/function-tests.c
@@ -78,6 +78,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-ref.h"
#include "cgraph.h"
#include "selftest.h"
+#include "print-rtl.h"
#if CHECKING_P
@@ -643,6 +644,27 @@ test_expansion_to_rtl ()
/* ...etc; any further checks are likely to over-specify things
and run us into target dependencies. */
+
+ /* Verify that print_rtl_function is sane. */
+ named_temp_file tmp_out (".rtl");
+ FILE *outfile = fopen (tmp_out.get_filename (), "w");
+ print_rtx_function (outfile, fun);
+ fclose (outfile);
+
+ char *dump = read_file (SELFTEST_LOCATION, tmp_out.get_filename ());
+ ASSERT_STR_CONTAINS (dump, "(function \"test_fn\"\n");
+ ASSERT_STR_CONTAINS (dump, " (insn-chain\n");
+ ASSERT_STR_CONTAINS (dump, " (block 2\n");
+ ASSERT_STR_CONTAINS (dump, " (edge-from entry (flags \"FALLTHRU\"))\n");
+ ASSERT_STR_CONTAINS (dump, " (insn "); /* ...etc. */
+ ASSERT_STR_CONTAINS (dump, " (edge-to exit (flags \"FALLTHRU\"))\n");
+ ASSERT_STR_CONTAINS (dump, " ) ;; block 2\n");
+ ASSERT_STR_CONTAINS (dump, " ) ;; insn-chain\n");
+ ASSERT_STR_CONTAINS (dump, " (crtl\n");
+ ASSERT_STR_CONTAINS (dump, " ) ;; crtl\n");
+ ASSERT_STR_CONTAINS (dump, ") ;; function \"test_fn\"\n");
+
+ free (dump);
}
/* Run all of the selftests within this file. */