With prologues appearing in blocks other than the entry block, ifcvt can
decide to predicate them. This is not a good idea, as dwarf2out will
blow up trying to handle predicated frame-related things.


Bernd
        * ifcvt.c (cond_exec_process_insns): Disallow converting a block
        that contains the prologue.

        * gcc.c-torture/compile/20110322-1.c: New test.

Index: gcc/ifcvt.c
===================================================================
--- gcc.orig/ifcvt.c
+++ gcc/ifcvt.c
@@ -304,6 +304,10 @@ cond_exec_process_insns (ce_if_block_t *
 
   for (insn = start; ; insn = NEXT_INSN (insn))
     {
+      /* dwarf2out can't cope with conditional prologues.  */
+      if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_PROLOGUE_END)
+       return FALSE;
+
       if (NOTE_P (insn) || DEBUG_INSN_P (insn))
        goto insn_done;
 
Index: gcc/testsuite/gcc.c-torture/compile/20110322-1.c
===================================================================
--- /dev/null
+++ gcc/testsuite/gcc.c-torture/compile/20110322-1.c
@@ -0,0 +1,22 @@
+void asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len)
+{
+    int k;
+    unsigned char temp[4];
+    if (len < 128) {
+       if (ans != ((void *) 0))
+           ans[0] = (unsigned char) len;
+       *ans_len = 1;
+    } else {
+       k = 0;
+       while (len) {
+           temp[k++] = len & 0xFF;
+           len = len >> 8;
+       }
+       *ans_len = k + 1;
+       if (ans != ((void *) 0)) {
+           ans[0] = ((unsigned char) k & 0x7F) + 128;
+           while (k--)
+               ans[*ans_len - 1 - k] = temp[k];
+       }
+    }
+}

Reply via email to