Bug 22100 - [4.1 regression] internal compiler error: in tree_verify_flow_info
Summary: [4.1 regression] internal compiler error: in tree_verify_flow_info
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Jan Hubicka
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2005-06-17 06:00 UTC by Francois-Xavier Coudert
Modified: 2005-07-01 20:02 UTC (History)
6 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.0
Known to fail: 4.1.0
Last reconfirmed: 2005-06-18 10:42:10


Attachments
Test case (needs -O3), can probably be reduced further (389 bytes, text/plain)
2005-06-19 16:17 UTC, Falk Hueffner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2005-06-17 06:00:18 UTC
$ ./bin/gfortran -static gcc/gcc/testsuite/gfortran.dg/pr19657.f -O2 && ./a.out
$ ./bin/gfortran -static gcc/gcc/testsuite/gfortran.dg/pr19657.f -O3
gcc/gcc/testsuite/gfortran.dg/pr19657.f: In function ‘MAIN__’:
gcc/gcc/testsuite/gfortran.dg/pr19657.f:11: internal compiler error: in
tree_verify_flow_info, at tree-cfg.c:3716

Appeared on i386-linux, i686-freebsd and x86_64-linux between 20050615 and
20050616. Same thing happens with gfortran.dg/select_2.f90; no patch was
committed in the fortran directory during these two days.
Comment 1 Steven Bosscher 2005-06-18 10:42:10 UTC
Investigating... 
Comment 2 Giovanni Bajo 2005-06-18 10:43:13 UTC
Confirmed. Not fixed by RTH's recent patch to fix vectorizer failures, but 
still most likely related to Honza's patch to kill RBI.
Comment 3 Steven Bosscher 2005-06-18 11:34:26 UTC
Honza messed up. 
Comment 4 Priit Laes 2005-06-19 09:54:27 UTC
It happened with me on 20050618 snapshot bootstrap.
It didn't happen on 20050611

stage1/xgcc -Bstage1/ -B/usr/i686-pc-linux-gnu/bin/ -c   -O2 -march=pentium3
-pipe -fprofile-generate -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros
-Wold-style-definition     -DHAVE_CONFIG_H    -I. -I.
-I/var/tmp/portage/gcc-4.1.0_beta20050618/work/gcc-4.1-20050618/gcc
-I/var/tmp/portage/gcc-4.1.0_beta20050618/work/gcc-4.1-20050618/gcc/.
-I/var/tmp/portage/gcc-4.1.0_beta20050618/work/gcc-4.1-20050618/gcc/../include
-I/var/tmp/portage/gcc-4.1.0_beta20050618/work/gcc-4.1-20050618/gcc/../libcpp/include
 /var/tmp/portage/gcc-4.1.0_beta20050618/work/gcc-4.1-20050618/gcc/sdbout.c -o
sdbout.o
stage1/xgcc -Bstage1/ -B/usr/i686-pc-linux-gnu/bin/ -c   -O2 -march=pentium3
-pipe -fprofile-generate -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros
-Wold-style-definition     -DHAVE_CONFIG_H    -I. -I.
-I/var/tmp/portage/gcc-4.1.0_beta20050618/work/gcc-4.1-20050618/gcc
-I/var/tmp/portage/gcc-4.1.0_beta20050618/work/gcc-4.1-20050618/gcc/.
-I/var/tmp/portage/gcc-4.1.0_beta20050618/work/gcc-4.1-20050618/gcc/../include
-I/var/tmp/portage/gcc-4.1.0_beta20050618/work/gcc-4.1-20050618/gcc/../libcpp/include
 /var/tmp/portage/gcc-4.1.0_beta20050618/work/gcc-4.1-20050618/gcc/simplify-rtx.c
-o simplify-rtx.o
/var/tmp/portage/gcc-4.1.0_beta20050618/work/gcc-4.1-20050618/gcc/simplify-rtx.c:
In function 'simplify_const_binary_operation':
/var/tmp/portage/gcc-4.1.0_beta20050618/work/gcc-4.1-20050618/gcc/simplify-rtx.c:2073:
internal compiler error: in tree_verify_flow_info, at tree-cfg.c:3716
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
make[2]: *** [simplify-rtx.o] Error 1
make[2]: Leaving directory `/var/tmp/portage/gcc-4.1.0_beta20050618/work/build/gcc'
make[1]: *** [stageprofile_build] Error 2
make[1]: Leaving directory `/var/tmp/portage/gcc-4.1.0_beta20050618/work/build/gcc'
make: *** [profiledbootstrap] Error 2
Comment 5 Falk Hueffner 2005-06-19 16:17:53 UTC
Created attachment 9113 [details]
Test case (needs -O3), can probably be reduced further
Comment 6 Jan Hubicka 2005-06-19 16:58:48 UTC
Subject: Re:  [4.1 regression] internal compiler error: in tree_verify_flow_info

Hi,
this is patch I am testing...

2005-06-19  Jan Hubicka  <jh@suse.cz>
	* cfgloop.h (DLTHE_RECORD_COPY_NUMBER): New flag.
	* cfgloopmanip.c (duplicate_loop_to_header_edge): Set aux flags only
	when asked for.
	* loop-unroll.c (peel_loop_completely, unroll_loop_constant_iterations,
	unroll_loop_runtime_iterations, peel_loop_simple, unroll_loop_stupid):
	Update call of duplicate_loop_to_header_edge.
	(apply_opt_in_copies): Clear out aux pointers.

Index: cfgloop.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgloop.h,v
retrieving revision 1.46
diff -c -3 -p -r1.46 cfgloop.h
*** cfgloop.h	2 Jun 2005 10:19:12 -0000	1.46
--- cfgloop.h	19 Jun 2005 14:47:09 -0000
*************** extern bool can_duplicate_loop_p (struct
*** 296,301 ****
--- 296,303 ----
  
  #define DLTHE_FLAG_UPDATE_FREQ	1	/* Update frequencies in
  					   duplicate_loop_to_header_edge.  */
+ #define DLTHE_RECORD_COPY_NUMBER 2	/* Record copy number in the aux
+ 					   field of newly create BB.  */
  
  extern struct loop * duplicate_loop (struct loops *, struct loop *,
  				     struct loop *);
Index: cfgloopmanip.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgloopmanip.c,v
retrieving revision 1.48
diff -c -3 -p -r1.48 cfgloopmanip.c
*** cfgloopmanip.c	15 Jun 2005 23:05:19 -0000	1.48
--- cfgloopmanip.c	19 Jun 2005 14:47:09 -0000
*************** duplicate_loop_to_header_edge (struct lo
*** 982,992 ****
        /* Copy bbs.  */
        copy_bbs (bbs, n, new_bbs, spec_edges, 2, new_spec_edges, loop);
  
!       for (i = 0; i < n; i++)
! 	{
! 	  gcc_assert (!new_bbs[i]->aux);
! 	  new_bbs[i]->aux = (void *)(size_t)(j + 1);
! 	}
  
        /* Note whether the blocks and edges belong to an irreducible loop.  */
        if (add_irreducible_flag)
--- 982,993 ----
        /* Copy bbs.  */
        copy_bbs (bbs, n, new_bbs, spec_edges, 2, new_spec_edges, loop);
  
!       if (flags & DLTHE_RECORD_COPY_NUMBER)
! 	for (i = 0; i < n; i++)
! 	  {
! 	    gcc_assert (!new_bbs[i]->aux);
! 	    new_bbs[i]->aux = (void *)(size_t)(j + 1);
! 	  }
  
        /* Note whether the blocks and edges belong to an irreducible loop.  */
        if (add_irreducible_flag)
Index: loop-unroll.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop-unroll.c,v
retrieving revision 1.34
diff -c -3 -p -r1.34 loop-unroll.c
*** loop-unroll.c	15 Jun 2005 23:05:22 -0000	1.34
--- loop-unroll.c	19 Jun 2005 14:47:09 -0000
*************** peel_loop_completely (struct loops *loop
*** 519,525 ****
  					  loops, npeel,
  					  wont_exit, desc->out_edge,
  					  remove_edges, &n_remove_edges,
! 					  DLTHE_FLAG_UPDATE_FREQ);
        gcc_assert (ok);
  
        free (wont_exit);
--- 519,527 ----
  					  loops, npeel,
  					  wont_exit, desc->out_edge,
  					  remove_edges, &n_remove_edges,
! 					  DLTHE_FLAG_UPDATE_FREQ
! 					  | (opt_info
! 					     ? DLTHE_RECORD_COPY_NUMBER : 0));
        gcc_assert (ok);
  
        free (wont_exit);
*************** unroll_loop_constant_iterations (struct 
*** 717,723 ****
  					      loops, exit_mod,
  					      wont_exit, desc->out_edge,
  					      remove_edges, &n_remove_edges,
! 					      DLTHE_FLAG_UPDATE_FREQ);
  	  gcc_assert (ok);
  
            if (opt_info && exit_mod > 1)
--- 719,728 ----
  					      loops, exit_mod,
  					      wont_exit, desc->out_edge,
  					      remove_edges, &n_remove_edges,
! 					      DLTHE_FLAG_UPDATE_FREQ
! 					      | (opt_info && exit_mod > 1
! 						 ? DLTHE_RECORD_COPY_NUMBER
! 						   : 0));
  	  gcc_assert (ok);
  
            if (opt_info && exit_mod > 1)
*************** unroll_loop_constant_iterations (struct 
*** 753,759 ****
  					      loops, exit_mod + 1,
  					      wont_exit, desc->out_edge,
  					      remove_edges, &n_remove_edges,
! 					      DLTHE_FLAG_UPDATE_FREQ);
  	  gcc_assert (ok);
   
            if (opt_info && exit_mod > 0)
--- 758,767 ----
  					      loops, exit_mod + 1,
  					      wont_exit, desc->out_edge,
  					      remove_edges, &n_remove_edges,
! 					      DLTHE_FLAG_UPDATE_FREQ
! 					      | (opt_info && exit_mod > 0
! 						 ? DLTHE_RECORD_COPY_NUMBER
! 						   : 0));
  	  gcc_assert (ok);
   
            if (opt_info && exit_mod > 0)
*************** unroll_loop_constant_iterations (struct 
*** 777,783 ****
  				      loops, max_unroll,
  				      wont_exit, desc->out_edge,
  				      remove_edges, &n_remove_edges,
! 				      DLTHE_FLAG_UPDATE_FREQ);
    gcc_assert (ok);
  
    if (opt_info)
--- 785,794 ----
  				      loops, max_unroll,
  				      wont_exit, desc->out_edge,
  				      remove_edges, &n_remove_edges,
! 				      DLTHE_FLAG_UPDATE_FREQ
! 				      | (opt_info
! 					 ? DLTHE_RECORD_COPY_NUMBER
! 					   : 0));
    gcc_assert (ok);
  
    if (opt_info)
*************** unroll_loop_runtime_iterations (struct l
*** 1097,1103 ****
  				      loops, max_unroll,
  				      wont_exit, desc->out_edge,
  				      remove_edges, &n_remove_edges,
! 				      DLTHE_FLAG_UPDATE_FREQ);
    gcc_assert (ok);
    
    if (opt_info)
--- 1108,1117 ----
  				      loops, max_unroll,
  				      wont_exit, desc->out_edge,
  				      remove_edges, &n_remove_edges,
! 				      DLTHE_FLAG_UPDATE_FREQ
! 				      | (opt_info
! 					 ? DLTHE_RECORD_COPY_NUMBER
! 					   : 0));
    gcc_assert (ok);
    
    if (opt_info)
*************** peel_loop_simple (struct loops *loops, s
*** 1274,1280 ****
    ok = duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop),
  				      loops, npeel, wont_exit,
  				      NULL, NULL,
! 				      NULL, DLTHE_FLAG_UPDATE_FREQ);
    gcc_assert (ok);
  
    free (wont_exit);
--- 1288,1297 ----
    ok = duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop),
  				      loops, npeel, wont_exit,
  				      NULL, NULL,
! 				      NULL, DLTHE_FLAG_UPDATE_FREQ
! 				      | (opt_info
! 					 ? DLTHE_RECORD_COPY_NUMBER
! 					   : 0));
    gcc_assert (ok);
  
    free (wont_exit);
*************** unroll_loop_stupid (struct loops *loops,
*** 1422,1428 ****
    ok = duplicate_loop_to_header_edge (loop, loop_latch_edge (loop),
  				      loops, nunroll, wont_exit,
  				      NULL, NULL, NULL,
! 				      DLTHE_FLAG_UPDATE_FREQ);
    gcc_assert (ok);
    
    if (opt_info)
--- 1439,1448 ----
    ok = duplicate_loop_to_header_edge (loop, loop_latch_edge (loop),
  				      loops, nunroll, wont_exit,
  				      NULL, NULL, NULL,
! 				      DLTHE_FLAG_UPDATE_FREQ
! 				      | (opt_info
! 					 ? DLTHE_RECORD_COPY_NUMBER
! 					   : 0));
    gcc_assert (ok);
    
    if (opt_info)
*************** apply_opt_in_copies (struct opt_info *op
*** 2064,2069 ****
--- 2084,2090 ----
  	 duplicate_loop_to_header_edge.  */
        delta = determine_split_iv_delta ((size_t)bb->aux, n_copies,
  					unrolling);
+       bb->aux = 0;
        orig_insn = BB_HEAD (orig_bb);
        for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); insn = next)
          {
Comment 7 Andrew Pinski 2005-06-19 17:01:37 UTC
*** Bug 22122 has been marked as a duplicate of this bug. ***
Comment 8 Andrew Pinski 2005-06-19 17:02:10 UTC
See PR 22122 for C testcase and with -ftree-vectorize.
Comment 9 Andrew Pinski 2005-06-19 23:16:50 UTC
Patch was posted here: <http://gcc.gnu.org/ml/gcc-patches/2005-06/msg01649.html>.
Comment 10 Andrew Pinski 2005-07-01 20:02:51 UTC
Fixed.