public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "amacleod at redhat dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103121] [12 Regression] Warnings in cp/optimize.c causing build failure Date: Tue, 09 Nov 2021 00:01:13 +0000 [thread overview] Message-ID: <bug-103121-4-2ofcsxdMkG@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103121-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103121 --- Comment #14 from Andrew Macleod <amacleod at redhat dot com> --- As near as I can tell, you are calling debug_ranger () to see what ranger could produce. That routine creates a new ranger and populates it, dumps out the results, kills the ranger and returns. When I put a breakpoint in the code: 2181 tree tlen = build_int_cst (size_type_node, len); (gdb) c Continuing. Breakpoint 1, strlen_pass::maybe_warn_overflow (this=0x7fffffffcec0, stmt=0x7fffe9f63910, call_lhs=true, len=0x7fffe9f4ed50, si=0x0, plus_one=false, rawmem=false) at /gcc/master/gcc/gcc/tree-ssa-strlen.c:1998 1998 if (!len || warning_suppressed_p (stmt, OPT_Wstringop_overflow_)) (gdb) p print_gimple_stmt (stderr, stmt, 0 ,0) *grp_name_25 = 0; $8 = void (gdb) enable 2 (gdb) c Continuing. Breakpoint 2, vr_values::range_of_expr (this=0x7fffffffcee0, r=..., expr=0x7fffe9f5d0d8, stmt=0x7fffe9f5b240) at /gcc/master/gcc/gcc/vr-values.c:182 182 if (!gimple_range_ssa_p (expr)) (gdb) p print_generic_expr (stderr, expr, 0) _2$9 = void (gdb) p print_gimple_stmt (stderr, stmt, 0, 0) grp_name_25 = __builtin_alloca (_2); $10 = void So yes, you are asking for the range of _2 at that statement.... but note the traceback shows you are invoking: Breakpoint 2, vr_values::range_of_expr Which means you aren't using ranger... that callback is into vr_values... which is the old EVRP engine. Have you called enable_ranger() to turn it on for your pass? You should be seeing gimple-ranger::range_of_expr() in that traceback. That also explains why when I range --param=ranger-debug=trace I wasn't seeing any calls in your listing. Looking deeper, the place where this is called from in get_size_range: if (!query) query = get_range_query (cfun); if (integral) { value_range vr; query->range_of_expr (vr, exp, stmt); p get_range_query (cfun) $11 = (range_query *) 0x40d9a80 <global_ranges> So if you didn't have a range query, it would have picked up global ranges.. Looking down the call chain: #0 vr_values::range_of_expr (this=0x7fffffffcee0, r=..., expr=0x7fffe9f5d0d8, stmt=0x7fffe9f5b240) at /gcc/master/gcc/gcc/vr-values.c:182 #1 0x000000000163c58c in get_size_range (query=0x7fffffffcee0, exp=0x7fffe9f5d0d8, stmt=0x7fffe9f5b240, range=0x7fffffffb840, flags=3) at /gcc/master/gcc/gcc/pointer-query.cc:320 #2 0x000000000163d724 in gimple_call_alloc_size (stmt=0x7fffe9f5b240, rng1=0x7fffffffbb20, qry=0x7fffffffcee0) at /gcc/master/gcc/gcc/pointer-query.cc:506 #3 0x0000000001643501 in compute_objsize_r (ptr=0x7fffe9f5d870, stmt=0x7fffe9f5b240, ostype=1, pref=0x7fffffffc7f0, snlim=..., qry=0x7fffffffcfb8) at /gcc/master/gcc/gcc/pointer-query.cc:1970 #4 0x000000000164224c in handle_mem_ref (mref=0x7fffe9f6d230, stmt=0x7fffe9f63910, ostype=1, pref=0x7fffffffc7f0, snlim=..., qry=0x7fffffffcfb8) at /gcc/master/gcc/gcc/pointer-query.cc:1702 #5 0x0000000001642d63 in compute_objsize_r (ptr=0x7fffe9f6d230, stmt=0x7fffe9f63910, ostype=1, pref=0x7fffffffc7f0, snlim=..., qry=0x7fffffffcfb8) at /gcc/master/gcc/gcc/pointer-query.cc:1865 #6 0x00000000016441a9 in compute_objsize (ptr=0x7fffe9f6d230, stmt=0x7fffe9f63910, ostype=1, pref=0x7fffffffc7f0, ptr_qry=0x7fffffffcfb8) at /gcc/master/gcc/gcc/pointer-query.cc:2154 #7 0x0000000001a71634 in strlen_pass::maybe_warn_overflow (this=0x7fffffffcec0, stmt=0x7fffe9f63910, call_lhs=true, len=0x7fffe9f4ed50, si=0x0, plus_one=false, rawmem=false) at /gcc/master/gcc/gcc/tree-ssa-strlen.c:2038 I see you are passing this range_query down the call chain from the maybe_warn_overflow. I am not sure where you picked up a vr-values range query... but if you had simply called enable_ranger() at the start of the pass, and let cfun->get_range_query() get the query object in get_size_range(), I would expect you to see rangers results. As it is, I don't know what you are looking at, nor where it came from.
next prev parent reply other threads:[~2021-11-09 0:01 UTC|newest] Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-07 22:33 [Bug other/103121] New: Warnings danglin at gcc dot gnu.org 2021-11-08 8:19 ` [Bug other/103121] [12 Regression] Warnings in cp/optimize.c causing build failure pinskia at gcc dot gnu.org 2021-11-08 9:24 ` [Bug tree-optimization/103121] " rguenth at gcc dot gnu.org 2021-11-08 13:19 ` dave.anglin at bell dot net 2021-11-08 16:08 ` msebor at gcc dot gnu.org 2021-11-08 16:19 ` danglin at gcc dot gnu.org 2021-11-08 19:00 ` msebor at gcc dot gnu.org 2021-11-08 19:04 ` msebor at gcc dot gnu.org 2021-11-08 19:36 ` amacleod at redhat dot com 2021-11-08 19:50 ` msebor at gcc dot gnu.org 2021-11-08 20:07 ` amacleod at redhat dot com 2021-11-08 20:48 ` msebor at gcc dot gnu.org 2021-11-08 21:11 ` amacleod at redhat dot com 2021-11-08 21:48 ` msebor at gcc dot gnu.org 2021-11-08 22:35 ` msebor at gcc dot gnu.org 2021-11-09 0:01 ` amacleod at redhat dot com [this message] 2021-11-09 1:11 ` msebor at gcc dot gnu.org 2021-11-09 7:20 ` aldyh at gcc dot gnu.org 2021-11-09 7:24 ` aldyh at gcc dot gnu.org 2021-11-09 8:22 ` rguenth at gcc dot gnu.org 2022-01-18 14:34 ` rguenth at gcc dot gnu.org 2022-01-18 20:18 ` amacleod at redhat dot com 2022-01-19 7:36 ` rguenther at suse dot de 2022-01-19 17:50 ` amacleod at redhat dot com 2022-01-20 7:22 ` rguenther at suse dot de 2022-01-20 7:25 ` rguenth at gcc dot gnu.org 2022-01-20 15:49 ` amacleod at redhat dot com 2022-01-20 16:14 ` msebor at gcc dot gnu.org 2022-01-20 17:14 ` danglin at gcc dot gnu.org 2022-01-21 7:27 ` rguenther at suse dot de 2022-01-21 16:16 ` msebor at gcc dot gnu.org 2022-01-21 17:53 ` amacleod at redhat dot com 2022-01-21 18:59 ` msebor 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-103121-4-2ofcsxdMkG@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).