Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Nov 2013 03:05:33 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r258157 - head/contrib/gcc/cp
Message-ID:  <201311150305.rAF35XR3012125@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Fri Nov 15 03:05:33 2013
New Revision: 258157
URL: http://svnweb.freebsd.org/changeset/base/258157

Log:
  gcc: warn about integer overflow in constant expressions in the C++ frontend.
  
  This fixes GCC 28986:
   http://gcc.gnu.org/ml/gcc-patches/2007-01/msg00473.html
  
  Obtained from:	gcc 4.3 (rev. 120558; GPLv2)
  MFC after:	3 weeks

Modified:
  head/contrib/gcc/cp/typeck.c

Modified: head/contrib/gcc/cp/typeck.c
==============================================================================
--- head/contrib/gcc/cp/typeck.c	Fri Nov 15 01:44:58 2013	(r258156)
+++ head/contrib/gcc/cp/typeck.c	Fri Nov 15 03:05:33 2013	(r258157)
@@ -3773,6 +3773,12 @@ build_binary_op (enum tree_code code, tr
   result = fold_if_not_in_template (result);
   if (final_type != 0)
     result = cp_convert (final_type, result);
+
+  if (TREE_OVERFLOW_P (result) 
+      && !TREE_OVERFLOW_P (op0) 
+      && !TREE_OVERFLOW_P (op1))
+    overflow_warning (result);
+
   return result;
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311150305.rAF35XR3012125>