This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR c/12446


On Fri, 3 Oct 2003, Eric Botcazou wrote:

> The problem is that we don't give any error later for the testcase. Moreover, 
> for the slightly tweaked testcase:

Indeed, we give an error for the assignment case (the only one covered in
the testsuite) only.

> GCC emitted the same error message as above before the patch and now gives 
> "incompatible types in assignment".

Both messages are reasonable (the types *are* incompatible - you can't
assign an array (that hasn't decayed to a pointer) to a pointer).

> 	* gcc.dg/c90-array-lval-1.c: Adjust expected error texts.
> 	* gcc.dg/c90-array-lval-3.c: Likewise.

The expected error texts allow both alternatives for a reason: to avoid
spurious failures when the current testsuite is used with an old compiler
(which used to be a standard part of regression testing releases - the new
compiler should have no failures that aren't shown with the old one, but
there's no need for gratuitous testcase changes that make the old one look
worse than it was), and because the point is to ensure that *some*
reasonable error is given for the cases where the standard requires it
rather than to guarantee a precise wording for every error.  The tests
should pass after this patch without needing to be changed: this laxity
serves to save work when minor changes are made that may have a small
effect on the error messages.

>         * gcc.dg/c90-array-lval-6.c: New test.

All these tests should use -pedantic-errors.  All the c90-array-lval-*.c
tests have corresponding C99 tests - in this case, to verify that
initialization works (only assignment being covered in the testsuite, as
this bug uncovered).  And dg-error doesn't guarantee that the diagnostic
is an error rather than a warning, hence the more complex idiom used in
these testcases to ensure that (one day dejagnu may get fixed and we can
simplify the tests, but probably also need to fix many with the wrong one
of dg-error and dg-warning).

-- 
Joseph S. Myers
jsm@polyomino.org.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]