public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/61129] New: Feature request: integer-overflow-detecting arithmetic intrinsics
@ 2014-05-09 18:15 luto at mit dot edu
  2014-05-13 12:03 ` [Bug c/61129] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: luto at mit dot edu @ 2014-05-09 18:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61129
           Summary: Feature request: integer-overflow-detecting arithmetic
                    intrinsics
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luto at mit dot edu

Clang has a fairly complete family of intrinsics to do integer arithmetic with
overflow detection.  They include function like __builtin_uadd_overflow, and
they are described here:

http://clang.llvm.org/docs/LanguageExtensions.html#checked-arithmetic-builtins

Please consider supporting these in GCC as well.


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

* [Bug c/61129] Feature request: integer-overflow-detecting arithmetic intrinsics
  2014-05-09 18:15 [Bug c/61129] New: Feature request: integer-overflow-detecting arithmetic intrinsics luto at mit dot edu
@ 2014-05-13 12:03 ` rguenth at gcc dot gnu.org
  2014-05-18 21:51 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-13 12:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
There was a recent proof-of-concept patch on the mailinglist to implement that.


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

* [Bug c/61129] Feature request: integer-overflow-detecting arithmetic intrinsics
  2014-05-09 18:15 [Bug c/61129] New: Feature request: integer-overflow-detecting arithmetic intrinsics luto at mit dot edu
  2014-05-13 12:03 ` [Bug c/61129] " rguenth at gcc dot gnu.org
@ 2014-05-18 21:51 ` pinskia at gcc dot gnu.org
  2014-05-18 21:57 ` manu at gcc dot gnu.org
  2014-12-03  0:32 ` luto at mit dot edu
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-05-18 21:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Paul Eggert from comment #2)
> It'd be nice if this were higher priority. I've been wanting this for years.
> We jump through a lot of confusing hoops in GNU applications to test for
> integer overflow, both signed and unsigned. See, for example,
> INT_MULTIPLY_OVERFLOW in:
> 
> http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/intprops.h;
> h=d0bb7a6f57734e15e535cfc6b287a555dc6ccbb3;hb=HEAD
> 
> Also, the need for a fast test for unsigned multiplication overflow recently
> came up in glibc internals discussions when writing a memory allocator. See:
> 
> https://sourceware.org/ml/libc-alpha/2014-05/msg00480.html

You would still need them to compile with older GCCs anyways.  Glibc still
needs to compiler with a few year old GCC.


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

* [Bug c/61129] Feature request: integer-overflow-detecting arithmetic intrinsics
  2014-05-09 18:15 [Bug c/61129] New: Feature request: integer-overflow-detecting arithmetic intrinsics luto at mit dot edu
  2014-05-13 12:03 ` [Bug c/61129] " rguenth at gcc dot gnu.org
  2014-05-18 21:51 ` pinskia at gcc dot gnu.org
@ 2014-05-18 21:57 ` manu at gcc dot gnu.org
  2014-12-03  0:32 ` luto at mit dot edu
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu.org @ 2014-05-18 21:57 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-05-18
                 CC|                            |manu at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
I think this was the last message:

https://gcc.gnu.org/ml/gcc/2014-04/msg00194.html
>From gcc-bugs-return-451860-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun May 18 22:43:54 2014
Return-Path: <gcc-bugs-return-451860-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 25177 invoked by alias); 18 May 2014 22:43:51 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 25137 invoked by uid 48); 18 May 2014 22:43:46 -0000
From: "su at cs dot ucdavis.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/61220] New: ICE on valid code at -O2 on x86_64-linux-gnu in maybe_record_trace_start, at dwarf2cfi.c:2239
Date: Sun, 18 May 2014 22:43:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: rtl-optimization
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: su at cs dot ucdavis.edu
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-61220-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg01552.txt.bz2
Content-length: 2274

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

            Bug ID: 61220
           Summary: ICE on valid code at -O2 on x86_64-linux-gnu in
                    maybe_record_trace_start, at dwarf2cfi.c:2239
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The following code causes an ICE when compiled with the current gcc trunk at
-O2 on x86_64-linux-gnu in 64-bit mode (but not in 32-bit mode). 

It is a regression from 4.9.x.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 4.10.0 20140518 (experimental) [trunk revision 210581] (GCC) 
$ 
$ gcc-trunk -Os small.c; a.out
$ gcc-4.9.0 -O2 small.c; a.out
$ 
$ gcc-trunk -O2 small.c
small.c: In function ‘main’:
small.c:36:1: internal compiler error: in maybe_record_trace_start, at
dwarf2cfi.c:2239
 }
 ^
0x68d049 maybe_record_trace_start
    ../../gcc-trunk/gcc/dwarf2cfi.c:2239
0x68d7b6 scan_trace
    ../../gcc-trunk/gcc/dwarf2cfi.c:2416
0x68df5a create_cfi_notes
    ../../gcc-trunk/gcc/dwarf2cfi.c:2570
0x68df5a execute_dwarf2_frame
    ../../gcc-trunk/gcc/dwarf2cfi.c:2925
0x68df5a execute
    ../../gcc-trunk/gcc/dwarf2cfi.c:3405
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$  

-----------------------------------

int a, c, d, e, f, g, h, i, j, k;

struct S0
{
  int f0;
  int f1;
  int f2;
};

struct S1
{
  int f0;
  int f1;
  struct S0 f2;
} b; 

void
fn1 (struct S1 p)
{
  for (; k; k++)
    h = j ? a : a - 1;
  d &= i;
}

int
main ()
{
  int l[5] = { 0 };
  fn1 (b);
  for (c = 0; c < 3; c++)
    for (g = 0; g < 3; g++)
      l[c * 2] = e = l[c];
  if (f)
    fn1 (b);
  return 0;
}
>From gcc-bugs-return-451861-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun May 18 22:58:49 2014
Return-Path: <gcc-bugs-return-451861-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 6116 invoked by alias); 18 May 2014 22:58:49 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 5706 invoked by uid 48); 18 May 2014 22:58:44 -0000
From: "su at cs dot ucdavis.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/61221] New: ICE on valid code at -O1 and above on x86_64-linux-gnu
Date: Sun, 18 May 2014 22:58:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: su at cs dot ucdavis.edu
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-61221-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg01553.txt.bz2
Content-length: 2631

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

            Bug ID: 61221
           Summary: ICE on valid code at -O1 and above on x86_64-linux-gnu
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The following code causes an ICE when compiled with the current gcc trunk at
-O1 and above on x86_64-linux-gnu in both 32-bit and 64-bit modes.

It is a regression from 4.9.x.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 4.10.0 20140518 (experimental) [trunk revision 210581] (GCC) 
$ 
$ gcc-trunk -O0 -c small.c
$ gcc-4.9.0 -O1 -c small.c
$ 
$ gcc-trunk -O1 -c small.c
small.c: In function ‘bar’:
small.c:30:1: internal compiler error: Segmentation fault
 }
 ^
0x988c1f crash_signal
    ../../gcc-trunk/gcc/toplev.c:337
0xa5b6de gimple_code
    ../../gcc-trunk/gcc/gimple.h:1405
0xa5b6de gimple_nop_p
    ../../gcc-trunk/gcc/gimple.h:5559
0xa5b6de walk_non_aliased_vuses(ao_ref*, tree_node*, void* (*)(ao_ref*,
tree_node*, unsigned int, void*), void* (*)(ao_ref*, tree_node*, void*, bool),
void*)
    ../../gcc-trunk/gcc/tree-ssa-alias.c:2550
0xb02599 vn_reference_lookup(tree_node*, tree_node*, vn_lookup_kind,
vn_reference_s**)
    ../../gcc-trunk/gcc/tree-ssa-sccvn.c:2117
0xae040a eliminate_dom_walker::before_dom_children(basic_block_def*)
    ../../gcc-trunk/gcc/tree-ssa-pre.c:4285
0xe93527 dom_walker::walk(basic_block_def*)
    ../../gcc-trunk/gcc/domwalk.c:177
0xaddcad eliminate
    ../../gcc-trunk/gcc/tree-ssa-pre.c:4429
0xade193 execute
    ../../gcc-trunk/gcc/tree-ssa-pre.c:4852
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 

---------------------------

void __assert_fail (void);

int **a, b, c, e, *j;
short *d, **f;

int *
foo ()
{
  *a = j;
  if (!(1 & e)) 
    __assert_fail ();
  return 0;
}

void
bar ()
{
  int *g = &b;
  short **h = &d;
  if ((f = &d) != h)
    for (; b;)
      {
    int i = 1;
    if (i)
      g = foo ();
    c = 0;
      }
  if (!g)
    __assert_fail ();
}
>From gcc-bugs-return-451862-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun May 18 23:48:04 2014
Return-Path: <gcc-bugs-return-451862-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30034 invoked by alias); 18 May 2014 23:48:01 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 29962 invoked by uid 48); 18 May 2014 23:47:56 -0000
From: "danglin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/61141] [4.10 Regression] c-common.c:1502:1: ICE: in reset_insn_used_flags, at emit-rtl.c:2677
Date: Sun, 18 May 2014 23:48:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: danglin at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.10.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61141-4-D1KqHRYXxC@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61141-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61141-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg01554.txt.bz2
Content-length: 187

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida141

--- Comment #5 from John David Anglin <danglin at gcc dot gnu.org> ---
Patch:
http://gcc.gnu.org/ml/gcc-patches/2014-05/msg01405.html


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

* [Bug c/61129] Feature request: integer-overflow-detecting arithmetic intrinsics
  2014-05-09 18:15 [Bug c/61129] New: Feature request: integer-overflow-detecting arithmetic intrinsics luto at mit dot edu
                   ` (2 preceding siblings ...)
  2014-05-18 21:57 ` manu at gcc dot gnu.org
@ 2014-12-03  0:32 ` luto at mit dot edu
  3 siblings, 0 replies; 5+ messages in thread
From: luto at mit dot edu @ 2014-12-03  0:32 UTC (permalink / raw)
  To: gcc-bugs

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

Andy Lutomirski <luto at mit dot edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Andy Lutomirski <luto at mit dot edu> ---
According to https://gcc.gnu.org/gcc-5/changes.html, this is now implemented. 
Thanks!


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

end of thread, other threads:[~2014-12-03  0:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-09 18:15 [Bug c/61129] New: Feature request: integer-overflow-detecting arithmetic intrinsics luto at mit dot edu
2014-05-13 12:03 ` [Bug c/61129] " rguenth at gcc dot gnu.org
2014-05-18 21:51 ` pinskia at gcc dot gnu.org
2014-05-18 21:57 ` manu at gcc dot gnu.org
2014-12-03  0:32 ` luto at mit dot edu

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