This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR rtl-optimization/23585 (delay slots)


Eric Botcazou wrote:
> > I think I would prefer to see may_trap_p turned into a static
> > may_trap_p_1, with a parameter to replace the file static
> > unaligned_memrefs_trap_p.  Other than that, and the aforementioned
> > SPARC_STACK_BOUNDARY_HACK comments, the patch looks OK to me.
> 
> Revised version attached.  Only exercised on the testcase for now; I'll do a 
> complete testing cycle if/when I install it.
> 
> > Please wait a day to see if there any other comments, though.
> 
> Sure, I'll wait a few days.
> 
> 
> 2005-10-16 ?Eric Botcazou ?<ebotcazou@libertysurf.fr>
> 
> ????????PR rtl-optimization/23585
> ????????* rtlanal.c (rtx_addr_can_trap_p_1): New predicate extracted from...
> ????????(rtx_addr_can_trap_p): ... here.  Invoke rtx_addr_can_trap_p_1.
> 	(may_trap_p_1): New predicate extracted from...
> 	(may_trap_p): ... here.  Invoke (may_trap_p_1.
> ????????(may_trap_or_fault_p): New predicate.
> ????????* rtl.h (may_trap_or_fault_p): Declare it.
> ????????* reorg.c (steal_delay_list_from_target): Use may_trap_or_fault_p
> ????????instead of may_trap_p.
> ????????(steal_delay_list_from_fallthrough): Likewise.
> ????????(fill_simple_delay_slots): Likewise.
> ????????(fill_slots_from_thread): Likewise.
> 	* function.c (pad_to_arg_alignment): Rework comment about
> 	SPARC_STACK_BOUNDARY_HACK.
> 	* config/sparc/sparc.h: Likewise.

This patch breaks (at least) for the latest gcc 4.0 on mips-linux
with the attached testcase:

$ build/gcc/xgcc -Bbuild/gcc -O2 -mabi=64 -c -o testcase testcase.c
testcase.c: In function 'direct2indirect':
testcase.c:57: internal compiler error: Floating point exception
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.0/README.Bugs>.

Reverting this single line of it lets the testcase build successfully.

--- src/gcc/reorg.c.old	2005-09-03 21:09:51.000000000 +0200
+++ src/gcc/reorg.c	2005-10-31 23:16:47.000000000 +0100
@@ -2653,7 +2653,7 @@ fill_slots_from_thread (rtx insn, rtx co
 	  if (!must_annul
 	      && (condition == const_true_rtx
 	          || (! insn_sets_resource_p (trial, &opposite_needed, 1)
-		      && ! may_trap_or_fault_p (pat))))
+		      && ! may_trap_p (pat))))
 	    {
 	      old_trial = trial;
 	      trial = try_split (pat, trial, 0);

I don't know if this is a proper fix or only a workaround which happens
to work on mips.


Thiemo
/* gcc -O2 -mabi=64 -c -o foo.o foo.c */

struct offset_v1 {
    int k_uniqueness;
};

struct offset_v2 {
 long v;
} __attribute__ ((__packed__));

struct reiserfs_key {
    int k_objectid;
    union {
 struct offset_v1 k_offset_v1;
 struct offset_v2 k_offset_v2;
    } u;
};

struct item_head
{
 struct reiserfs_key ih_key;
 int ih_version;
};

static void set_offset_v2_k_type(struct offset_v2 *v2)
{
    v2->v &= 1;
}

static void set_le_key_k_type (int version, struct reiserfs_key * key)
{
    version ? (key->u.k_offset_v1.k_uniqueness = 1)
	    : set_offset_v2_k_type(&(key->u.k_offset_v2));
}

static void set_le_ih_k_type (struct item_head * ih)
{
    set_le_key_k_type((__builtin_constant_p((ih)->ih_version) ? (ih)->ih_version : (ih)->ih_version), &(ih->ih_key));
}

void boo(struct item_head *ih, const char *body);

void direct2indirect(void)
{
    struct item_head *p_le_ih;
    struct item_head ind_ih;
    unsigned int unfm_ptr;

    if (__builtin_expect(32, 0)) __asm__ ("break");

    set_le_ih_k_type (&ind_ih);

    if (__builtin_constant_p(p_le_ih) ? 1 : 2) {
        (__builtin_constant_p(__builtin_constant_p(1) == 1));
      boo(&ind_ih, (char *)&unfm_ptr);
    }
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]