Bug 45079 - [4.5 Regression] function names in error message (�c_maybe_const_expr� not supported by 'pp_c_expression')
Summary: [4.5 Regression] function names in error message (�c_maybe_const_expr� not su...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.5.0
: P2 normal
Target Milestone: 4.5.2
Assignee: Jakub Jelinek
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2010-07-26 14:15 UTC by Matthias Klose
Modified: 2010-08-30 19:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.4.4 4.6.0
Known to fail: 4.5.0
Last reconfirmed:


Attachments
gcc46-pr45079.patch (509 bytes, patch)
2010-07-26 14:47 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2010-07-26 14:15:31 UTC
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?
Comment 1 Jakub Jelinek 2010-07-26 14:47:01 UTC
Created attachment 21317 [details]
gcc46-pr45079.patch

Untested fix.
Comment 2 Jakub Jelinek 2010-07-27 15:46:50 UTC
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

Comment 3 Jakub Jelinek 2010-07-27 15:50:15 UTC
Fixed on the trunk so far, with 4.5 will wait until 4.5.1 is released.
Comment 4 Richard Biener 2010-07-31 09:30:00 UTC
GCC 4.5.1 is being released, adjusting target milestone.
Comment 5 Richard Biener 2010-08-30 15:52:10 UTC
Jakub, ping.
Comment 6 Jakub Jelinek 2010-08-30 19:32:00 UTC
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

Comment 7 Jakub Jelinek 2010-08-30 19:33:53 UTC
Fixed, sorry for the delay.