diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 17bd6ab56f5..d5f3e6eabb3 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2010-07-27 Jakub Jelinek + + PR c/45079 + * c-pretty-print.c (pp_c_expression): Handle C_MAYBE_CONST_EXPR. + 2010-07-27 Joseph Myers * c-common.h (c_common_missing_argument): Remove. diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index 7f4b2388f43..d72ff309753 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/gcc/c-family/c-pretty-print.c @@ -2167,6 +2167,10 @@ pp_c_expression (c_pretty_printer *pp, tree e) pp_string (pp, "({...})"); break; + case C_MAYBE_CONST_EXPR: + pp_c_expression (pp, C_MAYBE_CONST_EXPR_EXPR (e)); + break; + default: pp_unsupported_tree (pp, e); break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ee1d1f63740..6a331227cd2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-07-27 Jakub Jelinek + + PR c/45079 + * gcc.dg/pr45079.c: New test. + 2010-07-27 Ira Rosen PR tree-optimization/44152 diff --git a/gcc/testsuite/gcc.dg/pr45079.c b/gcc/testsuite/gcc.dg/pr45079.c new file mode 100644 index 00000000000..1ef02ff78fb --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr45079.c @@ -0,0 +1,10 @@ +/* PR c/45079 */ +/* { dg-do compile } */ + +void +foo (const char *p, int cond, int a, int b) +{ + p[cond ? a : b] = '\0'; /* { dg-error "assignment of read-only location" } */ +} + +/* { dg-bogus "not supported by" "" { target *-*-* } 0 } */