gcc/gcc44-vta-phiopt-pr41232.patch
Jakub Jelinek 116cffef39 4.4.1-10
2009-09-08 11:05:43 +00:00

46 lines
1.3 KiB
Diff

for gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR debug/41232
* tree-ssa-phiopt.c (minmax_replacement): Skip debug stmts
in the middle block.
for gcc/testsuite/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR debug/41232
* gcc.dg/pr41232.c: New.
Index: gcc/testsuite/gcc.dg/pr41232.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/gcc.dg/pr41232.c 2009-09-07 19:15:35.000000000 -0300
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -g" } */
+extern int atoi (const char *);
+extern int sprintf (char *, const char *, ...);
+void malloc_init() {
+ char *cptr;
+ char buf[1];
+ int tmbd = atoi(cptr);
+ if (tmbd > 0)
+ tmbd = (tmbd <= 124) ? tmbd : 124;
+ else
+ tmbd = 0;
+ sprintf(buf, "%d\n", tmbd);
+}
Index: gcc/tree-ssa-phiopt.c
===================================================================
--- gcc/tree-ssa-phiopt.c.orig 2009-09-07 19:00:29.000000000 -0300
+++ gcc/tree-ssa-phiopt.c 2009-09-07 19:15:35.000000000 -0300
@@ -848,7 +848,7 @@ minmax_replacement (basic_block cond_bb,
/* Move the statement from the middle block. */
gsi = gsi_last_bb (cond_bb);
- gsi_from = gsi_last_bb (middle_bb);
+ gsi_from = gsi_last_nondebug_bb (middle_bb);
gsi_move_before (&gsi_from, &gsi);
}