This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Bug in expmed.c:init_expmed
- To: gcc-patches at gcc dot gnu dot org
- Subject: Bug in expmed.c:init_expmed
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Mon, 10 Apr 00 08:04:58 EDT
Now that we cache CONST_INTs, we can't free ones allocated from the
permanent obstack, which this code does. It only affecxts front ends which
don't use the garbage collector. While debugging this, I saw some minor
formatting in emit-rtl.c that needed fixing.
Mon Apr 10 07:21:13 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* expmed.c (init_expmed): Don't free objects we make.
* emit-rtl.c (gen_rtx_CONST_INT, init_emit_once): Minor cleanups.
*** expmed.c 2000/03/30 21:46:37 1.56
--- expmed.c 2000/04/10 11:47:36
*************** void
*** 91,95 ****
init_expmed ()
{
- char *free_point;
/* This is "some random pseudo register" for purposes of calling recog
to see what insns exist. */
--- 91,94 ----
*************** init_expmed ()
*** 102,110 ****
start_sequence ();
- /* Since we are on the permanent obstack, we must be sure we save this
- spot AFTER we call start_sequence, since it will reuse the rtl it
- makes. */
- free_point = (char *) oballoc (0);
-
reg = gen_rtx_REG (word_mode, 10000);
--- 101,104 ----
*************** init_expmed ()
*** 192,198 ****
}
- /* Free the objects we just allocated. */
end_sequence ();
- obfree (free_point);
}
--- 186,190 ----
*** emit-rtl.c 2000/04/04 02:24:49 1.123
--- emit-rtl.c 2000/04/10 11:47:45
*************** gen_rtx_CONST_INT (mode, arg)
*** 249,257 ****
/* Look up the CONST_INT in the hash table. */
! slot = htab_find_slot_with_hash (const_int_htab,
! &arg,
! (hashval_t) arg,
! /*insert=*/1);
! if (!*slot)
{
if (!ggc_p)
--- 249,254 ----
/* Look up the CONST_INT in the hash table. */
! slot = htab_find_slot_with_hash (const_int_htab, &arg, (hashval_t) arg, 1);
! if (*slot == 0)
{
if (!ggc_p)
*************** gen_rtx_CONST_INT (mode, arg)
*** 259,266 ****
push_obstacks_nochange ();
end_temporary_allocation ();
}
! *slot = gen_rtx_raw_CONST_INT (VOIDmode, arg);
! if (!ggc_p)
! pop_obstacks ();
}
--- 256,264 ----
push_obstacks_nochange ();
end_temporary_allocation ();
+ *slot = gen_rtx_raw_CONST_INT (VOIDmode, arg);
+ pop_obstacks ();
}
! else
! *slot = gen_rtx_raw_CONST_INT (VOIDmode, arg);
}
*************** gen_rtx_CONST_INT (mode, arg)
*** 268,273 ****
}
! /* CONST_DOUBLEs needs special handling because its length is known
only at run-time. */
rtx
gen_rtx_CONST_DOUBLE (mode, arg0, arg1, arg2)
--- 266,272 ----
}
! /* CONST_DOUBLEs needs special handling because their length is known
only at run-time. */
+
rtx
gen_rtx_CONST_DOUBLE (mode, arg0, arg1, arg2)
*************** init_emit_once (line_numbers)
*** 4158,4165 ****
/* Initialize the CONST_INT hash table. */
! const_int_htab = htab_create (37,
! const_int_htab_hash,
! const_int_htab_eq,
! NULL);
ggc_add_root (&const_int_htab, 1, sizeof (const_int_htab),
rtx_htab_mark);
--- 4157,4162 ----
/* Initialize the CONST_INT hash table. */
! const_int_htab = htab_create (37, const_int_htab_hash,
! const_int_htab_eq, NULL);
ggc_add_root (&const_int_htab, 1, sizeof (const_int_htab),
rtx_htab_mark);