diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0312-PR-c-49120.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0312-PR-c-49120.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/0312-PR-c-49120.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0312-PR-c-49120.patch new file mode 100644 index 0000000000..d5131812a4 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0312-PR-c-49120.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | From 6a3b64a24d74b084b77e5f0bbff64b0ea7b70159 Mon Sep 17 00:00:00 2001 | ||
2 | From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Mon, 23 May 2011 18:03:31 +0000 | ||
4 | Subject: [PATCH] PR c/49120 | ||
5 | * c-decl.c (start_decl): Convert expr to void_type_node. | ||
6 | |||
7 | * gcc.dg/pr49120.c: New test. | ||
8 | |||
9 | |||
10 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174082 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
11 | |||
12 | index 4e82f28..001330c 100644 | ||
13 | --- a/gcc/c-decl.c | ||
14 | +++ b/gcc/c-decl.c | ||
15 | @@ -1,6 +1,6 @@ | ||
16 | /* Process declarations and variables for C compiler. | ||
17 | Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, | ||
18 | - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 | ||
19 | + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 | ||
20 | Free Software Foundation, Inc. | ||
21 | |||
22 | This file is part of GCC. | ||
23 | @@ -3948,7 +3948,7 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, | ||
24 | return 0; | ||
25 | |||
26 | if (expr) | ||
27 | - add_stmt (expr); | ||
28 | + add_stmt (fold_convert (void_type_node, expr)); | ||
29 | |||
30 | if (TREE_CODE (decl) != FUNCTION_DECL && MAIN_NAME_P (DECL_NAME (decl))) | ||
31 | warning (OPT_Wmain, "%q+D is usually a function", decl); | ||
32 | new file mode 100644 | ||
33 | index 0000000..1a65222 | ||
34 | --- /dev/null | ||
35 | +++ b/gcc/testsuite/gcc.dg/pr49120.c | ||
36 | @@ -0,0 +1,11 @@ | ||
37 | +/* PR c/49120 */ | ||
38 | +/* { dg-do compile } */ | ||
39 | +/* { dg-options "-Wall" } */ | ||
40 | + | ||
41 | +int | ||
42 | +main () | ||
43 | +{ | ||
44 | + int a = 1; | ||
45 | + int c = ({ char b[a + 1]; b[0] = 0; b[0]; }); | ||
46 | + return c; | ||
47 | +} | ||
48 | -- | ||
49 | 1.7.0.4 | ||
50 | |||