public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/61942] New: loop-iv.c:2272 signed integer overflow
@ 2014-07-29  6:59 zeccav at gmail dot com
  2014-09-04 10:17 ` [Bug rtl-optimization/61942] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zeccav at gmail dot com @ 2014-07-29  6:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61942

            Bug ID: 61942
           Summary: loop-iv.c:2272 signed integer overflow
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zeccav at gmail dot com

/* from pr32349.c */
// gcc -funroll-loops -O3
// ../../gcc-4.9.1/gcc/loop-iv.c:2272:24: runtime error: 
// signed integer overflow: 9223372036854775807 - -9223372036854775808 cannot
be represented in type 'long int'
// offending instruction "nmax = INTVAL (mmax) - INTVAL (mmin);"
extern long *x1, *x2, *x3;

int
foo ()
{
  long *p1, *p2;
  long m, n, i;

  p1 = x1;
  p2 = x2;
  n = 0;
  for (i = *x3; 0 < i; i--)
    {
      m = (*p1++) ^ (*p2++);
      m = (m & 0x55555555) + ((m >> 1) & 0x55555555);
      n += m;
    }
  return n;
}


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug rtl-optimization/61942] loop-iv.c:2272 signed integer overflow
  2014-07-29  6:59 [Bug c/61942] New: loop-iv.c:2272 signed integer overflow zeccav at gmail dot com
@ 2014-09-04 10:17 ` mpolacek at gcc dot gnu.org
  2014-09-06  6:53 ` zeccav at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-04 10:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61942

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I can't reproduce this one.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug rtl-optimization/61942] loop-iv.c:2272 signed integer overflow
  2014-07-29  6:59 [Bug c/61942] New: loop-iv.c:2272 signed integer overflow zeccav at gmail dot com
  2014-09-04 10:17 ` [Bug rtl-optimization/61942] " mpolacek at gcc dot gnu.org
@ 2014-09-06  6:53 ` zeccav at gmail dot com
  2014-09-06  8:31 ` mpolacek at gcc dot gnu.org
  2014-09-28  9:09 ` trippels at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: zeccav at gmail dot com @ 2014-09-06  6:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61942

--- Comment #2 from Vittorio Zecca <zeccav at gmail dot com> ---
This is what I get on x86-64 with a sanitized version of gcc:

~/local/gcc-4.9.1-sanitized/bin/gcc -S  gccerr12.c -funroll-loops -O3
../../gcc-4.9.1/gcc/loop-iv.c:2272:24: runtime error: signed integer overflow:
9223372036854775807 - -9223372036854775808 cannot be represented in type 'long
int'

Please note the -funroll-loops -O3 options.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug rtl-optimization/61942] loop-iv.c:2272 signed integer overflow
  2014-07-29  6:59 [Bug c/61942] New: loop-iv.c:2272 signed integer overflow zeccav at gmail dot com
  2014-09-04 10:17 ` [Bug rtl-optimization/61942] " mpolacek at gcc dot gnu.org
  2014-09-06  6:53 ` zeccav at gmail dot com
@ 2014-09-06  8:31 ` mpolacek at gcc dot gnu.org
  2014-09-28  9:09 ` trippels at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-06  8:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61942

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I tried trunk again and still nothing, so maybe only 4.9 is affected.
But both 4.9/trunk contain the "nmax = INTVAL (mmax) - INTVAL (mmin);" line...


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug rtl-optimization/61942] loop-iv.c:2272 signed integer overflow
  2014-07-29  6:59 [Bug c/61942] New: loop-iv.c:2272 signed integer overflow zeccav at gmail dot com
                   ` (2 preceding siblings ...)
  2014-09-06  8:31 ` mpolacek at gcc dot gnu.org
@ 2014-09-28  9:09 ` trippels at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-09-28  9:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61942

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |trippels at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #5 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
dup.

*** This bug has been marked as a duplicate of bug 61657 ***


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-28  9:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-29  6:59 [Bug c/61942] New: loop-iv.c:2272 signed integer overflow zeccav at gmail dot com
2014-09-04 10:17 ` [Bug rtl-optimization/61942] " mpolacek at gcc dot gnu.org
2014-09-06  6:53 ` zeccav at gmail dot com
2014-09-06  8:31 ` mpolacek at gcc dot gnu.org
2014-09-28  9:09 ` trippels at gcc dot gnu.org

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).