https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66539
--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Author: dmalcolm Date: Mon Jun 29 15:27:39 2015 New Revision: 225125 URL: https://gcc.gnu.org/viewcvs?rev=225125&root=gcc&view=rev Log: PR jit/66539: Add parentheses as needed to gcc_jit_object_get_debug_string Backport of r224531 (8154a3514d5fc8067a6928531d5f61cd768bd62c) and r224535 (1828cd755cf5e4a34d5638f543a059f3562ad957) from trunk gcc/jit/ChangeLog: Backport from mainline r224531 2015-06-16 David Malcolm <dmalc...@redhat.com> PR jit/66539 * jit-recording.c: Within namespace gcc::jit::recording:: (rvalue::get_debug_string_parens): New function. (binary_op::make_debug_string): Update to mimic C precedence rules. (binary_op_precedence): New array. (binary_op::get_precedence): New function. (comparison::make_debug_string): Update to mimic C precedence rules. (comparison_precedence): New array. (comparison::get_precedence): New function. (cast::make_debug_string): Update to mimic C precedence rules. (call::make_debug_string): Likewise. (call_through_ptr::make_debug_string): Likewise. (array_access::make_debug_string): Likewise. (access_field_of_lvalue::make_debug_string): Likewise. (access_field_rvalue::make_debug_string): Likewise. (dereference_field_rvalue::make_debug_string): Likewise. (dereference_rvalue::make_debug_string): Likewise. (get_address_of_lvalue::make_debug_string): Likewise. * jit-recording.h: Within namespace gcc::jit::recording:: (precedence): New enum. (rvalue::rvalue): Initialize field "m_parenthesized_string". (rvalue::get_debug_string_parens): New method. (rvalue::get_precedence): New pure virtual function. (rvalue::m_parenthesized_string): New field. (param::get_precedence): New function. (global::get_precedence): New function. (memento_of_new_rvalue_from_const::get_precedence): New function. (memento_of_new_string_literal::get_precedence): New function. (unary_op::get_precedence): New function. (binary_op::get_precedence): New function. (comparison::get_precedence): New function. (cast::get_precedence): New function. (call::get_precedence): New function. (call_through_ptr::get_precedence): New function. (array_access::get_precedence): New function. (access_field_of_lvalue::get_precedence): New function. (access_field_rvalue::get_precedence): New function. (dereference_field_rvalue::get_precedence): New function. (dereference_rvalue::get_precedence): New function. (get_address_of_lvalue::get_precedence): New function. (local::get_precedence): New function. gcc/testsuite/ChangeLog: Backport from mainline r224531 2015-06-16 David Malcolm <dmalc...@redhat.com> PR jit/66539 * jit.dg/all-non-failing-tests.h: Add test-debug-strings.c. * jit.dg/test-debug-strings.c: New test case. * jit.dg/test-quadratic.c (make_calc_discriminant): Verify that the discriminant has a sane debug string. Added: branches/gcc-5-branch/gcc/testsuite/jit.dg/test-debug-strings.c Modified: branches/gcc-5-branch/gcc/jit/ChangeLog branches/gcc-5-branch/gcc/jit/jit-recording.c branches/gcc-5-branch/gcc/jit/jit-recording.h branches/gcc-5-branch/gcc/testsuite/ChangeLog branches/gcc-5-branch/gcc/testsuite/jit.dg/all-non-failing-tests.h branches/gcc-5-branch/gcc/testsuite/jit.dg/test-quadratic.c