* [PATCH][match-and-simplify] Fix NON_LVALUE_EXPR leaking
@ 2014-08-28 13:37 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2014-08-28 13:37 UTC (permalink / raw)
To: gcc-patches
This tries to prevent NON_LVALUE_EXPR from leaking in to GIMPLE
(happens on trunk also, but mostly savaged by re-gimplifying
GENERIC folding results which strips them). We need a better
solution in the end (fix the C++ frontend), but for now the
following should fix things enough. (fingers crossing)
Committed.
I plan to push the tree-cfg.c hunk to trunk as well (once it
passed bootstrap/testing there) - expand_debug_expr will
ICE on NON_LVALUE_EXPRs (which is where I noticed the above).
Richard.
2014-08-28 Richard Biener <rguenther@suse.de>
* tree-cfg.c (verify_gimple_assign_unary): Do not allow
NON_LVALUE_EXPR in gimple.
* genmatch.c (main): Always define GENERIC and GIMPLE.
* match-constant-folding.pd (x OP 0): Constrain when we
generate NON_LVALUE_EXPR further.
Index: gcc/tree-cfg.c
===================================================================
--- gcc/tree-cfg.c (revision 214677)
+++ gcc/tree-cfg.c (working copy)
@@ -3572,7 +3572,6 @@ verify_gimple_assign_unary (gimple stmt)
case ABS_EXPR:
case BIT_NOT_EXPR:
case PAREN_EXPR:
- case NON_LVALUE_EXPR:
case CONJ_EXPR:
break;
Index: gcc/genmatch.c
===================================================================
--- gcc/genmatch.c (revision 214677)
+++ gcc/genmatch.c (working copy)
@@ -2544,6 +2544,7 @@ main(int argc, char **argv)
if (!cpp_read_main_file (r, input))
return 1;
cpp_define (r, gimple ? "GIMPLE=1": "GENERIC=1");
+ cpp_define (r, gimple ? "GENERIC=0": "GIMPLE=0");
/* Pre-seed operators. */
operators = new hash_table<id_base> (1024);
Index: gcc/match-constant-folding.pd
===================================================================
--- gcc/match-constant-folding.pd (revision 214677)
+++ gcc/match-constant-folding.pd (working copy)
@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3.
(for op in plus pointer_plus minus bit_ior bit_xor
(simplify
(op @0 integer_zerop)
- (if (!in_gimple_form)
+ (if (GENERIC && !in_gimple_form)
/* ??? fold_binary adds non_lvalue here and "fixes" the C++
run of Wsizeof-pointer-memaccess1.c, preserving enough of
sizeof (&a) + 0 because sizeof (&a) is maybe_lvalue_p ()
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-08-28 13:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-28 13:37 [PATCH][match-and-simplify] Fix NON_LVALUE_EXPR leaking Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).