mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-13 22:44:20 +08:00
re PR libstdc++/56085 (Unsafe negation in C++03 pow(complex,int))
2013-01-24 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/56085 * include/std/complex (pow(const complex<>&, int)): Avoid __n signed overflow. From-SVN: r195421
This commit is contained in:
parent
e86c0101ae
commit
91f4a9e332
@ -1,3 +1,9 @@
|
|||||||
|
2013-01-24 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
PR libstdc++/56085
|
||||||
|
* include/std/complex (pow(const complex<>&, int)): Avoid __n
|
||||||
|
signed overflow.
|
||||||
|
|
||||||
2013-01-22 Jakub Jelinek <jakub@redhat.com>
|
2013-01-22 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc:
|
* testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc:
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// The template and inlines for the -*- C++ -*- complex number classes.
|
// The template and inlines for the -*- C++ -*- complex number classes.
|
||||||
|
|
||||||
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
// Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
||||||
// 2006, 2007, 2008, 2009, 2010, 2011
|
|
||||||
// Free Software Foundation, Inc.
|
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// 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
|
// software; you can redistribute it and/or modify it under the
|
||||||
@ -978,7 +976,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
pow(const complex<_Tp>& __z, int __n)
|
pow(const complex<_Tp>& __z, int __n)
|
||||||
{
|
{
|
||||||
return __n < 0
|
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);
|
: std::__complex_pow_unsigned(__z, __n);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user