diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0393-2011-06-06-Mikael-Pettersson-mikpe-it.uu.se.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0393-2011-06-06-Mikael-Pettersson-mikpe-it.uu.se.patch | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0393-2011-06-06-Mikael-Pettersson-mikpe-it.uu.se.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0393-2011-06-06-Mikael-Pettersson-mikpe-it.uu.se.patch new file mode 100644 index 0000000000..0333872b87 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0393-2011-06-06-Mikael-Pettersson-mikpe-it.uu.se.patch | |||
@@ -0,0 +1,59 @@ | |||
1 | From 5bc2d161c3700f4916bcdef05043a8420d8c0ebe Mon Sep 17 00:00:00 2001 | ||
2 | From: rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Mon, 6 Jun 2011 11:46:14 +0000 | ||
4 | Subject: [PATCH] 2011-06-06 Mikael Pettersson <mikpe@it.uu.se> | ||
5 | |||
6 | PR tree-optimization/49243 | ||
7 | * calls.c (setjmp_call_p): Also check if fndecl has the | ||
8 | returns_twice attribute. | ||
9 | |||
10 | * gcc.dg/pr49243.c: New. | ||
11 | |||
12 | |||
13 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174696 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
14 | |||
15 | index f539f66..1c161bf 100644 | ||
16 | --- a/gcc/calls.c | ||
17 | +++ b/gcc/calls.c | ||
18 | @@ -548,6 +548,8 @@ special_function_p (const_tree fndecl, int flags) | ||
19 | int | ||
20 | setjmp_call_p (const_tree fndecl) | ||
21 | { | ||
22 | + if (DECL_IS_RETURNS_TWICE (fndecl)) | ||
23 | + return ECF_RETURNS_TWICE; | ||
24 | return special_function_p (fndecl, 0) & ECF_RETURNS_TWICE; | ||
25 | } | ||
26 | |||
27 | new file mode 100644 | ||
28 | index 0000000..f896b05 | ||
29 | --- /dev/null | ||
30 | +++ b/gcc/testsuite/gcc.dg/pr49243.c | ||
31 | @@ -0,0 +1,25 @@ | ||
32 | +/* PR tree-optimization/49243 */ | ||
33 | +/* { dg-do compile } */ | ||
34 | +/* { dg-options "-O2 -Winline" } */ | ||
35 | + | ||
36 | +extern unsigned long jb[]; | ||
37 | +extern int my_setjmp(unsigned long jb[]) __attribute__((returns_twice)); | ||
38 | +extern int decode(const char*); | ||
39 | + | ||
40 | +static inline int wrapper(const char **s_ptr) /* { dg-warning "(inlining failed|function 'wrapper' can never be inlined because it uses setjmp)" } */ | ||
41 | +{ | ||
42 | + if (my_setjmp(jb) == 0) { | ||
43 | + const char *s = *s_ptr; | ||
44 | + while (decode(s) != 0) | ||
45 | + *s_ptr = ++s; | ||
46 | + return 0; | ||
47 | + } else | ||
48 | + return -1; | ||
49 | +} | ||
50 | + | ||
51 | +void parse(const char *data) | ||
52 | +{ | ||
53 | + const char *s = data; | ||
54 | + if (!(wrapper(&s) == -1 && (s - data) == 1)) /* { dg-warning "called from here" } */ | ||
55 | + __builtin_abort(); | ||
56 | +} | ||
57 | -- | ||
58 | 1.7.0.4 | ||
59 | |||