From 16951c585f65685c01892a67e315612dead57c83 Mon Sep 17 00:00:00 2001 From: paolo Date: Thu, 24 Jan 2013 12:21:24 +0000 Subject: [PATCH] 2013-01-24 Paolo Carlini PR libstdc++/56085 * include/std/complex (pow(const complex<>&, int)): Avoid __n signed overflow. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@195422 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/include/std/complex | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e9464c9f2ab..cf83522da8b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2013-01-24 Paolo Carlini + + PR libstdc++/56085 + * include/std/complex (pow(const complex<>&, int)): Avoid __n + signed overflow. + 2013-01-17 Jonathan Wakely PR libstdc++/52887 diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index c0e333117de..8ef7acb2436 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -1,8 +1,6 @@ // The template and inlines for the -*- C++ -*- complex number classes. -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -// 2006, 2007, 2008, 2009, 2010, 2011 -// Free Software Foundation, Inc. +// Copyright (C) 1997-2013 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 @@ -976,7 +974,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION pow(const complex<_Tp>& __z, int __n) { return __n < 0 - ? complex<_Tp>(1) / std::__complex_pow_unsigned(__z, -__n) + ? complex<_Tp>(1) / std::__complex_pow_unsigned(__z, -(unsigned)__n) : std::__complex_pow_unsigned(__z, __n); } #endif -- 2.11.0