public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use
@ 2004-07-12  8:47 kapalka at icslab dot agh dot edu dot pl
  2004-07-12  8:50 ` [Bug rtl-optimization/16490] " kapalka at icslab dot agh dot edu dot pl
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: kapalka at icslab dot agh dot edu dot pl @ 2004-07-12  8:47 UTC (permalink / raw)
  To: gcc-bugs

Good morning,

I was compiling the ROOT v4.00.06a (root.cern.ch) on Itanium 2 platform, Linux
system with -fprofile-generate, I run a few benchmarks and next I tried to
re-compile the package with -fprofile-use. Unfortunately, the compilation
process stopped on the file "build/rmkdepend/parse.c" with the following error:

build/rmkdepend/parse.c: In function `undefine':
build/rmkdepend/parse.c:535: internal compiler error: Segmentation fault

To reproduce the bug, you should use the 2 files I'm enclosing with the bug
report. The command-line causing the error:

gcc -O2 -fprofile-use -fPIC -D_REENTRANT -c parse.i

However, even "gcc -O2 -fprofile-use -c parse.i" when the "parse.gcda" file is
NOT present gives the same error, obviously together with the information "file
parse.gcda not found, execution counts assumed to be zero".

My compiler version:
Reading specs from /opt/gcc3.4.1/lib/gcc/ia64-redhat-linux/3.4.1/specs
Configured with: ./configure --prefix=/opt/gcc3.4.1 --enable-shared
--enable-threads=posix --disable-checking --with-system-zlib
--enable-__cxa_atexit --host=ia64-redhat-linux --enable-languages=c,c++,f77
Thread model: posix
gcc version 3.4.1

Best regards,

Michal Kapalka

-- 
           Summary: segfault while compiling with -fprofile-use
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kapalka at icslab dot agh dot edu dot pl
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: ia64-redhat-linux
  GCC host triplet: ia64-redhat-linux
GCC target triplet: ia64-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

* [Bug rtl-optimization/16490] segfault while compiling with -fprofile-use
  2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
@ 2004-07-12  8:50 ` kapalka at icslab dot agh dot edu dot pl
  2004-07-12  8:51 ` kapalka at icslab dot agh dot edu dot pl
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: kapalka at icslab dot agh dot edu dot pl @ 2004-07-12  8:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kapalka at icslab dot agh dot edu dot pl  2004-07-12 08:50 -------
Created an attachment (id=6726)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6726&action=view)
the C source file


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

* [Bug rtl-optimization/16490] segfault while compiling with -fprofile-use
  2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
  2004-07-12  8:50 ` [Bug rtl-optimization/16490] " kapalka at icslab dot agh dot edu dot pl
@ 2004-07-12  8:51 ` kapalka at icslab dot agh dot edu dot pl
  2004-07-12 14:26 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: kapalka at icslab dot agh dot edu dot pl @ 2004-07-12  8:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kapalka at icslab dot agh dot edu dot pl  2004-07-12 08:51 -------
Created an attachment (id=6727)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6727&action=view)
the profile generated with -fprofile-generate


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

* [Bug rtl-optimization/16490] segfault while compiling with -fprofile-use
  2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
  2004-07-12  8:50 ` [Bug rtl-optimization/16490] " kapalka at icslab dot agh dot edu dot pl
  2004-07-12  8:51 ` kapalka at icslab dot agh dot edu dot pl
@ 2004-07-12 14:26 ` pinskia at gcc dot gnu dot org
  2004-08-05 15:26 ` belyshev at lubercy dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-12 14:26 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

* [Bug rtl-optimization/16490] segfault while compiling with -fprofile-use
  2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
                   ` (2 preceding siblings ...)
  2004-07-12 14:26 ` pinskia at gcc dot gnu dot org
@ 2004-08-05 15:26 ` belyshev at lubercy dot com
  2004-08-08  1:26 ` wilson at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: belyshev at lubercy dot com @ 2004-08-05 15:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From belyshev at lubercy dot com  2004-08-05 15:26 -------
small testcase, use "-O1 -funroll-loops -fvpt -fbranch-probabilities" :
------------------------------------------------------------------------------
void bar (int k)
{
  while (foo ())
    {
      while (k++ < 0)
	baz ();
    }
}
------------------------------------------------------------------------------

Program received signal SIGSEGV, Segmentation fault.
bitmap_operation (to=0xbfffec40, from1=0x0, from2=0x0, operation=BITMAP_XOR)
    at ../../gcc/gcc/bitmap.c:511
511       bitmap_element *from2_ptr = from2->first;
(gdb) where
#0  bitmap_operation (to=0xbfffec40, from1=0x0, from2=0x0, operation=BITMAP_XOR)
    at ../../gcc/gcc/bitmap.c:511
#1  0x0815e2f2 in init_propagate_block_info (bb=0x851ee28, live=0x0, local_set=0x0, 
    cond_local_set=0x0, flags=0) at ../../gcc/gcc/flow.c:1874
#2  0x0815e628 in propagate_block (bb=0x851ee28, live=0x851bcb8, local_set=0x0, 
    cond_local_set=0x0, flags=0) at ../../gcc/gcc/flow.c:2012
#3  0x080e5c32 in rtl_split_block (bb=0x851eef0, insnp=0xb7b997a0)
    at ../../gcc/gcc/cfgrtl.c:517
#4  0x080e8bf4 in cfg_layout_split_block (bb=0x0, insnp=0x0) at
../../gcc/gcc/cfgrtl.c:2420
#5  0x080e1814 in make_forwarder_block (bb=0x851eef0, redirect_latch=1,
redirect_nonlatch=0, 
    except=0x0, conn_latch=0) at ../../gcc/gcc/cfgloop.c:589
#6  0x080e1a84 in canonicalize_loop_headers () at ../../gcc/gcc/cfgloop.c:722
#7  0x080e1be9 in flow_loops_find (loops=0x8518514, flags=Variable "flags" is
not available.
) at ../../gcc/gcc/cfgloop.c:764
#8  0x082c4ef7 in loop_optimizer_init (dumpfile=0x0) at ../../gcc/gcc/loop-init.c:52
#9  0x08275912 in rest_of_handle_loop2 (decl=0x0, insns=0xb7b992e0)
    at ../../gcc/gcc/toplev.c:3074
#10 0x08276000 in rest_of_compilation (decl=0xb7ae8244) at
../../gcc/gcc/toplev.c:3364
#11 0x082b7214 in tree_rest_of_compilation (fndecl=0xb7ae8244, nested_p=false)
    at ../../gcc/gcc/tree-optimize.c:168
#12 0x0806b569 in c_expand_body_1 (fndecl=0xb7ae8244, nested_p=0)
    at ../../gcc/gcc/c-decl.c:6158
#13 0x0806b75d in c_expand_body (fndecl=0xb7ae8244) at ../../gcc/gcc/c-decl.c:6190
#14 0x082b96df in cgraph_expand_function (node=0xb7ae85e4) at
../../gcc/gcc/cgraphunit.c:538
#15 0x082b8ae3 in cgraph_assemble_pending_functions () at
../../gcc/gcc/cgraphunit.c:144
#16 0x082b8c04 in cgraph_finalize_function (decl=0xb7ae8244, nested=false)
    at ../../gcc/gcc/cgraphunit.c:225
#17 0x0806b451 in finish_function () at ../../gcc/gcc/c-decl.c:6115
#18 0x0804a806 in yyparse () at c-parse.y:385
#19 0x08052870 in c_parse_file () at c-parse.y:3029
#20 0x0809d425 in c_common_parse_file (set_yydebug=0) at ../../gcc/gcc/c-opts.c:1237
#21 0x082736c2 in compile_file () at ../../gcc/gcc/toplev.c:1822
#22 0x08277c5e in do_compile () at ../../gcc/gcc/toplev.c:4651
#23 0x08277cf3 in toplev_main (argc=0, argv=0xbffff8e4) at
../../gcc/gcc/toplev.c:4691
#24 0x080bc32c in main (argc=0, argv=0x0) at ../../gcc/gcc/main.c:35

Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
  GCC build triplet|ia64-redhat-linux           |
   GCC host triplet|ia64-redhat-linux           |
      Known to fail|                            |3.4.1 3.4.2
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-05 15:26:05
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

* [Bug rtl-optimization/16490] segfault while compiling with -fprofile-use
  2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
                   ` (4 preceding siblings ...)
  2004-08-08  1:26 ` wilson at gcc dot gnu dot org
@ 2004-08-08  1:26 ` wilson at gcc dot gnu dot org
  2004-08-11 20:05 ` cvs-commit at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: wilson at gcc dot gnu dot org @ 2004-08-08  1:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wilson at gcc dot gnu dot org  2004-08-08 01:26 -------
This dies in bitmap_operation because we were called with a block with a null
global_live_at_start field.  This happens during the loop2 pass, which is before
the life pass, so normally there shouldn't be any life info here.  However, the
value profiling pass does run life_analysis also, so if we are doing value
profiling, we will have life info starting with the branch_prob (bp) pass.

Since the cfg* routines check the global_live_at_start field of a block to
determine whether it should update life info, we either need to update this
field in all blocks once it is created, or else we need to eliminate the info
after we are done using it.  (Or alternatively, modify the tests used in the
cfg* routines, but I didn't seriously consider that alternative.)

The exact circumstances that cause the crash happen in loop_optimizer_init. 
First we have a call chain
  loop_optimizer_init
  split_edge
  cfglayout_split_edge
  create_basic_block
and now we have one basic block that does not have life info, while all others do.

Then we have the call chain
  loop_optimizer_init
  flow_loops_find
  canonicalize_loop_headers
  make_forwarder_block
  cfg_layout_split_block
  rtl_split_block
  propate_block
  init_propagate_block_info
  bitmap_operation
and we die because one block has life info and the other doesn't.

I see two ways to fix this.  We can zero out the life info when we are done with
the value profiling pass.  Or we can modify cfglayout_split_edge to set the
global_live_at_start field of the new basic block.  Since the rtl_split_edge
function already does this, this seems like a reasonable thing to do.

I can reproduce the same problem in gcc-3.5 using the parse.i file without the
parse.gcda file.  The call chain is a bit different, but it is the same problem,
and fixed with the same solution.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2004-08-05 15:26:05         |2004-08-08 01:26:12
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

* [Bug rtl-optimization/16490] segfault while compiling with -fprofile-use
  2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
                   ` (3 preceding siblings ...)
  2004-08-05 15:26 ` belyshev at lubercy dot com
@ 2004-08-08  1:26 ` wilson at gcc dot gnu dot org
  2004-08-08  1:26 ` wilson at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: wilson at gcc dot gnu dot org @ 2004-08-08  1:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wilson at gcc dot gnu dot org  2004-08-08 01:26 -------
IA-64.  Mine.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |wilson at gcc dot gnu dot
                   |dot org                     |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

* [Bug rtl-optimization/16490] segfault while compiling with -fprofile-use
  2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
                   ` (5 preceding siblings ...)
  2004-08-08  1:26 ` wilson at gcc dot gnu dot org
@ 2004-08-11 20:05 ` cvs-commit at gcc dot gnu dot org
  2004-08-11 20:08 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-11 20:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-11 20:05 -------
Subject: Bug 16490

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	wilson@gcc.gnu.org	2004-08-11 20:05:09

Modified files:
	gcc            : ChangeLog cfgrtl.c 

Log message:
	Fix -fprofile-use ICE.
	PR rtl-optimization/16490
	* cfgrtl.c (cfg_layout_split_edge): Set global_live_at_start and
	global_live_at_end for new basic block if already set for other blocks.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.576&r2=2.2326.2.577
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgrtl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.103.2.4&r2=1.103.2.5



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

* [Bug rtl-optimization/16490] segfault while compiling with -fprofile-use
  2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
                   ` (6 preceding siblings ...)
  2004-08-11 20:05 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-11 20:08 ` cvs-commit at gcc dot gnu dot org
  2004-08-11 20:10 ` wilson at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-11 20:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-11 20:08 -------
Subject: Bug 16490

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	wilson@gcc.gnu.org	2004-08-11 20:08:01

Modified files:
	gcc            : ChangeLog cfgrtl.c 

Log message:
	Fix -fprofile-use ICE.
	PR rtl-optimization/16490
	* cfgrtl.c (cfg_layout_split_edge): Set global_live_at_start and
	global_live_at_end for new basic block if already set for other blocks.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.4865&r2=2.4866
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgrtl.c.diff?cvsroot=gcc&r1=1.125&r2=1.126



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

* [Bug rtl-optimization/16490] segfault while compiling with -fprofile-use
  2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
                   ` (7 preceding siblings ...)
  2004-08-11 20:08 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-11 20:10 ` wilson at gcc dot gnu dot org
  2004-08-11 21:05 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: wilson at gcc dot gnu dot org @ 2004-08-11 20:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wilson at gcc dot gnu dot org  2004-08-11 20:10 -------
Fixed.  patch.2 and patch.3 added to gcc-3.4.x branch and mainline respectively.

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


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

* [Bug rtl-optimization/16490] segfault while compiling with -fprofile-use
  2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
                   ` (8 preceding siblings ...)
  2004-08-11 20:10 ` wilson at gcc dot gnu dot org
@ 2004-08-11 21:05 ` pinskia at gcc dot gnu dot org
  2004-08-16 22:03 ` wilson at gcc dot gnu dot org
  2004-08-17  0:14 ` wilson at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-11 21:05 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.4.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

* [Bug rtl-optimization/16490] segfault while compiling with -fprofile-use
  2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
                   ` (9 preceding siblings ...)
  2004-08-11 21:05 ` pinskia at gcc dot gnu dot org
@ 2004-08-16 22:03 ` wilson at gcc dot gnu dot org
  2004-08-17  0:14 ` wilson at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: wilson at gcc dot gnu dot org @ 2004-08-16 22:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wilson at gcc dot gnu dot org  2004-08-16 22:03 -------
*** Bug 15836 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at tat dot physik
                   |                            |dot uni-tuebingen dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

* [Bug rtl-optimization/16490] segfault while compiling with -fprofile-use
  2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
                   ` (10 preceding siblings ...)
  2004-08-16 22:03 ` wilson at gcc dot gnu dot org
@ 2004-08-17  0:14 ` wilson at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: wilson at gcc dot gnu dot org @ 2004-08-17  0:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wilson at gcc dot gnu dot org  2004-08-17 00:14 -------
*** Bug 13882 has been marked as a duplicate of this bug. ***

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16490


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

end of thread, other threads:[~2004-08-17  0:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-12  8:47 [Bug rtl-optimization/16490] New: segfault while compiling with -fprofile-use kapalka at icslab dot agh dot edu dot pl
2004-07-12  8:50 ` [Bug rtl-optimization/16490] " kapalka at icslab dot agh dot edu dot pl
2004-07-12  8:51 ` kapalka at icslab dot agh dot edu dot pl
2004-07-12 14:26 ` pinskia at gcc dot gnu dot org
2004-08-05 15:26 ` belyshev at lubercy dot com
2004-08-08  1:26 ` wilson at gcc dot gnu dot org
2004-08-08  1:26 ` wilson at gcc dot gnu dot org
2004-08-11 20:05 ` cvs-commit at gcc dot gnu dot org
2004-08-11 20:08 ` cvs-commit at gcc dot gnu dot org
2004-08-11 20:10 ` wilson at gcc dot gnu dot org
2004-08-11 21:05 ` pinskia at gcc dot gnu dot org
2004-08-16 22:03 ` wilson at gcc dot gnu dot org
2004-08-17  0:14 ` wilson at gcc dot gnu dot 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).