From: Richard Sandiford Date: Tue, 18 Dec 2007 07:40:17 +0000 (+0000) Subject: 200x-xx-xx Kaz Kylheku X-Git-Tag: releases/gcc-4.3.0~914 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eef75f5ec020e74ff2c9a90ffed32427abfba837;p=thirdparty%2Fgcc.git 200x-xx-xx Kaz Kylheku gcc/ 200x-xx-xx Kaz Kylheku PR rtl-optimization/34456 * resource.c (mark_set_resources): Use regs_invalidated_by_call rather than call_used_regs and global_regs. gcc/testsuite/ PR rtl-optimization/34456 * gcc.c-torture/execute/pr34456.c: New test. From-SVN: r131033 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c3595a4dc61f..a482ad855c62 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-12-18 Kaz Kylheku + + PR rtl-optimization/34456 + * resource.c (mark_set_resources): Use regs_invalidated_by_call + rather than call_used_regs and global_regs. + 2007-12-18 Jakub Jelinek PR rtl-optimization/34490 diff --git a/gcc/resource.c b/gcc/resource.c index 2ffde4f8e6fe..d7e3339aa907 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -663,9 +663,8 @@ mark_set_resources (rtx x, struct resources *res, int in_dest, rtx link; res->cc = res->memory = 1; - for (r = 0; r < FIRST_PSEUDO_REGISTER; r++) - if (call_used_regs[r] || global_regs[r]) - SET_HARD_REG_BIT (res->regs, r); + + IOR_HARD_REG_SET (res->regs, regs_invalidated_by_call); for (link = CALL_INSN_FUNCTION_USAGE (x); link; link = XEXP (link, 1)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e75f2aa0aade..bc09250efe28 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-12-18 Richard Sandiford + + PR rtl-optimization/34456 + * gcc.c-torture/execute/pr34456.c: New test. + 2007-12-18 Jakub Jelinek PR c++/34488 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34456.c b/gcc/testsuite/gcc.c-torture/execute/pr34456.c new file mode 100644 index 000000000000..526c954e55ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34456.c @@ -0,0 +1,30 @@ +#include + +int __attribute__ ((noinline)) debug (void) { return 1; } +int errors; + +struct s { int elt; int (*compare) (int); }; + +static int +compare (const void *x, const void *y) +{ + const struct s *s1 = x, *s2 = y; + int (*compare1) (int); + int elt2; + + compare1 = s1->compare; + elt2 = s2->elt; + if (elt2 != 0 && debug () && compare1 (s1->elt) != 0) + errors++; + return compare1 (elt2); +} + +int bad_compare (int x) { return -x; } +struct s array[2] = { { 1, bad_compare }, { -1, bad_compare } }; + +int +main (void) +{ + qsort (array, 2, sizeof (struct s), compare); + return errors == 0; +}