public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/67312] New: [6 Regression] ICE: SIGSEGV in expand_expr_real_1 (expr.c:9561) with -ftree-coalesce-vars
@ 2015-08-21 18:39 zsojka at seznam dot cz
  2015-08-25  8:27 ` [Bug tree-optimization/67312] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zsojka at seznam dot cz @ 2015-08-21 18:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67312
           Summary: [6 Regression] ICE: SIGSEGV in expand_expr_real_1
                    (expr.c:9561) with -ftree-coalesce-vars
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---

Created attachment 36235
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36235&action=edit
reduced testcase

Compiler output:
$ gcc -ftree-coalesce-vars testcase.c -wrapper valgrind,-q
==23677== Invalid read of size 2
==23677==    at 0x81C88A: expand_expr_real_1(tree_node*, rtx_def*,
machine_mode, expand_modifier, rtx_def**, bool) (expr.c:9561)
==23677==    by 0x82FA16: expand_expr (expr.h:255)
==23677==    by 0x82FA16: expand_assignment(tree_node*, tree_node*, bool)
(expr.c:5101)
==23677==    by 0x706988: expand_gimple_stmt_1 (cfgexpand.c:3599)
==23677==    by 0x706988: expand_gimple_stmt(gimple_statement_base*)
(cfgexpand.c:3695)
==23677==    by 0x708C88: expand_gimple_basic_block(basic_block_def*, bool)
(cfgexpand.c:5698)
==23677==    by 0x70F5A6: (anonymous
namespace)::pass_expand::execute(function*) (cfgexpand.c:6284)
==23677==    by 0xA3D491: execute_one_pass(opt_pass*) (passes.c:2319)
==23677==    by 0xA3D955: execute_pass_list_1(opt_pass*) [clone .constprop.79]
(passes.c:2372)
==23677==    by 0xA3D9A8: execute_pass_list(function*, opt_pass*)
(passes.c:2383)
==23677==    by 0x743AC7: cgraph_node::expand() (cgraphunit.c:1920)
==23677==    by 0x7449F2: output_in_order(bool) (cgraphunit.c:2158)
==23677==    by 0x744DDB: symbol_table::compile() [clone .part.50]
(cgraphunit.c:2403)
==23677==    by 0x747597: compile (cgraphunit.c:2473)
==23677==    by 0x747597: symbol_table::finalize_compilation_unit()
(cgraphunit.c:2496)
==23677==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==23677== 
testcase.c: In function 'foo':
testcase.c:3:7: internal compiler error: Segmentation fault
     y = x;
       ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r227052 - ICE
5 branch r225803 - OK


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

* [Bug tree-optimization/67312] [6 Regression] ICE: SIGSEGV in expand_expr_real_1 (expr.c:9561) with -ftree-coalesce-vars
  2015-08-21 18:39 [Bug tree-optimization/67312] New: [6 Regression] ICE: SIGSEGV in expand_expr_real_1 (expr.c:9561) with -ftree-coalesce-vars zsojka at seznam dot cz
@ 2015-08-25  8:27 ` rguenth at gcc dot gnu.org
  2015-09-01 12:05 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-08-25  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |6.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
We shouldn't do coalesce-vars at -O0 I think.


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

* [Bug tree-optimization/67312] [6 Regression] ICE: SIGSEGV in expand_expr_real_1 (expr.c:9561) with -ftree-coalesce-vars
  2015-08-21 18:39 [Bug tree-optimization/67312] New: [6 Regression] ICE: SIGSEGV in expand_expr_real_1 (expr.c:9561) with -ftree-coalesce-vars zsojka at seznam dot cz
  2015-08-25  8:27 ` [Bug tree-optimization/67312] " rguenth at gcc dot gnu.org
@ 2015-09-01 12:05 ` mpolacek at gcc dot gnu.org
  2015-09-02  5:33 ` aoliva at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-09-01 12:05 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-09-01
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1


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

* [Bug tree-optimization/67312] [6 Regression] ICE: SIGSEGV in expand_expr_real_1 (expr.c:9561) with -ftree-coalesce-vars
  2015-08-21 18:39 [Bug tree-optimization/67312] New: [6 Regression] ICE: SIGSEGV in expand_expr_real_1 (expr.c:9561) with -ftree-coalesce-vars zsojka at seznam dot cz
  2015-08-25  8:27 ` [Bug tree-optimization/67312] " rguenth at gcc dot gnu.org
  2015-09-01 12:05 ` mpolacek at gcc dot gnu.org
@ 2015-09-02  5:33 ` aoliva at gcc dot gnu.org
  2015-09-27  9:02 ` aoliva at gcc dot gnu.org
  2015-09-28  1:16 ` aoliva at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: aoliva at gcc dot gnu.org @ 2015-09-02  5:33 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |aoliva at gcc dot gnu.org

--- Comment #2 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Mine.  The patch in the git branch aoliva/pr64164 fixes this problem (and
revamps the integration between cfgexpand and assign_params).  I'll post it
soon.


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

* [Bug tree-optimization/67312] [6 Regression] ICE: SIGSEGV in expand_expr_real_1 (expr.c:9561) with -ftree-coalesce-vars
  2015-08-21 18:39 [Bug tree-optimization/67312] New: [6 Regression] ICE: SIGSEGV in expand_expr_real_1 (expr.c:9561) with -ftree-coalesce-vars zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2015-09-02  5:33 ` aoliva at gcc dot gnu.org
@ 2015-09-27  9:02 ` aoliva at gcc dot gnu.org
  2015-09-28  1:16 ` aoliva at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: aoliva at gcc dot gnu.org @ 2015-09-27  9:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Author: aoliva
Date: Sun Sep 27 09:02:00 2015
New Revision: 228175

URL: https://gcc.gnu.org/viewcvs?rev=228175&root=gcc&view=rev
Log:
revert to assign_parms assignments using default defs

Revert the fragile and complicated changes to assign_parms designed to
enable it to use RTL assigments chosen by cfgexpand, and instead have
cfgexpand use the RTL assignments by assign_parms, keying them off of
the default defs that are now necessarily introduced for each parm and
result.  The possible lack of a default def was already a problem, and
the fallbacks in place were not enough, as shown by PR67312.  We now
have checking asserts in set_rtl that verify that we're assigning to
each var a piece of RTL that matches the expectations set forth by
use_register_for_decl.

for  gcc/ChangeLog

        PR rtl-optimization/64164
        PR tree-optimization/67312
        PR middle-end/67340
        PR middle-end/67490
        PR bootstrap/67597
        * cfgexpand.c (parm_in_stack_slot_p): Remove.
        (ssa_default_def_partition): Remove.
        (get_rtl_for_parm_ssa_default_def): Remove.
        (set_rtl): Check that RTL assignments match expectations.
        Loop on SUBREGs, CONCATs and PARALLELs subexprs.  Set only the
        default def location for params and results.  Record SSA names
        or types in REG and MEM attrs, respectively.
        (set_parm_rtl): New.
        (expand_one_ssa_partition): Drop logic that assigned MEMs with
        unassigned addresses.
        (adjust_one_expanded_partition_var): Don't accept NULL RTL on
        deferred stack alloc vars.
        (expand_used_vars): Skip partitions holding parm default defs.
        Move adjust_one_expanded_partition_var loop...
        (pass_expand::execute): ... here.  Drop redundant assert.
        Adjust comments before the final loop over all ssa names.
        Require assigned rtl of parms and results to match exactly.
        Reset its attributes to match them, not any other variables in
        the same partition.
        (expand_debug_expr): Use entry value for PARM's default defs
        only iff they have zero nondebug uses.
        * cfgexpand.h (parm_in_stack_slot_p): Remove.
        (get_rtl_for_parm_ssa_default_def): Remove.
        (set_parm_rtl): Declare.
        * doc/invoke.texi: Improve wording.
        * explow.c (promote_decl_mode): Fix promote_function_mode for
        result decls not by reference.
        (promote_ssa_mode): Disregard BLKmode from promote_decl, and
        bypass TYPE_MODE to get the actual vector mode.
        * function.c: Include tree-dfa.h.  Revert 2015-08-14's and
        2015-08-19's changes as follows.  Drop include of
        basic-block.h and df.h.
        (rtl_for_parm): Remove.
        (maybe_reset_rtl_for_parm): Remove.
        (parm_in_unassigned_mem_p): Remove.
        (use_register_for_decl): Add logic for RESULT_DECLs matching
        assign_parms' behavior.
        (split_complex_args): Revert.
        (assign_parms_augmented_arg_list): Revert.  Add comment
        referencing the logic above.
        (assign_parm_adjust_stack_rtl): Revert.
        (assign_parm_setup_block): Revert.  Use set_parm_rtl instead
        of SET_DECL_RTL.  Set up a REG if the parm demands so.
        (assign_parm_setup_reg): Revert.  Consolidated SET_DECL_RTL
        calls into a single set_parm_rtl.  Set up a temporary RTL
        temporarily for expand_assignment.
        (assign_parm_setup_stack): Revert.  Use set_parm_rtl.
        (assign_parms_unsplit_complex): Revert.  Use set_parm_rtl.
        (assign_bounds): Revert.
        (assign_parms): Revert.  Use set_parm_rtl.
        (allocate_struct_function): Relayout result and parms of
        non-abstruct functions.
        (expand_function_start): Revert.  Use set_parm_rtl.  If the
        result is not a hard reg, create a pseudo from the promoted
        mode of the default def.  Promote static chain mode.
        * tree-outof-ssa.c (remove_ssa_form): Drop unused
        partition_has_default_def.  Set up
        partitions_for_parm_default_defs.
        (finish_out_of_ssa): Remove partition_has_default_def.
        Release partitions_for_parm_default_defs.
        * tree-outof-ssa.h (struct ssaexpand): Remove
        partition_has_default_def.  Add
        partitions_for_parm_default_defs.
        * tree-ssa-coalesce.c: Include tree-dfa.h, tm_p.h and
        stor-layout.h.
        (build_ssa_conflict_graph): Fix conflict-detection of default
        defs of even unused default defs of params and results.
        (for_all_parms): New.
        (create_default_def): New.
        (register_default_def): New.
        (coalesce_with_default): New.
        (create_outofssa_var_map): Create default defs for all parms
        and results, and register their partitions.  Add GIMPLE_RETURN
        operands as coalesce candidates with results.  Add default
        defs of each parm or result as coalesce candidates with its
        other defs.  Mark each result def, and each default def of
        parms, as used_in_copy.
        (gimple_can_coalesce_p): Call it.  Call use_register_for_decl
        with the ssa names, even anonymous ones.  Drop
        parm_in_stack_slot_p calls.  Require same signedness and
        alignment.
        (coalesce_ssa_name): Add coalesce candidates for all defs of
        each parm and result, even unused ones.
        (parm_default_def_partition_arg): New type.
        (set_parm_default_def_partition): New.
        (get_parm_default_def_partitions): New.
        * tree-ssa-coalesce.h (get_parm_default_def_partitions): New.
        * tree-ssa-live.c (partition_view_init): Regard unused defs of
        parms and results as used.
        (verify_live_on_entry): Don't error out just because they're
        not live.

for  gcc/testsuite/ChangeLog

        PR rtl-optimization/64164
        PR tree-optimization/67312
        * gcc.dg/pr67312.c: New.  From Zdenek Sojka.
        * gcc.target/i386/stackalign/return-4.c: Add -O.

Added:
    trunk/gcc/testsuite/gcc.dg/pr67312.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgexpand.c
    trunk/gcc/cfgexpand.h
    trunk/gcc/doc/invoke.texi
    trunk/gcc/explow.c
    trunk/gcc/function.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/i386/stackalign/return-4.c
    trunk/gcc/tree-outof-ssa.c
    trunk/gcc/tree-outof-ssa.h
    trunk/gcc/tree-ssa-coalesce.c
    trunk/gcc/tree-ssa-coalesce.h
    trunk/gcc/tree-ssa-live.c


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

* [Bug tree-optimization/67312] [6 Regression] ICE: SIGSEGV in expand_expr_real_1 (expr.c:9561) with -ftree-coalesce-vars
  2015-08-21 18:39 [Bug tree-optimization/67312] New: [6 Regression] ICE: SIGSEGV in expand_expr_real_1 (expr.c:9561) with -ftree-coalesce-vars zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2015-09-27  9:02 ` aoliva at gcc dot gnu.org
@ 2015-09-28  1:16 ` aoliva at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: aoliva at gcc dot gnu.org @ 2015-09-28  1:16 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Fixed


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

end of thread, other threads:[~2015-09-28  1:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-21 18:39 [Bug tree-optimization/67312] New: [6 Regression] ICE: SIGSEGV in expand_expr_real_1 (expr.c:9561) with -ftree-coalesce-vars zsojka at seznam dot cz
2015-08-25  8:27 ` [Bug tree-optimization/67312] " rguenth at gcc dot gnu.org
2015-09-01 12:05 ` mpolacek at gcc dot gnu.org
2015-09-02  5:33 ` aoliva at gcc dot gnu.org
2015-09-27  9:02 ` aoliva at gcc dot gnu.org
2015-09-28  1:16 ` aoliva at gcc dot gnu.org

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