public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Haoxin Tu via Gcc-bugs <gcc-bugs@gcc.gnu.org>
Cc: Haoxin Tu <haoxintu@gmail.com>
Subject: Re: How GCC treats ice-on-invalid-code?
Date: Tue, 30 Jun 2020 14:22:57 +0100	[thread overview]
Message-ID: <mptpn9g7kni.fsf@arm.com> (raw)
In-Reply-To: <CALDyosbeDaiRKTzDbk4wsnbmLd3trWmZeZcSjE_dOn+xjmUn6g@mail.gmail.com> (Haoxin Tu via Gcc-bugs's message of "Tue, 30 Jun 2020 10:32:18 +0800")

Hi,

Haoxin Tu via Gcc-bugs <gcc-bugs@gcc.gnu.org> writes:
> Hi, there,
>
> Our team just develop a c++ code generator tool to testing the compiler,
> and those days I have reported 13 ICE bugs in ice-on-invalid-bugs.
>
> Here are the bugs links:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95972
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95956
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95955
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95954
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95925
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95930
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95931
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95927
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95932
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95935
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95945
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95938
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95937
>
> Until now, only the last two cases are confirmed. So I am wondering that
> how GCC treats with those cases in ice-on-invalid-code? I mean, our team is
> focusing on improving the quality of the mature productive compilers. If
> those bugs are useless for GCC, maybe I should stop reporting similar
> issues.
>
> Waiting for your reply. Thank you very much!

Thanks for the work and for the bug reports.

There are really two categories of ICE on erroneous code: those in
which the compiler reports an ICE *after* reporting a sensible error
in the code and those in which the compiler reports an ICE *without*
first reporting a sensible error.

If the compiler encounters an ICE after reporting an error, production
builds will print:

    confused by earlier errors, bailing out

instead of reporting the ICE itself.  For example, for PR95937,
the production build would print something like:

bug.cc:1:6: error: variable or field ‘a’ declared void
    1 | void a { [].decltype(auto)::b
      |      ^
bug.cc: In lambda function:
bug.cc:1:12: error: expected ‘{’ before ‘.’ token
    1 | void a { [].decltype(auto)::b
      |            ^
bug.cc: At global scope:
bug.cc:1:29: confused by earlier errors, bailing out

Although this isn't ideal, it's not too bad in practice, since the
errors before the “bailing out” message tell the user what they
need to do to fix the problem.  In fact, there's a danger that if the
compiler is confused enough to hit (or almost hit) an ICE and continues
regardless, it could spew a lot of meaningless error messages and drown
out the useful information.  So in some cases, this “bailing out”
message can (accidentally) be a good thing. :-)

In bugzilla, this category of error is classified as “error-recovery”
rather than “ice-on-invalid-code”; see:

  https://gcc.gnu.org/bugs/management.html

for details.  Because the ICE doesn't show up as an ICE in production
builds, and because bailing out can sometimes even make the user
experience better, these bugs tend to have a very low priority.

In contrast, the second category of ICE above is much more serious.
If GCC encounters an ICE without first reporting a normal error message,
it will print that ICE even in production builds.  And this ICE message
will generally give the user no idea what's wrong or what they need
to do to fix the code.

These are the “true” ice-on-invalid-code bugs, i.e. those that are
meant to be classified as “ice-on-invalid-code” instead of “error-recovery”
in bugzilla.  They generally get much more attention than “error-recovery”
bugs.

So if your tool is finding a lot of ICEs in GCC (and I imagine it is),
then it might be worth concentrating on filing bugs for the cases in
which GCC fails to report a normal user-level error before reporting
an ICE.

Thanks,
Richard


  parent reply	other threads:[~2020-06-30 13:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30  2:32 Haoxin Tu
2020-06-30  3:09 ` Haoxin Tu
2020-06-30 14:28   ` Jonathan Wakely
2020-06-30 13:22 ` Richard Sandiford [this message]
2020-06-30 14:38   ` Jonathan Wakely
2020-07-01  8:05     ` Eric Botcazou
2020-07-01 11:24       ` Richard Sandiford
2020-07-02  8:51         ` Eric Botcazou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mptpn9g7kni.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=haoxintu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).