diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0023-PR-c-47504.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0023-PR-c-47504.patch | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0023-PR-c-47504.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0023-PR-c-47504.patch new file mode 100644 index 0000000000..23aebda2c1 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0023-PR-c-47504.patch @@ -0,0 +1,50 @@ +From 4ebec68ee3aee90ba13a4c4bc70afbb4a613468b Mon Sep 17 00:00:00 2001 +From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> +Date: Tue, 29 Mar 2011 14:24:19 +0000 +Subject: [PATCH 023/200] PR c++/47504 + * semantics.c (cxx_eval_constant_expression) [NOP_EXPR]: Don't let + the conversion set TREE_OVERFLOW. + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@171664 138bc75d-0d04-0410-961f-82ee72b054a4 + +index d23effe..5fe1414 100644 +--- a/gcc/cp/semantics.c ++++ b/gcc/cp/semantics.c +@@ -7030,6 +7030,11 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t, + conversion. */ + return fold (t); + r = fold_build1 (TREE_CODE (t), to, op); ++ /* Conversion of an out-of-range value has implementation-defined ++ behavior; the language considers it different from arithmetic ++ overflow, which is undefined. */ ++ if (TREE_OVERFLOW_P (r) && !TREE_OVERFLOW_P (op)) ++ TREE_OVERFLOW (r) = false; + } + break; + +index 598cae6..2d614ec 100644 +--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-data2.C ++++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-data2.C +@@ -44,5 +44,4 @@ extern template struct A3<int, 510>; + + // Use. + A3<int, 1111> a31; +-// FIXME should this be an error? + A3<char, 9999> a32; // { dg-warning "overflow" } +diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow2.C +new file mode 100644 +index 0000000..5d5749c +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow2.C +@@ -0,0 +1,8 @@ ++// PR c++/47504 ++// { dg-options -std=c++0x } ++ ++char constexpr sub(char arg) ++{ return char(arg - char(1)); } ++ ++int main() ++{ static char constexpr m = sub(-1); } +-- +1.7.0.4 + |