This is the mail archive of the 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: [3.4/3.5 PATCH/RFA] Fix SH ICE with -O2 -fPIC (PR 15396)

> Hi,
> For SH, LABEL_REF isn't permited by general_operand in PIC case
> and consttable_N insns use general_operand as checking function.
> The insn like
>   (unspec_volatile [(label_ref 775)
>                     (const_int 0 [0x0])] UNSPECV_CONST4)
> which is generated by consttable_4 insn isn't recognized in PIC
> case because of this and it causes the ICE in PR target/15396.
> The attached patch fixes this.  It bootstraps successfully on
> 3.4-branch with no regressions.
> I've got a similar error which this patch gets rid of in building
> glibc with current mainline + Joern's recent patches, though the
> testcase in PR itself doesn't fail on mainline and mainline fails
> for sh4-unknown-linux-gnu target when building libraries without
> Joern's patches.
> It also bootstraps with no regressions on mainline for sh4-linux
> with those patches.
> Regards,
> 	kaz
> --
> 	PR target/15396
> 	* config/sh/sh-protos.h (consttable_operand): Declare.
> 	* config/sh/sh.c (consttable_operand): New.
> 	* config/sh/ (consttable_4): Use consttable_operand.
> 	(consttable_8): Likewise.

This is the wrong approach.  putting the value of label into a a constant
in the text section is not PIC.  Does the label address a switch table?
I've found a similar problem recently in our local sources.  I've fixed it
by doing the mova fixup differently for PIC.

2004-05-27  J"orn Rennecke <>

        * sh.c (dump_table): New argument start.  Changed caller.
        (fixup_mova): New function.
        (find_barrier): Use it.
        (sh_reorg): Likewise.  Check for CODE_FOR_casesi_worker_2.
        * (*casesi_worker): Rename to:
        (casesi_worker_2): New insn.

This is just one of several dozen patches whose merge has been held up
by PR 15521.
I had hoped we can avoid this, but it seems I have to create a branch
for SH support in gcc 3.5 .

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