public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/67850] New: Wrong call_used_regs used in aggregate_value_p
@ 2015-10-05 13:04 hjl.tools at gmail dot com
  2015-10-05 13:35 ` [Bug middle-end/67850] " hjl.tools at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2015-10-05 13:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67850

            Bug ID: 67850
           Summary: Wrong call_used_regs used in aggregate_value_p
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: julia.koval at intel dot com
  Target Milestone: ---

aggregate_value_p may be called:

#0  aggregate_value_p (exp=0x7ffff7ff9258, fntype=0x7ffff150b0a8)
    at /export/gnu/import/git/sources/gcc/gcc/function.c:2096
#1  0x0000000000e2d3ae in (anonymous namespace)::pass_nrv::execute (
    this=0x2313730, fun=0x7ffff16091f8)
    at /export/gnu/import/git/sources/gcc/gcc/tree-nrv.c:153
#2  0x0000000000c6c6ce in execute_one_pass (pass=0x2313730)
    at /export/gnu/import/git/sources/gcc/gcc/passes.c:2342
#3  0x0000000000c6c918 in execute_pass_list_1 (pass=0x2313730)
    at /export/gnu/import/git/sources/gcc/gcc/passes.c:2395
#4  0x0000000000c6c989 in execute_pass_list (fn=0x7ffff16091f8, pass=0x2310730)
    at /export/gnu/import/git/sources/gcc/gcc/passes.c:2406
#5  0x00000000008f436c in cgraph_node::expand (this=0x7ffff160c170)
    at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:1983
#6  0x00000000008f49a6 in expand_all_functions ()
    at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:2119
#7  0x00000000008f54bf in symbol_table::compile (this=0x7ffff14e90a8)
    at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:2472
#8  0x00000000008f56e0 in symbol_table::finalize_compilation_unit (
    this=0x7ffff14e90a8)
    at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:2562
#9  0x0000000000d6a287 in compile_file ()
(gdb) f 1
#1  0x0000000000e2d3ae in (anonymous namespace)::pass_nrv::execute (
    this=0x2313730, fun=0x7ffff16091f8)
    at /export/gnu/import/git/sources/gcc/gcc/tree-nrv.c:153
153       if (!aggregate_value_p (result, current_function_decl))
(gdb) 

But the wrong call_used_regs may be used here:

  regno = REGNO (reg);
  nregs = hard_regno_nregs[regno][TYPE_MODE (type)];
  for (i = 0; i < nregs; i++) 
    if (! call_used_regs[regno + i])
      return 1;

since targetm.expand_to_rtl_hook may be called to switch ABI:

(gdb) bt
#0  ix86_maybe_switch_abi ()
    at /export/gnu/import/git/sources/gcc/gcc/config/i386/i386.c:7445
#1  0x00000000008b0e6f in (anonymous namespace)::pass_expand::execute (
    this=0x2313850, fun=0x7ffff16090a8)
    at /export/gnu/import/git/sources/gcc/gcc/cfgexpand.c:6153
#2  0x0000000000c6c6ce in execute_one_pass (pass=0x2313850)
    at /export/gnu/import/git/sources/gcc/gcc/passes.c:2342
#3  0x0000000000c6c918 in execute_pass_list_1 (pass=0x2313850)
    at /export/gnu/import/git/sources/gcc/gcc/passes.c:2395
#4  0x0000000000c6c989 in execute_pass_list (fn=0x7ffff16090a8, pass=0x2310730)
    at /export/gnu/import/git/sources/gcc/gcc/passes.c:2406
#5  0x00000000008f436c in cgraph_node::expand (this=0x7ffff160c000)
    at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:1983
#6  0x00000000008f49a6 in expand_all_functions ()
    at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:2119
#7  0x00000000008f54bf in symbol_table::compile (this=0x7ffff14e90a8)
    at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:2472
#8  0x00000000008f56e0 in symbol_table::finalize_compilation_unit (
    this=0x7ffff14e90a8)
    at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:2562
#9  0x0000000000d6a287 in compile_file ()

to change call_used_regs.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/67850] Wrong call_used_regs used in aggregate_value_p
  2015-10-05 13:04 [Bug middle-end/67850] New: Wrong call_used_regs used in aggregate_value_p hjl.tools at gmail dot com
@ 2015-10-05 13:35 ` hjl.tools at gmail dot com
  2015-10-07 10:30 ` [Bug target/67850] " hjl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2015-10-05 13:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67850

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at ucw dot cz

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Should targetm.expand_to_rtl_hook be called from cgraph_node::expand
instead?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/67850] Wrong call_used_regs used in aggregate_value_p
  2015-10-05 13:04 [Bug middle-end/67850] New: Wrong call_used_regs used in aggregate_value_p hjl.tools at gmail dot com
  2015-10-05 13:35 ` [Bug middle-end/67850] " hjl.tools at gmail dot com
@ 2015-10-07 10:30 ` hjl at gcc dot gnu.org
  2015-10-12 12:26 ` hjl at gcc dot gnu.org
  2015-10-12 12:48 ` hjl.tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hjl at gcc dot gnu.org @ 2015-10-07 10:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67850

--- Comment #2 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Wed Oct  7 10:30:12 2015
New Revision: 228565

URL: https://gcc.gnu.org/viewcvs?rev=228565&root=gcc&view=rev
Log:
Merge ix86_maybe_switch_abi with ix86_set_current_function

ix86_maybe_switch_abi is called to late during RTL expansion and we
use the stale information from compilation of the previous function.
aggregate_value_p uses call_used_regs.  aggregate_value_p is used by
IPA and return value optimization, which are called before
ix86_maybe_switch_abi is called.  This patch merges ix86_maybe_switch_abi
with ix86_set_current_function.

        PR target/67850
        * config/i386/i386.c (ix86_maybe_switch_abi): Merged with ...
        (ix86_set_current_function): This.
        (TARGET_EXPAND_TO_RTL_HOOK): Removed.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/67850] Wrong call_used_regs used in aggregate_value_p
  2015-10-05 13:04 [Bug middle-end/67850] New: Wrong call_used_regs used in aggregate_value_p hjl.tools at gmail dot com
  2015-10-05 13:35 ` [Bug middle-end/67850] " hjl.tools at gmail dot com
  2015-10-07 10:30 ` [Bug target/67850] " hjl at gcc dot gnu.org
@ 2015-10-12 12:26 ` hjl at gcc dot gnu.org
  2015-10-12 12:48 ` hjl.tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hjl at gcc dot gnu.org @ 2015-10-12 12:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67850

--- Comment #3 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Mon Oct 12 12:26:09 2015
New Revision: 228711

URL: https://gcc.gnu.org/viewcvs?rev=228711&root=gcc&view=rev
Log:
Merge ix86_maybe_switch_abi with ix86_set_current_function

ix86_maybe_switch_abi is called to late during RTL expansion and we
use the stale information from compilation of the previous function.
aggregate_value_p uses call_used_regs.  aggregate_value_p is used by
IPA and return value optimization, which are called before
ix86_maybe_switch_abi is called.  This patch merges ix86_maybe_switch_abi
with ix86_set_current_function.

Backport from mainline:

        PR target/67850
        * config/i386/i386.c (ix86_maybe_switch_abi): Merged with ...
        (ix86_set_current_function): This.
        (TARGET_EXPAND_TO_RTL_HOOK): Removed.

Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/config/i386/i386.c


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/67850] Wrong call_used_regs used in aggregate_value_p
  2015-10-05 13:04 [Bug middle-end/67850] New: Wrong call_used_regs used in aggregate_value_p hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2015-10-12 12:26 ` hjl at gcc dot gnu.org
@ 2015-10-12 12:48 ` hjl.tools at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2015-10-12 12:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67850

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.3

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for 5.3 and 6. No plan to backpor it to 4.9.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-12 12:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-05 13:04 [Bug middle-end/67850] New: Wrong call_used_regs used in aggregate_value_p hjl.tools at gmail dot com
2015-10-05 13:35 ` [Bug middle-end/67850] " hjl.tools at gmail dot com
2015-10-07 10:30 ` [Bug target/67850] " hjl at gcc dot gnu.org
2015-10-12 12:26 ` hjl at gcc dot gnu.org
2015-10-12 12:48 ` hjl.tools at gmail dot com

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).