diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-04-04 21:14:47 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-04-04 21:14:47 +0200 |
commit | e1201dff2f7404ab263a8e75e97e4c0ad72c7e72 (patch) | |
tree | 5b0e3a74776f991a8582b6f87c568a15f819c192 /gcc/genmatch.c | |
parent | d16e2ddd2666efed093ce826228c786715823cb4 (diff) | |
download | gcc-e1201dff2f7404ab263a8e75e97e4c0ad72c7e72.zip gcc-e1201dff2f7404ab263a8e75e97e4c0ad72c7e72.tar.gz gcc-e1201dff2f7404ab263a8e75e97e4c0ad72c7e72.tar.bz2 |
re PR c++/80297 (Compiler time crash: type mismatch in binary expression)
PR c++/80297
* genmatch.c (capture::gen_transform): For GENERIC unshare_expr
captures used multiple times, except for the last use.
* generic-match-head.c: Include gimplify.h.
* g++.dg/torture/pr80297.C: New test.
Co-Authored-By: Richard Biener <rguenther@suse.de>
From-SVN: r246693
Diffstat (limited to 'gcc/genmatch.c')
-rw-r--r-- | gcc/genmatch.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/genmatch.c b/gcc/genmatch.c index 93d5b21..5621aa0 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -2525,7 +2525,18 @@ capture::gen_transform (FILE *f, int indent, const char *dest, bool gimple, } } - fprintf_indent (f, indent, "%s = captures[%u];\n", dest, where); + /* If in GENERIC some capture is used multiple times, unshare it except + when emitting the last use. */ + if (!gimple + && cinfo->info.exists () + && cinfo->info[cinfo->info[where].same_as].result_use_count > 1) + { + fprintf_indent (f, indent, "%s = unshare_expr (captures[%u]);\n", + dest, where); + cinfo->info[cinfo->info[where].same_as].result_use_count--; + } + else + fprintf_indent (f, indent, "%s = captures[%u];\n", dest, where); /* ??? Stupid tcc_comparison GENERIC trees in COND_EXPRs. Deal with substituting a capture of that. */ |