summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0370-2011-05-30-Richard-Guenther-rguenther-suse.de.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0370-2011-05-30-Richard-Guenther-rguenther-suse.de.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0370-2011-05-30-Richard-Guenther-rguenther-suse.de.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0370-2011-05-30-Richard-Guenther-rguenther-suse.de.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0370-2011-05-30-Richard-Guenther-rguenther-suse.de.patch
new file mode 100644
index 0000000000..e42ce20c8d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0370-2011-05-30-Richard-Guenther-rguenther-suse.de.patch
@@ -0,0 +1,69 @@
1From e6b2e8c99b9295953acd13658d44591561252337 Mon Sep 17 00:00:00 2001
2From: rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Mon, 30 May 2011 11:17:35 +0000
4Subject: [PATCH] 2011-05-30 Richard Guenther <rguenther@suse.de>
5
6 PR tree-optimization/49218
7 * tree-vrp.c (adjust_range_with_scev): Properly check whether
8 overflow occured.
9
10 * gcc.c-torture/execute/pr49218.c: New testcase.
11
12
13git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174430 138bc75d-0d04-0410-961f-82ee72b054a4
14
15index 2f50595..be083fc 100644
16new file mode 100644
17index 0000000..2fb18dd
18--- /dev/null
19+++ b/gcc/testsuite/gcc.c-torture/execute/pr49218.c
20@@ -0,0 +1,20 @@
21+#ifdef __SIZEOF_INT128__
22+typedef __int128 L;
23+#else
24+typedef long long L;
25+#endif
26+float f;
27+
28+int
29+main ()
30+{
31+ L i = f;
32+ if (i <= 10)
33+ do
34+ {
35+ ++i;
36+ asm ("");
37+ }
38+ while (i != 11);
39+ return 0;
40+}
41diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
42index 6914a08..299a948 100644
43--- a/gcc/tree-vrp.c
44+++ b/gcc/tree-vrp.c
45@@ -3422,11 +3422,17 @@ adjust_range_with_scev (value_range_t *vr, struct loop *loop,
46 loop->nb_iterations_upper_bound,
47 double_int_one),
48 unsigned_p, &overflow);
49- tem = double_int_to_tree (TREE_TYPE (init), dtmp);
50 /* If the multiplication overflowed we can't do a meaningful
51- adjustment. */
52- if (!overflow && double_int_equal_p (dtmp, tree_to_double_int (tem)))
53- {
54+ adjustment. Likewise if the result doesn't fit in the type
55+ of the induction variable. For a signed type we have to
56+ check whether the result has the expected signedness which
57+ is that of the step as nb_iterations_upper_bound is unsigned. */
58+ if (!overflow
59+ && double_int_fits_to_tree_p (TREE_TYPE (init), dtmp)
60+ && (unsigned_p
61+ || ((dtmp.high ^ TREE_INT_CST_HIGH (step)) >= 0)))
62+ {
63+ tem = double_int_to_tree (TREE_TYPE (init), dtmp);
64 extract_range_from_binary_expr (&maxvr, PLUS_EXPR,
65 TREE_TYPE (init), init, tem);
66 /* Likewise if the addition did. */
67--
681.7.0.4
69