aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-10-06 11:02:38 +0200
committerRichard Biener <rguenther@suse.de>2021-10-07 08:19:39 +0200
commit6496ae5c9651206c9de43f63018a549a2ef2244e (patch)
tree40def05c8bbc1491a6f61ce807a2c20d3a417dc6 /gcc/testsuite
parent57c7ec62ee0fbc33cacc5feb3e26d3ad4f765cdb (diff)
downloadgcc-6496ae5c9651206c9de43f63018a549a2ef2244e.zip
gcc-6496ae5c9651206c9de43f63018a549a2ef2244e.tar.gz
gcc-6496ae5c9651206c9de43f63018a549a2ef2244e.tar.bz2
Properly parse invariant &MEM addresses in the GIMPLE FE
Currently the frontend rejects those addresses as not lvalues because the C frontend doens't expect MEM_REF or TARGET_MEM_REF to appear (but they would be valid lvalues there). The following fixes that by amending lvalue_p. The change also makes the dumping of the source of the testcase valid for the GIMPLE FE by not eliding the '&' when dumping string literals. 2021-10-06 Richard Biener <rguenther@suse.de> gcc/c/ * c-typeck.c (lvalue_p): Also allow MEM_REF and TARGET_MEM_REF. gcc/ * tree-pretty-print.c (dump_generic_node): Do not elide printing '&' when dumping with -gimple. gcc/testsuite/ * gcc.dg/gimplefe-47.c: New testcase.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.dg/gimplefe-47.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gimplefe-47.c b/gcc/testsuite/gcc.dg/gimplefe-47.c
new file mode 100644
index 0000000..3bbd34d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gimplefe-47.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-fgimple" } */
+
+char * begfield (int tab, char * ptr, char * lim, int sword, int schar);
+
+int __GIMPLE (ssa)
+main ()
+{
+ char * lim;
+ char * s;
+ char * _1;
+
+ __BB(2):
+ _1 = begfield (58, ":ab", &__MEM <char[4]> ((void *)&":ab" + _Literal
+(void *) 3), 1, 1);
+ if (_1 != _Literal (char *) &__MEM <char[4]> ((void *)&":ab" + _Literal (void *) 2))
+ goto __BB3;
+ else
+ goto __BB4;
+
+ __BB(3):
+ __builtin_abort ();
+
+ __BB(4):
+ __builtin_exit (0);
+}
+