From mboxrd@z Thu Jan 1 00:00:00 1970 From: David.Billinghurst@riotinto.com To: gcc-gnats@gcc.gnu.org Cc: bernds@redhat.co.uk Subject: c/2466: Testsuite failure gcc.c-torture/execute/loop-2b.c -O2 Date: Mon, 02 Apr 2001 23:36:00 -0000 Message-id: <20010403062602.18442.qmail@sourceware.cygnus.com> X-SW-Source: 2001-04/msg00033.html List-Id: >Number: 2466 >Category: c >Synopsis: Testsuite failure gcc.c-torture/execute/loop-2b.c -O2 >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Apr 02 23:36:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: David Billinghurst >Release: gcc 3.0 (prerelease) & gcc 3.1 (experimental) >Organization: >Environment: i686-pc-gnu-linux i686-pc-cygwin >Description: Test gcc.c-torture/execute/loop-2b.c has been failing with -O2 on: * i?86-pc-gnu-linux * i?86-pc-cygwin since mid September 2000. A search found that cvs code from: * 2000-09-19 16:00 UTC passes the test, while * 2000-09-19 16:05 UTC fails This patch that triggers this bug is 2000-09-19 Bernd Schmidt * final.c (insn_current_reference_address): Use INSN_SHUID of seq rather than that of branch. (shorten_branches): Don't increment insn_current_address twice. Undo most of the Wed Jan 27 23:39:53 1999 patch: * loop.h (struct induction): Delete members derived, ix and last_use. (struct loop_ivs): Delete members first_increment_giv and last_increment_giv. * loop.c (verify_dominator, find_life_end, cmp_recombine_givs_stats, recombine_givs): Delete functions. (find_and_verify_loops): Don't initialize cont_dominator. (strength_reduce): Lose code to try to find bivs that can be expressed as givs of another biv, and to convert biv increments into givs. Lose loop_scan_start variable, always use loop->scan_start. Don't call recombine_givs. Don't handle derived givs. (record_giv): Don't initialize derived and last_use fields. (biv_eliminiation_giv_has_0_offset): Lose code to handle derived givs. * unroll.c (derived_regs): Delete static variable. (unroll_loop): Don't initialize it. (copy_loop_body): Lose code to handle derived givs. (find_splittable_givs): Don't check for givs made from biv increments. Don't set derived_regs. Fix misapplied earlier patch: * config/sh/sh.md (floatsisf_ie): Reenable. Remove explicit reference to fpul. (floatsisf2): Generate floatsisf_ie by default. (floatsisf_i4): Conditional on TARGET_SH4. (floatsisf2, floatsidf2, extendsfdf2): Also use reg_no_subreg_operand predicate for the expanders. I split the test case into two files, and found the error was localized to f.c :::::::::::: m.c ::::::::::::::: int a[2]; void f (int i); main () { a[0] = a[1] = 0; f (0); if (a[0] != -2 || a[1] != -2) abort (); exit (0); } :::::::::::: f.c ::::::::::::::: int a[2]; void f (int i) { for (; i < 2147483647; i++) { a[i] = -2; if (&a[i] == &a[1]) break; } } ::::::::::::::::::::::::::::::::: Code was compiled "gcc -c -O2 -da f.c" File f.c.08.gcse seems OK, but f.c.09.loop is clearly wrong Starting at insn 97, with i=0 in SI 42 insn 97: SI 58 = SI 42 = i insn 99: SI 59 = 4 * SI 42 = 4*i insn 101: SI 57 = SI 59 + &a = &a[i] insn 106: SI 61 = SI 42 = i insn 108: SI 62 = SI 42 * 4 = 4*i insn 110: SI 60 = SI 62 = 4*i insn 112: SI 64 = &a insn 114: SI 63 = SI 64 - 8 = &a - 8 <-- ??????? insn 95: SI 57 = SI 57 + 4 = &a[i] (for next i) insn 104: SI 60 = SI 60 + 4 = 4*i (for next i) insn 45: SI 42 = SI 42 + 1 = i+1 insn 12: compare(SI 57,SI 63) = compare(&a[i],&a-8) <- always true insn 13: if > 0 goto label_ref 52 insn 27: mem(SI 60 + &a) = a[i] = -2 In summary: * insn 114 looks strange * comparison at insn 12 is always true * jump at insn 13 is always taken * a[1] is not set to -2 * test fails. :::::::::::::: end of f.c.09.loop :::::::::::::::: (insn 97 73 99 (set (reg:SI 58) (reg/v:SI 42)) -1 (nil) (nil)) (insn 99 97 101 (parallel[ (set (reg:SI 59) (ashift:SI (reg:SI 58) (const_int 2 [0x2]))) (clobber (reg:CC 17 flags)) ] ) -1 (nil) (expr_list:REG_EQUAL (mult:SI (reg/v:SI 42) (const_int 4 [0x4])) (nil))) (insn 101 99 106 (parallel[ (set (reg/f:SI 57) (plus:SI (reg:SI 59) (symbol_ref:SI ("a")))) (clobber (reg:CC 17 flags)) ] ) -1 (nil) (nil)) (insn 106 101 108 (set (reg:SI 61) (reg/v:SI 42)) -1 (nil) (nil)) (insn 108 106 110 (parallel[ (set (reg:SI 62) (ashift:SI (reg:SI 61) (const_int 2 [0x2]))) (clobber (reg:CC 17 flags)) ] ) -1 (nil) (expr_list:REG_EQUAL (mult:SI (reg/v:SI 42) (const_int 4 [0x4])) (nil))) (insn 110 108 112 (set (reg:SI 60) (reg:SI 62)) -1 (nil) (nil)) (insn 112 110 114 (set (reg/f:SI 64) (symbol_ref:SI ("a"))) -1 (nil) (nil)) (insn 114 112 10 (parallel[ (set (reg/f:SI 63) (plus:SI (reg/f:SI 64) (const_int -8 [0xfffffff8]))) (clobber (reg:CC 17 flags)) ] ) -1 (nil) (nil)) (note 10 114 42 NOTE_INSN_LOOP_BEG 0) (note 42 10 43 NOTE_INSN_LOOP_CONT 0) (code_label 43 42 57 5 "" "" [1 uses]) (note 57 43 95 [bb 2] NOTE_INSN_BASIC_BLOCK 0) (insn 95 57 104 (parallel[ (set (reg/f:SI 57) (plus:SI (reg/f:SI 57) (const_int 4 [0x4]))) (clobber (reg:CC 17 flags)) ] ) -1 (nil) (nil)) (insn 104 95 45 (parallel[ (set (reg:SI 60) (plus:SI (reg:SI 60) (const_int 4 [0x4]))) (clobber (reg:CC 17 flags)) ] ) -1 (nil) (nil)) (insn 45 104 76 (parallel[ (set (reg/v:SI 42) (plus:SI (reg/v:SI 42) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ] ) -1 (nil) (nil)) (note 76 45 12 NOTE_INSN_LOOP_VTOP 0) (insn 12 76 13 (set (reg:CCGC 17 flags) (compare:CCGC (reg/f:SI 57) (reg/f:SI 63))) -1 (nil) (nil)) (jump_insn 13 12 59 (set (pc) (if_then_else (gt (reg:CCGC 17 flags) (const_int 0 [0x0])) (label_ref/s 52) (pc))) -1 (nil) (nil)) (note 59 13 27 [bb 3] NOTE_INSN_BASIC_BLOCK 0) (insn 27 59 35 (set (mem/s:SI (plus:SI (reg:SI 60) (symbol_ref:SI ("a"))) 1) (const_int -2 [0xfffffffe])) -1 (nil) (nil)) (insn 35 27 36 (set (reg:CCZ 17 flags) (compare:CCZ (reg/f:SI 57) (const:SI (plus:SI (symbol_ref:SI ("a")) (const_int 4 [0x4]))))) -1 (nil) (nil)) (jump_insn 36 35 51 (set (pc) (if_then_else (ne (reg:CCZ 17 flags) (const_int 0 [0x0])) (label_ref 43) (pc))) -1 (nil) (nil)) (note 51 36 52 NOTE_INSN_LOOP_END 0) (code_label 52 51 61 4 "" "" [3 uses]) (note 61 52 53 [bb 4] NOTE_INSN_BASIC_BLOCK 0) (note 53 61 0 NOTE_INSN_FUNCTION_END 0) +++++++++++++++++++++++++++++++++++++++++ (Mr) David Billinghurst Comalco Research Centre PO Box 316, Thomastown, Vic, Australia, 3074 Phone: +61 3 9469 0642 FAX: +61 3 9462 2700 Email: David.Billinghurst@riotinto.com >How-To-Repeat: gcc.c-torture/execute/loop-2b.c execute with -O2 >Fix: >Release-Note: >Audit-Trail: >Unformatted: