This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
optimization/9448: [mainline] Wrong code with -O2 -fprefetch-loop-arrays
- From: zlomekj at suse dot cz
- To: gcc-gnats at gcc dot gnu dot org
- Date: 27 Jan 2003 11:42:35 -0000
- Subject: optimization/9448: [mainline] Wrong code with -O2 -fprefetch-loop-arrays
- Reply-to: zlomekj at suse dot cz
>Number: 9448
>Category: optimization
>Synopsis: [mainline] Wrong code with -O2 -fprefetch-loop-arrays
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Mon Jan 27 11:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Josef Zlomek
>Release: mainline
>Organization:
>Environment:
x86-64 but probably other 64-bit machines too
>Description:
In loop.c in function emit_prefetch_instructions on line 4200
there is the following command:
init_val = convert_to_mode (Pmode, init_val, 0);
It finally generates instructions to convert from SImode to DImode which are placed to the end of instruction stream and not to the place before loop.
Here is the backtrace:
#0 add_insn (insn=0x2a9589e120) at ../../gcc/emit-rtl.c:3613
#1 0x400a9441 in emit_insn (x=0x2a958a0240) at ../../gcc/emit-rtl.c:4671
#2 0x40148e17 in gen_extendsidi2 (operand0=0x2a958a0220, operand1=0x2a9589e120) at insn-emit.c:9318
#3 0x401ce83d in emit_unop_insn (icode=-1786126048, target=0x7fbfffc570, op0=0x2a956558c0, code=132) at ../../gcc/optabs.c:3029
#4 0x400bb3dd in convert_modes (mode=DImode, oldmode=2508849696, x=0x2a956558c0, unsignedp=0) at ../../gcc/expr.c:1435
#5 0x401bbaca in emit_prefetch_instructions (loop=0x405e7d00) at ../../gcc/loop.c:4200
#6 0x401bd47d in strength_reduce (loop=0x405e7d00, flags=6) at ../../gcc/loop.c:5112
#7 0x401b4b81 in scan_loop (loop=0x405e7d00, flags=6) at ../../gcc/loop.c:1166
#8 0x401b274b in loop_optimize (f=0x2a9565f120, dumpfile=0x0, flags=6) at ../../gcc/loop.c:552
#9 0x4023cf2b in rest_of_compilation (decl=0x2a95653540) at ../../gcc/toplev.c:2961
#10 0x4001af11 in c_expand_body (fndecl=0x2a9589e120, nested_p=1077278688, can_defer_p=1) at ../../gcc/c-decl.c:6541
#11 0x4001ab8d in finish_function (nested=0, can_defer_p=1) at ../../gcc/c-decl.c:6412
#12 0x40002830 in yyparse () at c-parse.y:406
#13 0x4000bdf7 in c_common_parse_file (set_yydebug=-1786126048) at ../../gcc/c-lex.c:165
>How-To-Repeat:
Compile attached testcase with -O2 -fprefetch-loop-arrays
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="u.i"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="u.i"
c3RhdGljIHZvaWQgbWFrZV90YWJsZShuY2hhcikKICAgIGludCBuY2hhcjsKewp9CmV4dGVybiB1
bnNpZ25lZCBjaGFyIG91dGJ1ZltdOwpzdGF0aWMgdm9pZCByZWFkX2NfbGVuKCkKewogICAgaW50
IGksIG47CiAgICBpZiAobiA9PSAwKSB7CiAgICAgICAgZm9yIChpID0gMDsgaSA8ICgyNTUgKyAy
NTYgKyAyIC0gMyk7IGkrKykgb3V0YnVmW2ldID0gMDsKICAgIH0gZWxzZSB7CiAgICAgICAgaSA9
IDA7CiAgICAgICAgd2hpbGUgKGkgPCBuKSB7CiAgICAgICAgfQogICAgICAgIHdoaWxlIChpIDwg
KDI1NSArIDI1NiArIDIgLSAzKSkgb3V0YnVmW2krK10gPSAwOwogICAgICAgIG1ha2VfdGFibGUo
KDI1NSArIDI1NiArIDIgLSAzKSk7CiAgICB9Cn0K