public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/66375] [4.8/4.9/5 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu Date: Tue, 02 Jun 2015 11:21:00 -0000 [thread overview] Message-ID: <bug-66375-4-XRgmtw4app@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-66375-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66375 --- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- Indeed as we just feed the initial condition to chrec_convert it happily just fold_convert()s the zero to signed char and then back to int ... So res = follow_ssa_edge (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi, evolution_of_loop, limit); if (res == t_true) *evolution_of_loop = add_to_evolution (loop->num, chrec_convert (type, *evolution_of_loop, at_stmt), code, rhs1, at_stmt); doesn't work at all (the follow_ssa_edge call just picking up the initial value converted to the type of the add). static tree analyze_evolution_in_loop (gphi *loop_phi_node, tree init_cond) { ... /* Pass in the initial condition to the follow edge function. */ ev_fn = init_cond; res = follow_ssa_edge (loop, ssa_chain, loop_phi_node, &ev_fn, 0); I suppose a trick would be to always pass a symbolic initial condition but then this would likely pessimize code. With that we get (add_to_evolution (loop_nb = 1) (chrec_before = (int) (signed char) D.1876) (to_add = -11) (res = {(int) (signed char) D.1876, +, -11}_1)) (evolution_function = {(int) (signed char) 0, +, -11}_1)) Hmm, but that isn't correct either. We want (int)(signed char){(int)0, +, -11)_1 Sorter testcase pin-pointing the issue in VRP/SCEV: int a; extern void abort (void); int main () { int c = 0; for (; a < 13; ++a) c = (signed char)c - 11; if (c != 113) abort (); return c; }
next prev parent reply other threads:[~2015-06-02 11:21 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-02 5:43 [Bug tree-optimization/66375] New: " su at cs dot ucdavis.edu 2015-06-02 5:49 ` [Bug middle-end/66375] " pinskia at gcc dot gnu.org 2015-06-02 6:16 ` [Bug middle-end/66375] [4.8/4.9/5 Regression] " jakub at gcc dot gnu.org 2015-06-02 8:50 ` rguenth at gcc dot gnu.org 2015-06-02 9:31 ` rguenth at gcc dot gnu.org 2015-06-02 10:31 ` rguenth at gcc dot gnu.org 2015-06-02 11:21 ` rguenth at gcc dot gnu.org [this message] 2015-06-02 11:56 ` rguenth at gcc dot gnu.org 2015-06-02 14:34 ` rguenth at gcc dot gnu.org 2015-06-03 7:57 ` [Bug middle-end/66375] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org 2015-06-09 23:55 ` bernhard.kaindl at thalesgroup dot com 2015-06-10 7:01 ` [Bug middle-end/66375] [4.8/4.9/5 " rguenth at gcc dot gnu.org 2015-06-18 14:04 ` rguenth at gcc dot gnu.org 2015-06-23 8:28 ` [Bug middle-end/66375] [4.8/4.9 " rguenth at gcc dot gnu.org 2015-06-26 20:04 ` [Bug middle-end/66375] [4.9 " jakub at gcc dot gnu.org 2015-06-26 20:32 ` jakub at gcc dot gnu.org 2022-10-25 11:40 ` cvs-commit at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-66375-4-XRgmtw4app@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).