public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/59999] [4.9 Regression] Sign extension in loop regression blocks generation of zero overhead loop
Date: Thu, 06 Feb 2014 12:05:00 -0000	[thread overview]
Message-ID: <bug-59999-4-VAm6jzA5NF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59999-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #15 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 6 Feb 2014, paulo@matos-sorge.com wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59999
> 
> --- Comment #14 from Paulo J. Matos <paulo@matos-sorge.com> ---
> Something like this which looks much simpler hits the same problem:
> extern int arr[];
> 
> void
> foo32 (int limit)
> {
>   short i;
>   for (i = 0; (int)i < limit; i++)
>     arr[i] += 1;
> }

Exactly the same problem.  C integral type promotion rules make
that i = (short)((int)i + 1) again.  Note that (int)i + 1
does not overflow, (short) ((int)i + 1) invokes implementation-defined
behavior which in our case is modulo-2 reduction.

Nothing guarantees that (short)i + 1 does not overflow.


  parent reply	other threads:[~2014-02-06 12:05 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-30 21:41 [Bug tree-optimization/59999] New: " paulo@matos-sorge.com
2014-01-31 10:08 ` [Bug tree-optimization/59999] [4.9 Regression] " rguenth at gcc dot gnu.org
2014-01-31 10:14 ` paulo@matos-sorge.com
2014-01-31 11:41 ` [Bug rtl-optimization/59999] " rguenth at gcc dot gnu.org
2014-01-31 12:04 ` paulo@matos-sorge.com
2014-01-31 14:52 ` rguenth at gcc dot gnu.org
2014-01-31 15:09 ` paulo@matos-sorge.com
2014-02-05 11:03 ` paulo@matos-sorge.com
2014-02-05 12:14 ` paulo@matos-sorge.com
2014-02-05 12:15 ` paulo@matos-sorge.com
2014-02-05 15:37 ` paulo@matos-sorge.com
2014-02-05 17:09 ` paulo@matos-sorge.com
2014-02-06 10:28 ` rguenth at gcc dot gnu.org
2014-02-06 11:16 ` paulo@matos-sorge.com
2014-02-06 11:25 ` paulo@matos-sorge.com
2014-02-06 12:05 ` rguenther at suse dot de [this message]
2014-02-06 12:40 ` paulo@matos-sorge.com
2014-02-06 13:04 ` paulo@matos-sorge.com
2014-02-06 13:17 ` rguenther at suse dot de
2014-02-06 13:20 ` rguenther at suse dot de
2014-02-07 10:08 ` paulo@matos-sorge.com
2014-02-07 11:01 ` rguenther at suse dot de
2014-02-12 13:03 ` paulo@matos-sorge.com
2014-02-12 13:30 ` rguenther at suse dot de
2014-02-12 13:39 ` pmatos at gcc dot gnu.org

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-59999-4-VAm6jzA5NF@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).