]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
genattrtab: Parenthesize expressions correctly (PR92107)
authorsegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 15 Oct 2019 23:47:47 +0000 (23:47 +0000)
committersegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 15 Oct 2019 23:47:47 +0000 (23:47 +0000)
As PR92107 shows, genattrtab doesn't parenthesize expressions correctly
(or at all, even).  This fixes it.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277023 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/genattrtab.c

index 2320abc0dd24084211810e98bad46acaf02da7f3..175ecd9224f43d517ad8154ee57816bdc4d50a43 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-15  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR rtl-optimization/92107
+       * genattrtab.c (write_attr_value) <do_operator>: Parenthesize the
+       expression written.
+
 2019-10-15  Iain Sandoe  <iain@sandoe.co.uk>
 
        * config/darwin.c: Update description of fix and continue.
index cdf0b5c12dc361aa8efc6a408f4b0a6032c68bc2..2fd8593d90a99c1f2fd9b5935a4270167a98b72a 100644 (file)
@@ -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: