This is the mail archive of the gcc-bugs@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]

target/9365: segfault in gen_far_branch (config/sh/sh.c)


>Number:         9365
>Category:       target
>Synopsis:       segfault in gen_far_branch (config/sh/sh.c)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 18 21:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Marcus Comstedt
>Release:        3.3 20030113 (prerelease)
>Organization:
>Environment:
System: SunOS continuity 5.8 Generic_108528-10 sun4m sparc SUNW,SPARCstation-10
Architecture: sun4

	
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sh-unknown-elf
configured with: /home/marcus/gcc-20030113/configure --target=sh-elf --with-newlib --enable-languages=c,c++
>Description:
	The compiler segfaults at the following place:

(gdb) bt
#0  0x2f422c in gen_far_branch (bp=0xefffe568)
    at /home/marcus/gcc-20030113/gcc/config/sh/sh.c:3228
#1  0x2f55a8 in split_branches (first=0x3ef400)
    at /home/marcus/gcc-20030113/gcc/config/sh/sh.c:4114
#2  0x2f49f0 in machine_dependent_reorg (first=0x48f420)
    at /home/marcus/gcc-20030113/gcc/config/sh/sh.c:3854
#3  0x2b9d0c in rest_of_compilation (decl=0x4d0280)
    at /home/marcus/gcc-20030113/gcc/toplev.c:3508
#4  0x58f94 in c_expand_body (fndecl=0x4d0280, nested_p=0, can_defer_p=3766272)
    at /home/marcus/gcc-20030113/gcc/c-decl.c:6525
#5  0x58b68 in finish_function (nested=0, can_defer_p=1)
    at /home/marcus/gcc-20030113/gcc/c-decl.c:6396
#6  0x38cbc in yyparse () at c-parse.y:403
#7  0x460fc in c_common_parse_file (set_yydebug=0)
    at /home/marcus/gcc-20030113/gcc/c-lex.c:159
#8  0x2b8364 in compile_file () at /home/marcus/gcc-20030113/gcc/toplev.c:2126
#9  0x2be260 in do_compile () at /home/marcus/gcc-20030113/gcc/toplev.c:5354
#10 0x2be328 in toplev_main (argc=17, argv=0xeffffa6c)
    at /home/marcus/gcc-20030113/gcc/toplev.c:5385
(gdb) list
3223        emit_barrier_after (jump);
3224      emit_label_after (bp->near_label, insn);
3225      JUMP_LABEL (jump) = bp->far_label;
3226      if (! invert_jump (insn, label, 1))
3227        abort ();
3228      (emit_insn_after
3229       (gen_stuff_delay_slot
3230        (GEN_INT (INSN_UID (XEXP (SET_SRC (PATTERN (jump)), 0))),
3231         GEN_INT (recog_memoized (insn) == CODE_FOR_branch_false)),
3232        insn));

>How-To-Repeat:
	Compile the following program with
	`sh-elf-gcc -v -O2 -fomit-frame-pointer -c foo.c' :

	---8<--- foo.c ---8<---

void foo(int n, int *p)
{
  switch(n) {
   case 100: case 110: case 120: case 130: case 140:
   case 200: case 210: case 220: case 230: case 240:
   case 300: case 310: case 320: case 330: case 340:
   case 400: case 410: case 420: case 430: case 440:
   case 500: case 510: case 520: case 530: case 540:
   case 600: case 610: case 620: case 630: case 640:
   case 700: case 710: case 720: case 730: case 740:
   case 800: case 810: case 820: case 830: case 840:
   case 900: case 910: case 920: case 930: case 940:
     break;
   default:
     *p = n;
     break;
  }
}

	---8<---

>Fix:
	Use less optimization, or don't specify -fomit-frame-pointer.
>Release-Note:
>Audit-Trail:
>Unformatted:


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