This is the mail archive of the gcc@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]

Suggestion: Different exit code for ICE


Regressions that cause ICE's on invalid code often go unnoticed in the
testsuite, since regular errors and ICE's both match { dg-error "" }.
See for example g++.dg/parse/error16.C which ICE's since yesterday,
but the testsuite still reports "PASS":

  Executing on host: /Work/reichelt/gccbuild/src-4.0/build/gcc/testsuite/../g++ -B/Work/reichelt/gccbuild/src-4.0/build/gcc/testsuite/../ /Work/reichelt/gccbuild/src-4.0/gcc/gcc/testsuite/g++.dg/parse/error16.C  -nostdinc++ -I/home/reichelt/Work/gccbuild/src-4.0/build/i686-pc-linux-gnu/libstdc++-v3/include/i686-pc-linux-gnu -I/home/reichelt/Work/gccbuild/src-4.0/build/i686-pc-linux-gnu/libstdc++-v3/include -I/home/reichelt/Work/gccbuild/src-4.0/gcc/libstdc++-v3/libsupc++ -I/home/reichelt/Work/gccbuild/src-4.0/gcc/libstdc++-v3/include/backward -I/home/reichelt/Work/gccbuild/src-4.0/gcc/libstdc++-v3/testsuite -fmessage-length=0   -ansi -pedantic-errors -Wno-long-long  -S  -o error16.s    (timeout = 300)
  /Work/reichelt/gccbuild/src-4.0/gcc/gcc/testsuite/g++.dg/parse/error16.C:8: error: redefinition of 'struct A::B'
  /Work/reichelt/gccbuild/src-4.0/gcc/gcc/testsuite/g++.dg/parse/error16.C:5: error: previous definition of 'struct A::B'
  /Work/reichelt/gccbuild/src-4.0/gcc/gcc/testsuite/g++.dg/parse/error16.C:8: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in cp_parser_class_specifier, at cp/parser.c:12407
  Please submit a full bug report,
  with preprocessed source if appropriate.
  See <URL:http://gcc.gnu.org/bugs.html> for instructions.
  compiler exited with status 1
  output is:
  /Work/reichelt/gccbuild/src-4.0/gcc/gcc/testsuite/g++.dg/parse/error16.C:8: error: redefinition of 'struct A::B'
  /Work/reichelt/gccbuild/src-4.0/gcc/gcc/testsuite/g++.dg/parse/error16.C:5: error: previous definition of 'struct A::B'
  /Work/reichelt/gccbuild/src-4.0/gcc/gcc/testsuite/g++.dg/parse/error16.C:8: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in cp_parser_class_specifier, at cp/parser.c:12407
  Please submit a full bug report,
  with preprocessed source if appropriate.
  See <URL:http://gcc.gnu.org/bugs.html> for instructions.

  PASS: g++.dg/parse/error16.C  (test for errors, line 5)
  PASS: g++.dg/parse/error16.C  (test for errors, line 8)
  PASS: g++.dg/parse/error16.C (test for excess errors)

(Btw, Mark, I think the regression was caused by your patch for
PR c++/20152, could you please have a look?)

The method used right now is to not use "" in the last error message,
but that's forgotten too often.

This calls for a more robust method IMHO.
One way would be to make the testsuite smarter and make it recognize
typical ICE patterns itself. This can indeed be done (I for example
use it to monitor the testcases in Bugzilla, Phil borrowed the patterns
for his regression tester).

An easier way IMHO would be to return a different error code when
encountering an ICE. That's only a couple of places in diagnostic.c
and errors.c where we now have "exit (FATAL_EXIT_CODE);".
We could return an (appropriately defined) ICE_ERROR_CODE instead.
The testsuite would then just have to check the return value.

What do you think?

Regards,
Volker



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