This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Middle end warnings cascading after C++ parsing errors
Diego Novillo <dnovillo@google.com> writes:
> So, I think we need to re-think where to check for seen_errors().
> Bailing out too early is disabling some valid diagnostics. For
> instance,
>
> gcc/testsuite/gcc.dg/asm-7.c:
> $ cat -n /home/dnovillo/g1/fix-4487457/Patch-752f00bd28e325efdfa0ac7abed22feb_branches-google-main/gcc/testsuite/gcc.dg/asm-7.c
> 1 /* Gcc 3.3.1 deprecates memory inputs of non-lvalues. */
> 2 /* { dg-do compile } */
> 3
> 4 void test(void)
> 5 {
> 6 register int r;
> 7 register int r2;
> 8 int i;
> 9 static int m;
> 10 int *p;
> 11
> 12 __asm__ ("" : : "m"(r)); /* { dg-error "" } */
>
> This error is given by the parser.
>
> 13 __asm__ ("" : : "m"(i));
> 14 __asm__ ("" : : "m"(m));
> 15 __asm__ ("" : : "m"(0)); /* { dg-error "" } */
> 16 __asm__ ("" : : "m"(i+1)); /* { dg-error "" } */
>
> These two errors, however, are emitted by the gimplifier, which does
> not run anymore.
Well, so what? This test case does not represent actual or even likely
user code. I don't think we need to contort ourselves to generate all
possible errors for erroneous input. As many errors as reasonable, yes.
All possible errors, no.
I agree that we should not make this change on the release branch. On
mainline we should simply split this test case into two.
Ian