4.4 doesn't print the function names in the error message, while 4.5 and 4.6 do so: $ cat foo.c void foo(const char *p, int cond, int a, int b) { p[cond ? a : b] = '\0'; } $ gcc-4.4 -c foo.c foo.c: In function 'foo': foo.c:3: error: assignment of read-only location '*(p + (cond != 0 ? (long unsigned int)(long unsigned int)a : (long unsigned int)(long unsigned int)b))' $ gcc-4.5 -c foo.c #'c_maybe_const_expr' not supported by pp_c_expression#) != 0 ? (long unsigned int)a : (long unsigned int)b) * 1ul))'foo.c: In function 'foo': foo.c:3:2: error: assignment of read-only location is the new format expected?
Created attachment 21317 [details] gcc46-pr45079.patch Untested fix.
Subject: Bug 45079 Author: jakub Date: Tue Jul 27 15:46:25 2010 New Revision: 162575 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162575 Log: PR c/45079 * c-pretty-print.c (pp_c_expression): Handle C_MAYBE_CONST_EXPR. * gcc.dg/pr45079.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr45079.c Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-pretty-print.c trunk/gcc/testsuite/ChangeLog
Fixed on the trunk so far, with 4.5 will wait until 4.5.1 is released.
GCC 4.5.1 is being released, adjusting target milestone.
Jakub, ping.
Subject: Bug 45079 Author: jakub Date: Mon Aug 30 19:31:45 2010 New Revision: 163657 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163657 Log: Backport from mainline 2010-07-27 Jakub Jelinek <jakub@redhat.com> PR c/45079 * c-pretty-print.c (pp_c_expression): Handle C_MAYBE_CONST_EXPR. * gcc.dg/pr45079.c: New test. Added: branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/pr45079.c Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/c-pretty-print.c branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
Fixed, sorry for the delay.