summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0350-PR-c-49165.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0350-PR-c-49165.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0350-PR-c-49165.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0350-PR-c-49165.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0350-PR-c-49165.patch
new file mode 100644
index 0000000000..d684188b94
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0350-PR-c-49165.patch
@@ -0,0 +1,89 @@
1From 7a439d1a410aadbff83965a4ad40c92499caa66b Mon Sep 17 00:00:00 2001
2From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Thu, 26 May 2011 10:27:57 +0000
4Subject: [PATCH] PR c++/49165
5 * gimplify.c (shortcut_cond_r): Don't special case
6 COND_EXPRs if they have void type on one of their arms.
7
8 * g++.dg/eh/cond5.C: New test.
9
10
11git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174274 138bc75d-0d04-0410-961f-82ee72b054a4
12
13index 908d736..4c34795 100644
14--- a/gcc/gimplify.c
15+++ b/gcc/gimplify.c
16@@ -2555,7 +2555,9 @@ shortcut_cond_r (tree pred, tree *true_label_p, tree *false_label_p,
17 new_locus);
18 append_to_statement_list (t, &expr);
19 }
20- else if (TREE_CODE (pred) == COND_EXPR)
21+ else if (TREE_CODE (pred) == COND_EXPR
22+ && !VOID_TYPE_P (TREE_TYPE (TREE_OPERAND (pred, 1)))
23+ && !VOID_TYPE_P (TREE_TYPE (TREE_OPERAND (pred, 2))))
24 {
25 location_t new_locus;
26
27@@ -2563,7 +2565,10 @@ shortcut_cond_r (tree pred, tree *true_label_p, tree *false_label_p,
28 if (a)
29 if (b) goto yes; else goto no;
30 else
31- if (c) goto yes; else goto no; */
32+ if (c) goto yes; else goto no;
33+
34+ Don't do this if one of the arms has void type, which can happen
35+ in C++ when the arm is throw. */
36
37 /* Keep the original source location on the first 'if'. Set the source
38 location of the ? on the second 'if'. */
39new file mode 100644
40index 0000000..3f0c599
41--- /dev/null
42+++ b/gcc/testsuite/g++.dg/eh/cond5.C
43@@ -0,0 +1,43 @@
44+// PR c++/49165
45+// { dg-do run }
46+
47+extern "C" void abort ();
48+
49+int
50+foo (bool x, int y)
51+{
52+ if (y < 10 && (x ? true : throw 1))
53+ y++;
54+ if (y > 20 || (x ? true : throw 2))
55+ y++;
56+ return y;
57+}
58+
59+int
60+main ()
61+{
62+ if (foo (true, 0) != 2
63+ || foo (true, 10) != 11
64+ || foo (false, 30) != 31)
65+ abort ();
66+ try
67+ {
68+ foo (false, 0);
69+ abort ();
70+ }
71+ catch (int i)
72+ {
73+ if (i != 1)
74+ abort ();
75+ }
76+ try
77+ {
78+ foo (false, 10);
79+ abort ();
80+ }
81+ catch (int i)
82+ {
83+ if (i != 2)
84+ abort ();
85+ }
86+}
87--
881.7.0.4
89