diff options
Diffstat (limited to 'recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99303.patch')
| -rw-r--r-- | recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99303.patch | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99303.patch b/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99303.patch new file mode 100644 index 0000000000..53d1d08d52 --- /dev/null +++ b/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99303.patch | |||
| @@ -0,0 +1,131 @@ | |||
| 1 | Merge from Sourcery G++ 4.4: | ||
| 2 | |||
| 3 | 2009-05-21 Sandra Loosemore <sandra@codesourcery.com> | ||
| 4 | |||
| 5 | Merge from Sourcery G++ 4.3: | ||
| 6 | |||
| 7 | 2009-04-04 Sandra Loosemore <sandra@codesourcery.com> | ||
| 8 | |||
| 9 | Issue #5104 | ||
| 10 | PR tree-optimization/39604 | ||
| 11 | |||
| 12 | gcc/testsuite | ||
| 13 | * g++.dg/tree-ssa/sink-1.C: New. | ||
| 14 | |||
| 15 | gcc/ | ||
| 16 | * tree_ssa-sink.c (sink_code_in_bb): Do not sink statements out | ||
| 17 | of a lexical block containing variable definitions. | ||
| 18 | |||
| 19 | 2010-07-09 Sandra Loosemore <sandra@codesourcery.com> | ||
| 20 | |||
| 21 | Backport from mainline (originally on Sourcery G++ 4.4): | ||
| 22 | |||
| 23 | 2010-07-02 Julian Brown <julian@codesourcery.com> | ||
| 24 | |||
| 25 | === added file 'gcc/testsuite/g++.dg/tree-ssa/sink-1.C' | ||
| 26 | --- old/gcc/testsuite/g++.dg/tree-ssa/sink-1.C 1970-01-01 00:00:00 +0000 | ||
| 27 | +++ new/gcc/testsuite/g++.dg/tree-ssa/sink-1.C 2010-07-30 12:14:18 +0000 | ||
| 28 | @@ -0,0 +1,50 @@ | ||
| 29 | +/* { dg-do run } */ | ||
| 30 | +/* { dg-options "-O1" } */ | ||
| 31 | + | ||
| 32 | +class A { | ||
| 33 | + public: | ||
| 34 | + A() {} | ||
| 35 | + virtual ~A() {} | ||
| 36 | + void * dostuff(); | ||
| 37 | + | ||
| 38 | + virtual int dovirtual() = 0; | ||
| 39 | +}; | ||
| 40 | + | ||
| 41 | + | ||
| 42 | +class B : public A { | ||
| 43 | + public: | ||
| 44 | + B() {} | ||
| 45 | + int dovirtual() { return 0;} | ||
| 46 | + virtual ~B() {}; | ||
| 47 | +}; | ||
| 48 | + | ||
| 49 | +class C : public B { | ||
| 50 | + public: | ||
| 51 | + C() {} | ||
| 52 | + virtual ~C() {}; | ||
| 53 | +}; | ||
| 54 | + | ||
| 55 | +void* A::dostuff() | ||
| 56 | +{ | ||
| 57 | + return (void*)dovirtual(); | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +/* tree-ssa-sink was sinking the inlined destructor for STUFF out of | ||
| 61 | + the first inner block and into the second one, where it was ending up | ||
| 62 | + after the inlined constructor for STUFF2. This is bad because | ||
| 63 | + cfgexpand aliases STUFF and STUFF2 to the same storage at -O1 | ||
| 64 | + (i.e., without -fstrict-aliasing), with the result that STUFF2's | ||
| 65 | + vtable was getting trashed. */ | ||
| 66 | + | ||
| 67 | +int main() { | ||
| 68 | + { | ||
| 69 | + B stuff; | ||
| 70 | + stuff.dostuff(); | ||
| 71 | + } | ||
| 72 | + { | ||
| 73 | + C stuff2; | ||
| 74 | + stuff2.dostuff(); | ||
| 75 | + } | ||
| 76 | + return 0; | ||
| 77 | +} | ||
| 78 | + | ||
| 79 | |||
| 80 | === modified file 'gcc/tree-ssa-sink.c' | ||
| 81 | --- old/gcc/tree-ssa-sink.c 2009-11-28 16:21:00 +0000 | ||
| 82 | +++ new/gcc/tree-ssa-sink.c 2010-07-30 12:14:18 +0000 | ||
| 83 | @@ -470,6 +470,47 @@ | ||
| 84 | last = false; | ||
| 85 | continue; | ||
| 86 | } | ||
| 87 | + | ||
| 88 | + /* We cannot move statements that contain references to block-scope | ||
| 89 | + variables out of that block, as this may lead to incorrect aliasing | ||
| 90 | + when we lay out the stack frame in cfgexpand.c. | ||
| 91 | + In lieu of more sophisticated analysis, be very conservative here | ||
| 92 | + and prohibit moving any statement that references memory out of a | ||
| 93 | + block with variables. */ | ||
| 94 | + if (gimple_references_memory_p (stmt)) | ||
| 95 | + { | ||
| 96 | + tree fromblock = gimple_block (stmt); | ||
| 97 | + while (fromblock | ||
| 98 | + && fromblock != current_function_decl | ||
| 99 | + && !BLOCK_VARS (fromblock)) | ||
| 100 | + fromblock = BLOCK_SUPERCONTEXT (fromblock); | ||
| 101 | + if (fromblock && fromblock != current_function_decl) | ||
| 102 | + { | ||
| 103 | + gimple tostmt; | ||
| 104 | + tree toblock; | ||
| 105 | + | ||
| 106 | + if (gsi_end_p (togsi)) | ||
| 107 | + tostmt = gimple_seq_last_stmt (gsi_seq (togsi)); | ||
| 108 | + else | ||
| 109 | + tostmt = gsi_stmt (togsi); | ||
| 110 | + if (tostmt) | ||
| 111 | + toblock = gimple_block (tostmt); | ||
| 112 | + else | ||
| 113 | + toblock = NULL; | ||
| 114 | + while (toblock | ||
| 115 | + && toblock != current_function_decl | ||
| 116 | + && toblock != fromblock) | ||
| 117 | + toblock = BLOCK_SUPERCONTEXT (toblock); | ||
| 118 | + if (!toblock || toblock != fromblock) | ||
| 119 | + { | ||
| 120 | + if (!gsi_end_p (gsi)) | ||
| 121 | + gsi_prev (&gsi); | ||
| 122 | + last = false; | ||
| 123 | + continue; | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | if (dump_file) | ||
| 129 | { | ||
| 130 | fprintf (dump_file, "Sinking "); | ||
| 131 | |||
