This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
While looking at some floating point code recently, I was surprised to see that the dump files do not report how operators of the same precedence associate. This of course matters for floating point. The compiler represents it correctly, it is just not printed in the dump files.
For example, for this test case:
double foo (double a, double b, double c) { return (a - (b - c)); }
The final_cleanup dump file includes this:
foo (a, b, c) { <bb 2>: return a - b - c;
}
With this trivial patch, the dump file looks like this:
foo (a, b, c) { <bb 2>: return a - (b - c);
}
This correctly represents the order of operations.
I think this is a good enhancement. Does it avoid printing the parens if the evaluation order is left-to-right?
Thanks, Richard.
I've tested this patch with a bootstrap and testsuite run on i686-pc-linux-gnu. I plan to commit it in a day or two unless somebody objects.
Ian
2007-01-09 Ian Lance Taylor <iant@google.com>
* tree-pretty-print.c (dump_generic_node): Print parentheses when operands have the same priority.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |