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;
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to