public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ian at g0tcd dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/59933] for loop goes wild with assert() enabled
Date: Wed, 19 Feb 2014 16:12:00 -0000	[thread overview]
Message-ID: <bug-59933-4-ODmOGOnO8L@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59933-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933

--- Comment #9 from Ian Hamilton <ian at g0tcd dot com> ---
Yes, that's all proper and correct. The invalid C code induces undefined
behaviour. I don't think anyone is disputing that.

However, to be pragmatic for a moment, the experience of thousands of
developers out there, working with legacy code, and trying to update their
toolset to include gcc 4.8 is that code which compiled without warnings and
worked with the old gcc compiler now still compiles without warnings, but fails
at runtime with the 4.8 series compiler.

Sometimes, the runtime failures are occasional and difficult to track down if
(for example) it lies on an error handling path. This makes it even harder for
these developers to figure out what's going on.

If the compiler could provide a warning when it encounters this sort of invalid
code, that would be a good thing, as it would highlight the old latent bugs and
give developers the opportunity to fix them.

However, it doesn't, so the developers working on legacy code really have no
alternative to either using the -fno-aggressive-loop-optimizations switch to
stabilse their legacy code (even assuming they understand what's happening), or
sticking with the old version of the compiler.

So I think the request to the gcc developers is to find a way of providing a
compiler warning when the loop optimiser encounters problem code, to give
developers a fighting chance of debugging their legacy code.


  parent reply	other threads:[~2014-02-19 16:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-24 12:56 [Bug c/59933] New: " warnerme at ptd dot net
2014-01-24 13:00 ` [Bug c/59933] " warnerme at ptd dot net
2014-01-29 12:25 ` ian at g0tcd dot com
2014-01-29 13:14 ` ian at g0tcd dot com
2014-02-19  8:36 ` mpolacek at gcc dot gnu.org
2014-02-19 12:27 ` warnerme at ptd dot net
2014-02-19 14:08 ` warnerme at ptd dot net
2014-02-19 14:54 ` mpolacek at gcc dot gnu.org
2014-02-19 15:49 ` jakub at gcc dot gnu.org
2014-02-19 16:12 ` ian at g0tcd dot com [this message]
2014-02-19 16:41 ` jakub at gcc dot gnu.org
2014-02-19 20:57 ` jakub at gcc dot gnu.org
2014-02-20  1:00 ` ian at g0tcd dot com

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=bug-59933-4-ODmOGOnO8L@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).