A broken diagnostic is issued for the following invalid code snippet
since GCC 4.0.0:
================================
void foo(char **p, char **q)
{
(p - q)();
}
================================
With GCC 4.0.x we got
bug.c: In function 'foo':
bug.c:3: error: called object '#'exact_div_expr' not supported by
pp_c_expression#' is not a function
which is already bad enough. But since GCC 4.1.0 it's even worse:
#'exact_div_expr' not supported by pp_c_expression#'bug.c: In function 'foo':
bug.c:3: error: called object is not a function
Not only the exact_div_expr case should be fixed, but also the output
order when we hit something unsupported. And, yes, there are more cases
of unsupported expressions. How about the following?
================================
void foo(char *p, char *q)
{
(p < q ? p : q)();
}
================================
#'min_expr' not supported by pp_c_expression#'bug.c: In function 'foo':
bug.c:3: error: called object is not a function
================================
void foo(double x, double y)
{
(x/y)();
}
================================
#'rdiv_expr' not supported by pp_c_expression#'bug.c: In function 'foo':
bug.c:3: error: called object is not a function
================================
void foo(unsigned i, int j)
{
(i << j | i >> (32 - j))();
(i >> j | i << (32 - j))();
}
================================
#'lrotate_expr' not supported by pp_c_expression#'bug.c: In function 'foo':
bug.c:3: error: called object is not a function
#'rrotate_expr' not supported by pp_c_expression#'bug.c:4: error: called object
is not a function
--
Summary: [4.1/4.2/4.3/4.4 regression] Completely broken
diagnostics
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: diagnostic, monitored
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35441