]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2012-02-05 Jeffrey Yasskin <jyasskin@gcc.gnu.org>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 5 Feb 2012 12:58:51 +0000 (12:58 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 5 Feb 2012 12:58:51 +0000 (12:58 +0000)
    Paolo Carlini  <paolo.carlini@oracle.com>

PR libstdc++/52119
* include/std/limits (__glibcxx_min): Fix to avoid undefined behavior.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183905 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/limits

index 187ee49cdfd10374daf708f0add1d705e55a9129..96125f95dc3df4e9f8516361e3f81767aa748d3d 100644 (file)
@@ -1,3 +1,9 @@
+2012-02-05  Jeffrey Yasskin  <jyasskin@gcc.gnu.org>
+           Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR libstdc++/52119
+       * include/std/limits (__glibcxx_min): Fix to avoid undefined behavior.
+
 2012-02-03  Benjamin Kosnik  <bkoz@redhat.com>
 
        PR libstdc++/49445
        PR libstdc++/51795
        * include/bits/random.h (linear_congruential_generator): Add
        static_assert preventing instantiation for values of 'a' and 'm'
-       currently handled incorrectly but _Mod::__calc.
+       currently handled incorrectly by _Mod::__calc.
        * include/bits/random.tcc (seed_seq::generate): Avoid unsafe
        uses of _Mod::__calc.
 
index 67a5af4d804a81a601e8f338252a05e9f1f91199..ea37d9d20cd592dc8cfdf9472cce30b2abf4a240 100644 (file)
@@ -1,7 +1,7 @@
 // The template and inlines for the numeric_limits classes. -*- C++ -*-
 
 // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-// 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
 #define __glibcxx_signed(T)    ((T)(-1) < 0)
 
 #define __glibcxx_min(T) \
-  (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0)
+  (__glibcxx_signed (T) ? -__glibcxx_max (T) - 1 : (T)0)
 
 #define __glibcxx_max(T) \
   (__glibcxx_signed (T) ? \