Bug 44716 - [4.6 Regression] Bootstrap fails with partial inlining (r161382)
Summary: [4.6 Regression] Bootstrap fails with partial inlining (r161382)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.6.0
: P1 normal
Target Milestone: 4.6.0
Assignee: Jan Hubicka
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2010-06-29 17:50 UTC by Steve Ellcey
Modified: 2010-11-03 15:50 UTC (History)
2 users (show)

See Also:
Host: ia64-hp-hpux11.23
Target: ia64-hp-hpux11.23
Build: ia64-hp-hpux11.23
Known to work:
Known to fail:
Last reconfirmed: 2010-08-11 19:51:09


Attachments
Compressed preprocessed cp/decl.c (280.27 KB, application/x-gzip)
2010-07-07 23:43 UTC, Steve Ellcey
Details
Compressed decl.c.015t.inline_param1 file (6.00 KB, application/x-gzip)
2010-07-07 23:44 UTC, Steve Ellcey
Details
Compressed decl.c.025t.einline2 file (470.58 KB, application/x-gzip)
2010-07-07 23:44 UTC, Steve Ellcey
Details
Compressed decl.c.041t.fnsplit file (384.51 KB, application/x-gzip)
2010-07-07 23:45 UTC, Steve Ellcey
Details
Compressed decl.c.043t.inline_param3 file (6.03 KB, application/x-gzip)
2010-07-07 23:45 UTC, Steve Ellcey
Details
compressed builtins.c.041t.fnsplit dump file (303.62 KB, text/plain)
2010-08-11 17:23 UTC, Steve Ellcey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Ellcey 2010-06-29 17:50:48 UTC
The ia64-hp-hpux11.23 platform fails when building the C++ library during a bootstrap build with r161382.  r161381 works. r161521, which has some bug
fixes, still fails.  The failure only occurs with bootstrap, the compiler
faults when building the libstdc++ library.

/proj/opensrc_nobackup/sje/reg3/build-ia64-hp-hpux11.23-trunk/obj_gcc/ia64-hp-hpux11.23/libstdc++-v3/include/bits/postypes.h:123:12: internal compiler error: Illegal instruction
Please submit a full bug report,  
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[4]: *** [ia64-hp-hpux11.23/bits/stdc++.h.gch/O2ggnu++0x.gch] Error

Running under gdb didn't give me a complete backtrace but did show:

#0  0x42c88b0:2 in cplus_expand_constant (cst=0x6432d880)
    at /proj/opensrc_nobackup/sje/reg3/src/trunk/gcc/cp/expr.c:70

I will try turning off partial inlining and see if that fixes the
problem using the r161382 sources.  This bug doesn't appear to be
the same as PR44671 (fixed in r161521) or PR44687 (an ICE error in tree_nrv).
Comment 1 Steve Ellcey 2010-06-29 20:32:54 UTC
I have verified that the bootstrap works if I set flag_partial_inlining to 0.
I also did a build with --disable-libstdcxx-pch to see if the build failed when I didn't build pre-compiled C++ headers and it does.  It dies while compiling libstdc++-v3/libsupc++/array_type_info.cc with the same error.
Comment 2 Jan Hubicka 2010-07-07 00:46:38 UTC
Hi,
can I have a testcase that reproduce on cross compiler?  The backtrace seems rather odd.
Comment 3 Steve Ellcey 2010-07-07 15:30:55 UTC
I haven't been able to come up with a test case other then bootstrapping.  If I build a non-bootstrap compiler and run the testsuite I don't get any unexpected failures due to this problem.  It is only when, during bootstrap, I run the cc1plus executable that was built by the stage1 cc1 that I get a failure.  At that point trying to compile any C++ program with cc1plus results in cc1plus aborting.
Comment 4 Steve Ellcey 2010-07-07 17:22:00 UTC
The problem seems to happen when compiling cp/decl.c.  If I compile this file at -O1 instead of -O2 the resulting C++ compiler will work.  I am trying to see if I can track it down to one function within cp/decl.c.
Comment 5 Steve Ellcey 2010-07-07 22:48:38 UTC
If I put __attribute__ ((noinline)) on check_class_member_definition_namespace
in cp/decl.c, I don't see the bug.  I don't see anything special about this function so I don't know why it is having problems being (partially)
inlined when nothing else seems to cause problems.
Comment 6 Jan Hubicka 2010-07-07 23:01:56 UTC
Subject: Re:  [4.6 Regression] Bootstrap fails with
	partial inlining (r161382)

great work!  Could you, please, post me the fnsplit, einline2 and inline dumps? Perhaps I can work out what is wrong there.
(and preprocessed source so I can try on cross if possible too)

Honza
Comment 7 Steve Ellcey 2010-07-07 23:43:23 UTC
Created attachment 21129 [details]
Compressed preprocessed cp/decl.c
Comment 8 Steve Ellcey 2010-07-07 23:44:09 UTC
Created attachment 21130 [details]
Compressed decl.c.015t.inline_param1 file
Comment 9 Steve Ellcey 2010-07-07 23:44:46 UTC
Created attachment 21131 [details]
Compressed decl.c.025t.einline2 file
Comment 10 Steve Ellcey 2010-07-07 23:45:26 UTC
Created attachment 21132 [details]
Compressed decl.c.041t.fnsplit file
Comment 11 Steve Ellcey 2010-07-07 23:45:58 UTC
Created attachment 21133 [details]
Compressed decl.c.043t.inline_param3 file
Comment 12 Steve Ellcey 2010-08-11 17:20:41 UTC
I have a slightly smaller test case for this, but it still needs to bootstrap to fail.  If I bootstrap just the C part of the compiler I get a successful build (with partial inlining enabled) but when I use that compiler to compile this test case (with -O2) I get a segfault in the compiler:

char *s4;
test2_sub (int i, ...)
{
  __builtin_va_list ap;
  __builtin___vsprintf_chk (s4, 0, __builtin_object_size (s4, 0), "%s %d", ap);
}


If I modify the gimple_rewrite_call_expr call in builtins.c and replace the call to gimple_call_num_args with a new function that I don't inline (or that I inline completely) the segfault goes away.

Looking at some of the dump files, builtins.c.041t.fnsplit shows gimple_call_num_args getting split but I don't see any indication of inlining in builtins.c.015/025/043.  fnsplit creates gimple_call_num_args.part.22 and changes gimple_call_num_args to call that routine the dump doesn't show imple_rewrite_call_expr calling part.22 but later dumps do show this.  I will attach builtins.c.041t.fnsplit.

Any help on this bug would be appreciated, IA64 HP-UX has not bootstrapped with ToT sources in some time now.

Comment 13 Steve Ellcey 2010-08-11 17:23:53 UTC
Created attachment 21455 [details]
compressed builtins.c.041t.fnsplit dump file

I believe that the splitting and inlining of gimple_call_num_args into gimple_rewrite_call_expr is causing the failure but I do not know why.
Comment 14 Richard Biener 2010-08-11 19:51:09 UTC
I will have a look tomorrow.
Comment 15 Richard Biener 2010-08-19 15:53:38 UTC
I didn't get a chance to look.
Comment 16 Steve Ellcey 2010-09-20 22:12:40 UTC
Honza, have you had a chance to look at this failure recently?  It is still happening and I can only build GCC on ia64-hp-hpux11.23 using workarounds to stop some of the inlining.
Comment 17 Steve Ellcey 2010-09-23 16:27:48 UTC
It looks like GCC on IA64 HP-UX has a problem when a routine in .text.unlikely
calls a function in .text.  If I define UNLIKELY_EXECUTED_TEXT_SECTION_NAME and HOT_TEXT_SECTION_NAME to just be '.text' then I can bootstrap with partial inlining enabled.  I think the bug that is causing the abort is probably in the GNU assembler or the HP linker or some combination of the two.

There is still a GCC bug here because the partial inlining change shouldn't have triggered the use of .text.unlikely.  Particularly since it appears that it is the caller of the partially inlined function that is getting put into .text.unlikely, not the 'remainder' of the partially inlined function.

On IA64 Linux, we do not appear to be using .text.unlikely, and that is probably why I see this bug on HP-UX but not Linux.
Comment 18 Steve Ellcey 2010-10-01 17:05:53 UTC
Author: sje
Date: Fri Oct  1 17:05:45 2010
New Revision: 164891

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164891
Log:
2010-10-01  Steve Ellcey  <sje@cup.hp.com>

	PR tree-optimization/44716
	* config/ia64/hpux.h (UNLIKELY_EXECUTED_TEXT_SECTION_NAME): Define.
	(HOT_TEXT_SECTION_NAME): Define.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/ia64/hpux.h
Comment 19 Richard Biener 2010-11-03 15:50:25 UTC
I assume FIXED from http://gcc.gnu.org/ml/gcc-testresults/2010-11/msg00221.html.