[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2015-03-05 Thread yroux at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

--- Comment #12 from Yvan Roux  ---
Author: yroux
Date: Thu Mar  5 14:28:05 2015
New Revision: 221216

URL: https://gcc.gnu.org/viewcvs?rev=221216&root=gcc&view=rev
Log:
gcc/
2015-03-05  Yvan Roux  

Backport from trunk r212011, r214942, r214957, r215012, r215016, r218115,
r218733, r218746, r220491.
2015-02-06  Sebastian Pop  
Brian Rzycki  

PR tree-optimization/64878
* tree-ssa-threadedge.c: Include tree-ssa-loop.h.
(fsm_find_control_statement_thread_paths): Add parameter seen_loop_phi.
Stop recursion at loop phi nodes after having visited a loop phi node.

2014-12-15  Richard Biener  

PR middle-end/64246
* cfgloop.c (mark_loop_for_removal): Make safe against multiple
invocations on the same loop.

2014-12-15  Richard Biener  

PR tree-optimization/64284
* tree-ssa-threadupdate.c (duplicate_seme_region): Mark
the loop for removal if we copied the loop header.

2014-11-27  Richard Biener  

PR tree-optimization/64083
* tree-ssa-threadupdate.c (thread_through_all_blocks): Do not
forcibly mark loop for removal the wrong way.

2014-09-08  Richard Biener  

PR ipa/63196
* tree-inline.c (copy_loops): The source loop header should
always be non-NULL.
(tree_function_versioning): If loops need fixup after removing
unreachable blocks fix them.
* omp-low.c (simd_clone_adjust): Do not add incr block to
loop under construction.

2014-09-08  Richard Biener  

PR bootstrap/63204
* cfgloop.c (mark_loop_for_removal): Track former header
unconditionally.
* cfgloop.h (struct loop): Add former_header member unconditionally.
* loop-init.c (fix_loop_structure): Enable bogus loop removal
diagnostic unconditionally.

2014-09-05  Richard Biener  

* cfgloop.c (mark_loop_for_removal): Record former header
when ENABLE_CHECKING.
* cfgloop.h (strut loop): Add former_header member when
ENABLE_CHECKING.
* loop-init.c (fix_loop_structure): Sanity check loops
marked for removal if they re-appeared.

2014-09-05  Richard Biener  

* cfgloop.c (mark_loop_for_removal): New function.
* cfgloop.h (mark_loop_for_removal): Declare.
* cfghooks.c (delete_basic_block): Use mark_loop_for_removal.
(merge_blocks): Likewise.
(duplicate_block): Likewise.
* except.c (sjlj_emit_dispatch_table): Likewise.
* tree-eh.c (cleanup_empty_eh_merge_phis): Likewise.
* tree-ssa-threadupdate.c (ssa_redirect_edges): Likewise.
(thread_through_loop_header): Likewise.

2014-06-26  Richard Biener  

PR tree-optimization/61607
* tree-ssa-threadupdate.c (ssa_redirect_edges): Cancel the
loop if we redirected its latch edge.
(thread_block_1): Do not cancel loops prematurely.

gcc/testsuite/
2015-03-05  Yvan Roux  

Backport from trunk r218115, r218733, r218746, r220491.
2015-02-06  Sebastian Pop  
Brian Rzycki  

PR tree-optimization/64878
* testsuite/gcc.dg/tree-ssa/ssa-dom-thread-8.c: New.

2014-12-15  Richard Biener  

PR middle-end/64246
* gnat.dg/opt46.adb: New testcase.
* gnat.dg/opt46.ads: Likewise.
* gnat.dg/opt46_pkg.adb: Likewise.
* gnat.dg/opt46_pkg.ads: Likewise.

2014-12-15  Richard Biener  

PR tree-optimization/64284
* gcc.dg/torture/pr64284.c: New testcase.

2014-11-27  Richard Biener  

PR tree-optimization/64083
* gcc.dg/torture/pr64083.c: New testcase.


Added:
branches/linaro/gcc-4_9-branch/gcc/testsuite/gcc.dg/torture/pr64083.c
branches/linaro/gcc-4_9-branch/gcc/testsuite/gcc.dg/torture/pr64284.c
   
branches/linaro/gcc-4_9-branch/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-8.c
branches/linaro/gcc-4_9-branch/gcc/testsuite/gnat.dg/opt46.adb
branches/linaro/gcc-4_9-branch/gcc/testsuite/gnat.dg/opt46.ads
branches/linaro/gcc-4_9-branch/gcc/testsuite/gnat.dg/opt46_pkg.adb
branches/linaro/gcc-4_9-branch/gcc/testsuite/gnat.dg/opt46_pkg.ads
Modified:
branches/linaro/gcc-4_9-branch/gcc/ChangeLog.linaro
branches/linaro/gcc-4_9-branch/gcc/cfghooks.c
branches/linaro/gcc-4_9-branch/gcc/cfgloop.c
branches/linaro/gcc-4_9-branch/gcc/cfgloop.h
branches/linaro/gcc-4_9-branch/gcc/except.c
branches/linaro/gcc-4_9-branch/gcc/loop-init.c
branches/linaro/gcc-4_9-branch/gcc/omp-low.c
branches/linaro/gcc-4_9-branch/gcc/testsuite/ChangeLog.linaro
branches/linaro/gcc-4_9-branch/gcc/tree-eh.c
branches/linaro/gcc-4_9-branch/gcc/tree-inline.c
branches/linaro/gcc-4_9-branch/gcc/tree-ssa-threadedge.c
branches/linaro/gcc-4_9-branch/gcc/tree-ssa-threadupdate.c


[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2014-12-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

--- Comment #11 from Richard Biener  ---
Author: rguenth
Date: Mon Dec 15 12:20:10 2014
New Revision: 218746

URL: https://gcc.gnu.org/viewcvs?rev=218746&root=gcc&view=rev
Log:
2014-12-15  Richard Biener  

PR middle-end/64246
* cfgloop.c (mark_loop_for_removal): Make safe against multiple
invocations on the same loop.

* gnat.dg/opt46.adb: New testcase.
* gnat.dg/opt46.ads: Likewise.
* gnat.dg/opt46_pkg.adb: Likewise.
* gnat.dg/opt46_pkg.ads: Likewise.

Added:
trunk/gcc/testsuite/gnat.dg/opt46.adb
trunk/gcc/testsuite/gnat.dg/opt46.ads
trunk/gcc/testsuite/gnat.dg/opt46_pkg.adb
trunk/gcc/testsuite/gnat.dg/opt46_pkg.ads
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cfgloop.c
trunk/gcc/testsuite/ChangeLog


[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2014-12-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Richard Biener  ---
(In reply to Eric Botcazou from comment #9)
> Created attachment 34282 [details]
> Concatenated testcase for gnat.dg
> 
> To be gnatchop'ed and installed into the gnat.dg testsuite:
> 
> * gnat.dg/opt46.ad[sb]: New testcase.
> * gnat.dg/opt46_pkg.ad[sb]: New helper.

Thanks - fixed.


[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2014-12-15 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

--- Comment #9 from Eric Botcazou  ---
Created attachment 34282
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34282&action=edit
Concatenated testcase for gnat.dg

To be gnatchop'ed and installed into the gnat.dg testsuite:

* gnat.dg/opt46.ad[sb]: New testcase.
* gnat.dg/opt46_pkg.ad[sb]: New helper.


[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2014-12-15 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

--- Comment #8 from Eric Botcazou  ---
> Yes, but in suitable form for gnat.dg (not sure how I can do
> multi-file testcases there or which one would be the main one)

Most testcases are multi-file under gnat.dg...  I'm going to attach it.


[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2014-12-15 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

--- Comment #7 from rguenther at suse dot de  ---
On Mon, 15 Dec 2014, ebotcazou at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246
> 
> --- Comment #6 from Eric Botcazou  ---
> > I suppose extracting a testcase for this is too hard?
> 
> Do you mean a testcase like the one I attached on Friday?

Yes, but in suitable form for gnat.dg (not sure how I can do
multi-file testcases there or which one would be the main one)


[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2014-12-15 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

--- Comment #6 from Eric Botcazou  ---
> I suppose extracting a testcase for this is too hard?

Do you mean a testcase like the one I attached on Friday?


[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2014-12-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

--- Comment #5 from Richard Biener  ---
We should make mark_loop_for_removal more robust then, I am testing

Index: gcc/cfgloop.c
===
--- gcc/cfgloop.c   (revision 218733)
+++ gcc/cfgloop.c   (working copy)
@@ -1928,9 +1928,10 @@ bb_loop_depth (const_basic_block bb)
 void
 mark_loop_for_removal (loop_p loop)
 {
+  if (loop->header == NULL)
+return;
   loop->former_header = loop->header;
   loop->header = NULL;
   loop->latch = NULL;
   loops_state_set (LOOPS_NEED_FIXUP);
 }

I suppose extracting a testcase for this is too hard?


[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2014-12-12 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

--- Comment #4 from Eric Botcazou  ---
This happens only on i686-mingw32 because this requires SJLJ exceptions.  The
loop at stake is marked for removal during EH generation:

#0  mark_loop_for_removal (loop=0x76969ca8)
at /home/eric/svn/gcc/gcc/cfgloop.c:1933
#1  0x00da97e2 in sjlj_emit_dispatch_table (
dispatch_label=0x76a4cec0, num_dispatch=6)
at /home/eric/svn/gcc/gcc/except.c:1394
#2  0x00da9bbe in sjlj_build_landing_pads ()
at /home/eric/svn/gcc/gcc/except.c:1463
#3  0x00da9d2d in finish_eh_generation ()
at /home/eric/svn/gcc/gcc/except.c:1497
#4  0x00c7bd4c in (anonymous namespace)::pass_expand::execute (
this=0x39e6e60, fun=0x76924a80)
at /home/eric/svn/gcc/gcc/cfgexpand.c:6005

/* ???  For multiple dispatches we will end up with edges
   from the loop tree root into this loop, making it a
   multiple-entry loop.  Discard all affected loops.  */
if (num_dispatch > 1)
  {
for (loop = bb->loop_father;
 loop_outer (loop); loop = loop_outer (loop))
  mark_loop_for_removal (loop);
  }

but it is marked *twice* so loop->former_header is cleared the second time:

void
mark_loop_for_removal (loop_p loop)
{
  loop->former_header = loop->header;
  loop->header = NULL;
  loop->latch = NULL;
  loops_state_set (LOOPS_NEED_FIXUP);
}

The ICE occurs immediately after:

#0  internal_error (gmsgid=0x2ea5d27 "in %s, at %s:%d")
at /home/eric/svn/gcc/gcc/diagnostic.c:1219
#1  0x028a1772 in fancy_abort (
file=0x2a09ca0 "/home/eric/svn/gcc/gcc/loop-init.c", line=263, 
function=0x2a0a100 
"fix_loop_structure") at /home/eric/svn/gcc/gcc/diagnostic.c:1275
#2  0x0102a1cd in fix_loop_structure (changed_bbs=0x0)
at /home/eric/svn/gcc/gcc/loop-init.c:263
#3  0x026b48d9 in cleanup_cfg (mode=16)
at /home/eric/svn/gcc/gcc/cfgcleanup.c:3083


[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2014-12-12 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

--- Comment #3 from Eric Botcazou  ---
Created attachment 34269
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34269&action=edit
Concatenated testcase

To be gnatchop-ed and compile at -O.


[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2014-12-12 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

Eric Botcazou  changed:

   What|Removed |Added

 Status|WAITING |ASSIGNED
   Assignee|rguenth at gcc dot gnu.org |ebotcazou at gcc dot 
gnu.org

--- Comment #2 from Eric Botcazou  ---
Let me have a look first.


[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2014-12-10 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2014-12-10
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org
   Target Milestone|--- |5.0
 Ever confirmed|0   |1


[Bug middle-end/64246] [5 Regression] ICE building libada for Windows due to NULL loop header

2014-12-10 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246

--- Comment #1 from rguenther at suse dot de  ---
On Wed, 10 Dec 2014, matt at gwalski dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64246
> 
> Bug ID: 64246
>Summary: [5 Regression] ICE building libada for Windows due to
> NULL loop header
>Product: gcc
>Version: 5.0
> Status: UNCONFIRMED
>   Severity: major
>   Priority: P3
>  Component: middle-end
>   Assignee: unassigned at gcc dot gnu.org
>   Reporter: matt at gwalski dot com
> CC: rguenther at suse dot de
>   Host: x86_64-linux-gnu
> Target: i686-w64-mingw32
>  Build: x86_64-linux-gnu
> 
> Attempting to build trunk SVN version 218496 supporting C,C++, and Ada fails
> with the following:
> 
> /home/matt/buildgcc/./gcc/xgcc -B/home/matt/buildgcc/./gcc/
> -L/usr/local/i686-w64-mingw32/lib -L/usr/local/mingw/lib -isystem
> /usr/local/i686-w64-mingw32/include -isystem /usr/local/mingw/include
> -B/usr/local/i686-w64-mingw32/bin/ -B/usr/local/i686-w64-mingw32/lib/ -isystem
> /usr/local/i686-w64-mingw32/include -isystem
> /usr/local/i686-w64-mingw32/sys-include-c -g -O2   -W -Wall -gnatpg
> -nostdinc   g-awk.adb -o g-awk.o
> +===GNAT BUG DETECTED==+
> | 5.0.0 20141208 (experimental) (i686-w64-mingw32) GCC error:  |
> | in fix_loop_structure, at loop-init.c:263|
> | Error detected around g-awk.adb:727:8|
> | Please submit a bug report; see http://gcc.gnu.org/bugs.html.|
> | Use a subject line meaningful to you and us to track the bug.|
> | Include the entire contents of this bug box in the report.   |
> | Include the exact command that you entered.  |
> | Also include sources listed below.   |
> +==+
> 
> Please include these source files with error report
> Note that list may not be accurate in some cases,
> so please double check that the problem can still
> be reproduced with the set of files listed.
> Consider also -gnatd.n switch (see debug.adb).
> 
> system.ads
> g-awk.adb
> g-awk.ads
> gnat.ads
> ada.ads
> a-finali.ads
> s-finroo.ads
> g-regpat.ads
> s-regpat.ads
> a-except.ads
> s-parame.ads
> s-stalib.ads
> a-unccon.ads
> s-traent.ads
> a-textio.ads
> a-ioexce.ads
> a-stream.ads
> s-ficobl.ads
> interfac.ads
> i-cstrea.ads
> s-crtl.ads
> s-wchcon.ads
> a-string.ads
> a-strunb.ads
> a-strmap.ads
> a-charac.ads
> a-chlat1.ads
> s-atocou.ads
> a-strfix.ads
> a-uncdea.ads
> g-dirope.ads
> g-dyntab.ads
> g-os_lib.ads
> s-os_lib.ads
> s-string.ads
> s-exctab.ads
> a-tags.ads
> s-stoele.ads
> s-soflin.ads
> s-stache.ads
> s-finmas.ads
> s-stopoo.ads
> s-pooglo.ads
> s-unstyp.ads
> s-stratt.ads
> s-secsta.ads
> s-stposu.ads
> s-ststop.ads
> s-imgint.ads
> s-valint.ads
> s-valrea.ads
> g-dyntab.adb
> g-hesorg.ads
> s-memory.ads
> g-hesorg.adb
> s-stoele.adb
> 
> 
> raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:423
> make[4]: *** [g-awk.o] Error 1
> 
> It's hitting an assert added in r214957/r215012.
> 
> I've been able to bootstrap a x86_64-linux-gnu Ada compiler fine with a
> revision that fails for i686-w64-mingw32.
> 
> I believe I'm also seeing the error building a native i686-w64-mingw32
> (bootstrap or no bootstrap) Ada compiler.
> 
> Configuration options:
> configure --build=x86_64-linux-gnu --enable-shared --enable-static
> --disable-multilib --enable-threads=posix --enable-fully-dynamic-string
> --enable-sjlj-exceptions --enable-libgomp --enable-languages=c,c++,ada,lto
> --target=i686-w64-mingw32 --host=x86_64-linux-gnu

Ok, trying to compile a cross compiler to reproduce the above seems
to require target headers which I dont' have.  I've built the
ada compiler itself so can you please attach the files referenced above?