Comment 13 for bug 24717

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Tue, 1 Nov 2005 13:33:35 +0100
From: Thiemo Seufer <email address hidden>
To: <email address hidden>
Cc: Sven Luther <email address hidden>
Subject: Re: Bug#336167: gcc-4.0: breaks kernel builds in random ways.

--ibTvN161/egqYuK8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Thiemo Seufer wrote:
> Sven Luther wrote:
> > Package: gcc-4.0
> > Version: 4.0.2-3
> > Severity: grave
> > Justification: renders package unusable
> >
> >
> > Well, i confirm that this problem is also present on powerpc, using
> > gcc-4.0 4.0.2-3 makes the kernel build fail, while using -2 seems to be
> > ok. I have heard people mentioning two other arches where this is the
> > case (m68k and mips i think) on irc (on #debian-release i think even,
> > not sure), but no bug has been filed so i do it now.
> >
> > My powerpc builds failed with :
>
> For mips 2.6.12, which built fine with gcc 4.0.2-2:
>
> CC [M] fs/reiserfs/tail_conversion.o
> fs/reiserfs/tail_conversion.c: In function 'direct2indirect':
> fs/reiserfs/tail_conversion.c:138: 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>.
> make[5]: *** [fs/reiserfs/tail_conversion.o] Error 1
> make[4]: *** [fs/reiserfs] Error 2
>
> Sorry, no testcase yet.

The attached testcase triggers this bug on mips-linux when compiled
with "gcc -O2 -mabi=64 -c"

The appended patch reverts a single line of the diff between 4.0.2-2
and 4.0.2-3 and lets the testcase succeed. I don't know that part of
gcc enough to judge if it is a valid fix for the problem.

Sven, could you test if this fixes also the problem you see?

Thiemo

--ibTvN161/egqYuK8
Content-Type: text/x-csrc; charset=us-ascii
Content-Disposition: attachment; filename="testcase.c"

/* 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);
    }
}

--ibTvN161/egqYuK8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch

--- gcc-4.0-4.0.2.new/src/gcc/reorg.c 2005-09-03 21:09:51.000000000 +0200
+++ gcc-4.0-4.0.2/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);

--ibTvN161/egqYuK8--