diff mbox series

genattrtab: Parenthesize expressions correctly (PR92107)

Message ID aa9eaeee978ac7e29724db078130066685f03c1f.1571175050.git.segher@kernel.crashing.org
State New
Headers show
Series genattrtab: Parenthesize expressions correctly (PR92107) | expand

Commit Message

Segher Boessenkool Oct. 15, 2019, 9:42 p.m. UTC
As PR92107 shows, genattrtab doesn't parenthesize expressions correctly
(or at all, even).  This fixes it.

I'll commit it as trivial and obvious if my bootstrap with it shows no
problems (or someone tells me not to, of course).


Segher


2019-10-15  Segher Boessenkool  <segher@kernel.crashing.org>

	PR rtl-optimization/92107
	* genattrtab.c (write_attr_value) <do_operator>: Parenthesize the
	expression written.

---
 gcc/genattrtab.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index cdf0b5c..2fd8593 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -4425,11 +4425,11 @@  write_attr_value (FILE *outf, class attr_desc *attr, rtx value)
       goto do_operator;
 
     do_operator:
+      fprintf (outf, "(");
       write_attr_value (outf, attr, XEXP (value, 0));
-      fputc (' ', outf);
-      fputc (op,  outf);
-      fputc (' ', outf);
+      fprintf (outf, " %c ", op);
       write_attr_value (outf, attr, XEXP (value, 1));
+      fprintf (outf, ")");
       break;
 
     case IF_THEN_ELSE: