summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99381.patch
diff options
context:
space:
mode:
authorKoen Kooi <koen@dominion.thruhere.net>2010-11-02 22:03:58 +0100
committerKoen Kooi <koen@dominion.thruhere.net>2010-11-02 22:12:02 +0100
commitbe10a6b1321f250b1034c7d9d0a8ef18b296eef1 (patch)
tree9249025cbfbfbee4cc430d62b27f75301dd4dfde /recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99381.patch
parent93b28937ac67ba46d65f55637e42552e224aa7e2 (diff)
downloadmeta-openembedded-be10a6b1321f250b1034c7d9d0a8ef18b296eef1.tar.gz
angstrom-layers: meta-openembedded: replace poky gcc 4.5 sources with OE ones
This needs further investigation, but for now we can get the tested sources into the poky gcc harness Signed-off-by: Koen Kooi <k-kooi@ti.com>
Diffstat (limited to 'recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99381.patch')
-rw-r--r--recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99381.patch512
1 files changed, 512 insertions, 0 deletions
diff --git a/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99381.patch b/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99381.patch
new file mode 100644
index 0000000000..c504f44fbe
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99381.patch
@@ -0,0 +1,512 @@
12010-09-06 Mark Mitchell <mark@codesourcery.com>
2
3 Issue #9022
4
5 Backport from mainline:
6 2010-09-05 Mark Mitchell <mark@codesourcery.com>
7 * doc/invoke.texi: Document -Wdouble-promotion.
8 * c-typeck.c (convert_arguments): Check for implicit conversions
9 from float to double.
10 (do_warn_double_promotion): New function.
11 (build_conditional_expr): Use it.
12 (build_binary_op): Likewise.
13 * c.opt (Wdouble-promotion): New.
14 2010-09-05 Mark Mitchell <mark@codesourcery.com>
15 * gcc.dg/Wdouble-promotion.c: New.
16 2010-09-06 Mark Mitchell <mark@codesourcery.com>
17 gcc/
18 * c-common.h (do_warn_double_promotion): Declare.
19 * c-common.c (do_warn_double_promotion): Define.
20 * c-typeck.c (do_warn_double_promotion): Remove.
21 * doc/invoke.texi (-Wdouble-promotion): Note available for C++ and
22 Objective-C++ too.
23 gcc/cp/
24 * typeck.c (cp_build_binary_op): Call do_warn_double_promotion.
25 * call.c (build_conditional_expr): Likewise.
26 (convert_arg_to_ellipsis): Likewise.
27 gcc/testsuite/
28 * g++.dg/warn/Wdouble-promotion.C: New.
29
30 2010-08-31 Chung-Lin Tang <cltang@codesourcery.com>
31
32 Backport from mainline:
33
34=== modified file 'gcc/c-common.c'
35--- old/gcc/c-common.c 2010-06-25 09:35:40 +0000
36+++ new/gcc/c-common.c 2010-09-07 15:47:57 +0000
37@@ -9172,6 +9172,40 @@
38 }
39 }
40
41+/* RESULT_TYPE is the result of converting TYPE1 and TYPE2 to a common
42+ type via c_common_type. If -Wdouble-promotion is in use, and the
43+ conditions for warning have been met, issue a warning. GMSGID is
44+ the warning message. It must have two %T specifiers for the type
45+ that was converted (generally "float") and the type to which it was
46+ converted (generally "double), respectively. LOC is the location
47+ to which the awrning should refer. */
48+
49+void
50+do_warn_double_promotion (tree result_type, tree type1, tree type2,
51+ const char *gmsgid, location_t loc)
52+{
53+ tree source_type;
54+
55+ if (!warn_double_promotion)
56+ return;
57+ /* If the conversion will not occur at run-time, there is no need to
58+ warn about it. */
59+ if (c_inhibit_evaluation_warnings)
60+ return;
61+ if (TYPE_MAIN_VARIANT (result_type) != double_type_node
62+ && TYPE_MAIN_VARIANT (result_type) != complex_double_type_node)
63+ return;
64+ if (TYPE_MAIN_VARIANT (type1) == float_type_node
65+ || TYPE_MAIN_VARIANT (type1) == complex_float_type_node)
66+ source_type = type1;
67+ else if (TYPE_MAIN_VARIANT (type2) == float_type_node
68+ || TYPE_MAIN_VARIANT (type2) == complex_float_type_node)
69+ source_type = type2;
70+ else
71+ return;
72+ warning_at (loc, OPT_Wdouble_promotion, gmsgid, source_type, result_type);
73+}
74+
75 /* Setup a TYPE_DECL node as a typedef representation.
76
77 X is a TYPE_DECL for a typedef statement. Create a brand new
78
79=== modified file 'gcc/c-common.h'
80--- old/gcc/c-common.h 2009-12-17 03:22:22 +0000
81+++ new/gcc/c-common.h 2010-09-07 15:47:57 +0000
82@@ -1056,6 +1056,8 @@
83 tree op0, tree op1,
84 tree result_type,
85 enum tree_code resultcode);
86+extern void do_warn_double_promotion (tree, tree, tree, const char *,
87+ location_t);
88 extern void set_underlying_type (tree x);
89 extern bool is_typedef_decl (tree x);
90 extern VEC(tree,gc) *make_tree_vector (void);
91
92=== modified file 'gcc/c-typeck.c'
93--- old/gcc/c-typeck.c 2010-04-02 18:54:46 +0000
94+++ new/gcc/c-typeck.c 2010-09-07 15:47:57 +0000
95@@ -3012,8 +3012,15 @@
96 if (type_generic)
97 parmval = val;
98 else
99- /* Convert `float' to `double'. */
100- parmval = convert (double_type_node, val);
101+ {
102+ /* Convert `float' to `double'. */
103+ if (warn_double_promotion && !c_inhibit_evaluation_warnings)
104+ warning (OPT_Wdouble_promotion,
105+ "implicit conversion from %qT to %qT when passing "
106+ "argument to function",
107+ valtype, double_type_node);
108+ parmval = convert (double_type_node, val);
109+ }
110 }
111 else if (excess_precision && !type_generic)
112 /* A "double" argument with excess precision being passed
113@@ -4036,6 +4043,10 @@
114 || code2 == COMPLEX_TYPE))
115 {
116 result_type = c_common_type (type1, type2);
117+ do_warn_double_promotion (result_type, type1, type2,
118+ "implicit conversion from %qT to %qT to "
119+ "match other result of conditional",
120+ colon_loc);
121
122 /* If -Wsign-compare, warn here if type1 and type2 have
123 different signedness. We'll promote the signed to unsigned
124@@ -9607,6 +9618,11 @@
125 if (shorten || common || short_compare)
126 {
127 result_type = c_common_type (type0, type1);
128+ do_warn_double_promotion (result_type, type0, type1,
129+ "implicit conversion from %qT to %qT "
130+ "to match other operand of binary "
131+ "expression",
132+ location);
133 if (result_type == error_mark_node)
134 return error_mark_node;
135 }
136
137=== modified file 'gcc/c.opt'
138--- old/gcc/c.opt 2010-04-02 18:54:46 +0000
139+++ new/gcc/c.opt 2010-09-07 15:47:57 +0000
140@@ -265,6 +265,10 @@
141 Wimplicit
142 C ObjC C++ ObjC++ Warning
143
144+Wdouble-promotion
145+C ObjC C++ ObjC++ Var(warn_double_promotion) Warning
146+Warn about implicit conversions from \"float\" to \"double\"
147+
148 Wimplicit-function-declaration
149 C ObjC Var(warn_implicit_function_declaration) Init(-1) Warning
150 Warn about implicit function declarations
151
152=== modified file 'gcc/cp/call.c'
153--- old/gcc/cp/call.c 2010-07-08 13:08:36 +0000
154+++ new/gcc/cp/call.c 2010-09-07 15:47:57 +0000
155@@ -3946,6 +3946,10 @@
156 /* In this case, there is always a common type. */
157 result_type = type_after_usual_arithmetic_conversions (arg2_type,
158 arg3_type);
159+ do_warn_double_promotion (result_type, arg2_type, arg3_type,
160+ "implicit conversion from %qT to %qT to "
161+ "match other result of conditional",
162+ input_location);
163
164 if (TREE_CODE (arg2_type) == ENUMERAL_TYPE
165 && TREE_CODE (arg3_type) == ENUMERAL_TYPE)
166@@ -5179,11 +5183,14 @@
167 tree
168 convert_arg_to_ellipsis (tree arg)
169 {
170+ tree arg_type;
171+
172 /* [expr.call]
173
174 The lvalue-to-rvalue, array-to-pointer, and function-to-pointer
175 standard conversions are performed. */
176 arg = decay_conversion (arg);
177+ arg_type = TREE_TYPE (arg);
178 /* [expr.call]
179
180 If the argument has integral or enumeration type that is subject
181@@ -5191,19 +5198,27 @@
182 type that is subject to the floating point promotion
183 (_conv.fpprom_), the value of the argument is converted to the
184 promoted type before the call. */
185- if (TREE_CODE (TREE_TYPE (arg)) == REAL_TYPE
186- && (TYPE_PRECISION (TREE_TYPE (arg))
187+ if (TREE_CODE (arg_type) == REAL_TYPE
188+ && (TYPE_PRECISION (arg_type)
189 < TYPE_PRECISION (double_type_node))
190- && !DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (arg))))
191- arg = convert_to_real (double_type_node, arg);
192- else if (INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (arg)))
193+ && !DECIMAL_FLOAT_MODE_P (TYPE_MODE (arg_type)))
194+ {
195+ if (warn_double_promotion && !c_inhibit_evaluation_warnings)
196+ warning (OPT_Wdouble_promotion,
197+ "implicit conversion from %qT to %qT when passing "
198+ "argument to function",
199+ arg_type, double_type_node);
200+ arg = convert_to_real (double_type_node, arg);
201+ }
202+ else if (INTEGRAL_OR_ENUMERATION_TYPE_P (arg_type))
203 arg = perform_integral_promotions (arg);
204
205 arg = require_complete_type (arg);
206+ arg_type = TREE_TYPE (arg);
207
208 if (arg != error_mark_node
209- && (type_has_nontrivial_copy_init (TREE_TYPE (arg))
210- || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (arg))))
211+ && (type_has_nontrivial_copy_init (arg_type)
212+ || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (arg_type)))
213 {
214 /* [expr.call] 5.2.2/7:
215 Passing a potentially-evaluated argument of class type (Clause 9)
216@@ -5218,7 +5233,7 @@
217 it is not potentially-evaluated. */
218 if (cp_unevaluated_operand == 0)
219 error ("cannot pass objects of non-trivially-copyable "
220- "type %q#T through %<...%>", TREE_TYPE (arg));
221+ "type %q#T through %<...%>", arg_type);
222 }
223
224 return arg;
225
226=== modified file 'gcc/cp/typeck.c'
227--- old/gcc/cp/typeck.c 2010-06-30 21:06:28 +0000
228+++ new/gcc/cp/typeck.c 2010-09-07 15:47:57 +0000
229@@ -260,6 +260,7 @@
230 enum tree_code code2 = TREE_CODE (t2);
231 tree attributes;
232
233+
234 /* In what follows, we slightly generalize the rules given in [expr] so
235 as to deal with `long long' and `complex'. First, merge the
236 attributes. */
237@@ -4226,7 +4227,14 @@
238 if (!result_type
239 && arithmetic_types_p
240 && (shorten || common || short_compare))
241- result_type = cp_common_type (type0, type1);
242+ {
243+ result_type = cp_common_type (type0, type1);
244+ do_warn_double_promotion (result_type, type0, type1,
245+ "implicit conversion from %qT to %qT "
246+ "to match other operand of binary "
247+ "expression",
248+ location);
249+ }
250
251 if (!result_type)
252 {
253
254=== modified file 'gcc/doc/invoke.texi'
255--- old/gcc/doc/invoke.texi 2010-08-16 09:41:58 +0000
256+++ new/gcc/doc/invoke.texi 2010-09-07 15:47:57 +0000
257@@ -234,8 +234,8 @@
258 -Wchar-subscripts -Wclobbered -Wcomment @gol
259 -Wconversion -Wcoverage-mismatch -Wno-deprecated @gol
260 -Wno-deprecated-declarations -Wdisabled-optimization @gol
261--Wno-div-by-zero -Wempty-body -Wenum-compare -Wno-endif-labels @gol
262--Werror -Werror=* @gol
263+-Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
264+-Wno-endif-labels -Werror -Werror=* @gol
265 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
266 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
267 -Wformat-security -Wformat-y2k @gol
268@@ -2976,6 +2976,30 @@
269 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
270 This warning is enabled by @option{-Wall}.
271
272+@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
273+@opindex Wdouble-promotion
274+@opindex Wno-double-promotion
275+Give a warning when a value of type @code{float} is implicitly
276+promoted to @code{double}. CPUs with a 32-bit ``single-precision''
277+floating-point unit implement @code{float} in hardware, but emulate
278+@code{double} in software. On such a machine, doing computations
279+using @code{double} values is much more expensive because of the
280+overhead required for software emulation.
281+
282+It is easy to accidentally do computations with @code{double} because
283+floating-point literals are implicitly of type @code{double}. For
284+example, in:
285+@smallexample
286+@group
287+float area(float radius)
288+@{
289+ return 3.14159 * radius * radius;
290+@}
291+@end group
292+@end smallexample
293+the compiler will perform the entire computation with @code{double}
294+because the floating-point literal is a @code{double}.
295+
296 @item -Wformat
297 @opindex Wformat
298 @opindex Wno-format
299
300=== added file 'gcc/testsuite/g++.dg/warn/Wdouble-promotion.C'
301--- old/gcc/testsuite/g++.dg/warn/Wdouble-promotion.C 1970-01-01 00:00:00 +0000
302+++ new/gcc/testsuite/g++.dg/warn/Wdouble-promotion.C 2010-09-07 15:47:57 +0000
303@@ -0,0 +1,99 @@
304+/* { dg-do compile } */
305+/* { dg-options "-Wdouble-promotion" } */
306+
307+#include <stddef.h>
308+
309+/* Some targets do not provide <complex.h> so we define I ourselves. */
310+#define I 1.0iF
311+#define ID ((_Complex double)I)
312+
313+float f;
314+double d;
315+int i;
316+long double ld;
317+_Complex float cf;
318+_Complex double cd;
319+_Complex long double cld;
320+size_t s;
321+
322+extern void varargs_fn (int, ...);
323+extern void double_fn (double);
324+extern float float_fn (void);
325+
326+void
327+usual_arithmetic_conversions(void)
328+{
329+ float local_f;
330+ _Complex float local_cf;
331+
332+ /* Values of type "float" are implicitly converted to "double" or
333+ "long double" due to use in arithmetic with "double" or "long
334+ double" operands. */
335+ local_f = f + 1.0; /* { dg-warning "implicit" } */
336+ local_f = f - d; /* { dg-warning "implicit" } */
337+ local_f = 1.0f * 1.0; /* { dg-warning "implicit" } */
338+ local_f = 1.0f / d; /* { dg-warning "implicit" } */
339+
340+ local_cf = cf + 1.0; /* { dg-warning "implicit" } */
341+ local_cf = cf - d; /* { dg-warning "implicit" } */
342+ local_cf = cf + 1.0 * ID; /* { dg-warning "implicit" } */
343+ local_cf = cf - cd; /* { dg-warning "implicit" } */
344+
345+ local_f = i ? f : d; /* { dg-warning "implicit" } */
346+ i = f == d; /* { dg-warning "implicit" } */
347+ i = d != f; /* { dg-warning "implicit" } */
348+}
349+
350+void
351+default_argument_promotion (void)
352+{
353+ /* Because "f" is part of the variable argument list, it is promoted
354+ to "double". */
355+ varargs_fn (1, f); /* { dg-warning "implicit" } */
356+}
357+
358+/* There is no warning when an explicit cast is used to perform the
359+ conversion. */
360+
361+void
362+casts (void)
363+{
364+ float local_f;
365+ _Complex float local_cf;
366+
367+ local_f = (double)f + 1.0; /* { dg-bogus "implicit" } */
368+ local_f = (double)f - d; /* { dg-bogus "implicit" } */
369+ local_f = (double)1.0f + 1.0; /* { dg-bogus "implicit" } */
370+ local_f = (double)1.0f - d; /* { dg-bogus "implicit" } */
371+
372+ local_cf = (_Complex double)cf + 1.0; /* { dg-bogus "implicit" } */
373+ local_cf = (_Complex double)cf - d; /* { dg-bogus "implicit" } */
374+ local_cf = (_Complex double)cf + 1.0 * ID; /* { dg-bogus "implicit" } */
375+ local_cf = (_Complex double)cf - cd; /* { dg-bogus "implicit" } */
376+
377+ local_f = i ? (double)f : d; /* { dg-bogus "implicit" } */
378+ i = (double)f == d; /* { dg-bogus "implicit" } */
379+ i = d != (double)f; /* { dg-bogus "implicit" } */
380+}
381+
382+/* There is no warning on conversions that occur in assignment (and
383+ assignment-like) contexts. */
384+
385+void
386+assignments (void)
387+{
388+ d = f; /* { dg-bogus "implicit" } */
389+ double_fn (f); /* { dg-bogus "implicit" } */
390+ d = float_fn (); /* { dg-bogus "implicit" } */
391+}
392+
393+/* There is no warning in non-evaluated contexts. */
394+
395+void
396+non_evaluated (void)
397+{
398+ s = sizeof (f + 1.0); /* { dg-bogus "implicit" } */
399+ s = __alignof__ (f + 1.0); /* { dg-bogus "implicit" } */
400+ d = (__typeof__(f + 1.0))f; /* { dg-bogus "implicit" } */
401+ s = sizeof (i ? f : d); /* { dg-bogus "implicit" } */
402+}
403
404=== added file 'gcc/testsuite/gcc.dg/Wdouble-promotion.c'
405--- old/gcc/testsuite/gcc.dg/Wdouble-promotion.c 1970-01-01 00:00:00 +0000
406+++ new/gcc/testsuite/gcc.dg/Wdouble-promotion.c 2010-09-07 15:47:57 +0000
407@@ -0,0 +1,104 @@
408+/* { dg-do compile } */
409+/* { dg-options "-Wdouble-promotion" } */
410+
411+#include <stddef.h>
412+
413+/* Some targets do not provide <complex.h> so we define I ourselves. */
414+#define I 1.0iF
415+#define ID ((_Complex double)I)
416+
417+float f;
418+double d;
419+int i;
420+long double ld;
421+_Complex float cf;
422+_Complex double cd;
423+_Complex long double cld;
424+size_t s;
425+
426+extern void unprototyped_fn ();
427+extern void varargs_fn (int, ...);
428+extern void double_fn (double);
429+extern float float_fn (void);
430+
431+void
432+usual_arithmetic_conversions(void)
433+{
434+ float local_f;
435+ _Complex float local_cf;
436+
437+ /* Values of type "float" are implicitly converted to "double" or
438+ "long double" due to use in arithmetic with "double" or "long
439+ double" operands. */
440+ local_f = f + 1.0; /* { dg-warning "implicit" } */
441+ local_f = f - d; /* { dg-warning "implicit" } */
442+ local_f = 1.0f * 1.0; /* { dg-warning "implicit" } */
443+ local_f = 1.0f / d; /* { dg-warning "implicit" } */
444+
445+ local_cf = cf + 1.0; /* { dg-warning "implicit" } */
446+ local_cf = cf - d; /* { dg-warning "implicit" } */
447+ local_cf = cf + 1.0 * ID; /* { dg-warning "implicit" } */
448+ local_cf = cf - cd; /* { dg-warning "implicit" } */
449+
450+ local_f = i ? f : d; /* { dg-warning "implicit" } */
451+ i = f == d; /* { dg-warning "implicit" } */
452+ i = d != f; /* { dg-warning "implicit" } */
453+}
454+
455+void
456+default_argument_promotion (void)
457+{
458+ /* Because there is no prototype, "f" is promoted to "double". */
459+ unprototyped_fn (f); /* { dg-warning "implicit" } */
460+ undeclared_fn (f); /* { dg-warning "implicit" } */
461+ /* Because "f" is part of the variable argument list, it is promoted
462+ to "double". */
463+ varargs_fn (1, f); /* { dg-warning "implicit" } */
464+}
465+
466+/* There is no warning when an explicit cast is used to perform the
467+ conversion. */
468+
469+void
470+casts (void)
471+{
472+ float local_f;
473+ _Complex float local_cf;
474+
475+ local_f = (double)f + 1.0; /* { dg-bogus "implicit" } */
476+ local_f = (double)f - d; /* { dg-bogus "implicit" } */
477+ local_f = (double)1.0f + 1.0; /* { dg-bogus "implicit" } */
478+ local_f = (double)1.0f - d; /* { dg-bogus "implicit" } */
479+
480+ local_cf = (_Complex double)cf + 1.0; /* { dg-bogus "implicit" } */
481+ local_cf = (_Complex double)cf - d; /* { dg-bogus "implicit" } */
482+ local_cf = (_Complex double)cf + 1.0 * ID; /* { dg-bogus "implicit" } */
483+ local_cf = (_Complex double)cf - cd; /* { dg-bogus "implicit" } */
484+
485+ local_f = i ? (double)f : d; /* { dg-bogus "implicit" } */
486+ i = (double)f == d; /* { dg-bogus "implicit" } */
487+ i = d != (double)f; /* { dg-bogus "implicit" } */
488+}
489+
490+/* There is no warning on conversions that occur in assignment (and
491+ assignment-like) contexts. */
492+
493+void
494+assignments (void)
495+{
496+ d = f; /* { dg-bogus "implicit" } */
497+ double_fn (f); /* { dg-bogus "implicit" } */
498+ d = float_fn (); /* { dg-bogus "implicit" } */
499+}
500+
501+/* There is no warning in non-evaluated contexts. */
502+
503+void
504+non_evaluated (void)
505+{
506+ s = sizeof (f + 1.0); /* { dg-bogus "implicit" } */
507+ s = __alignof__ (f + 1.0); /* { dg-bogus "implicit" } */
508+ d = (__typeof__(f + 1.0))f; /* { dg-bogus "implicit" } */
509+ s = sizeof (i ? f : d); /* { dg-bogus "implicit" } */
510+ s = sizeof (unprototyped_fn (f)); /* { dg-bogus "implicit" } */
511+}
512