Bug 37500 - [4.4 Regression] libstdc++ failed to compile at -O0
Summary: [4.4 Regression] libstdc++ failed to compile at -O0
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build, GC, ice-on-valid-code
: 37511 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-09-12 18:11 UTC by H.J. Lu
Modified: 2008-09-14 01:17 UTC (History)
3 users (show)

See Also:
Host:
Target: x86_64-unknown-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
A testcase (60.60 KB, application/octet-stream)
2008-09-12 21:17 UTC, H.J. Lu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2008-09-12 18:11:13 UTC
On Linux/x86-64, libstdc++ failed to compile at -O0:

[hjl@gnu-6 gcc-work]$ /export/build/gnu/gcc-work/build-x86_64-linux/./gcc/xgcc -shared-libgcc -B/export/build/gnu/gcc-work/build-x86_64-linux/./gcc -nostdinc++ -L/export/build/gnu/gcc-work/build-x86_64-linux/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/export/build/gnu/gcc-work/build-x86_64-linux/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -B/usr/gcc-4.4-work/x86_64-unknown-linux-gnu/bin/ -B/usr/gcc-4.4-work/x86_64-unknown-linux-gnu/lib/ -isystem /usr/gcc-4.4-work/x86_64-unknown-linux-gnu/include -isystem /usr/gcc-4.4-work/x86_64-unknown-linux-gnu/sys-include -I/export/build/gnu/gcc-work/build-x86_64-linux/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu -I/export/build/gnu/gcc-work/build-x86_64-linux/x86_64-unknown-linux-gnu/libstdc++-v3/include -I/export/gnu/src/gcc-work/gcc/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -g -O0 -D_GNU_SOURCE -c /export/gnu/src/gcc-work/gcc/libstdc++-v3/src/compatibility.cc  -fPIC -DPIC -o .libs/compatibility.o
/export/gnu/src/gcc-work/gcc/libstdc++-v3/src/compatibility.cc:408: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-6 gcc-work]$ 
Program received signal SIGSEGV, Segmentation fault.
0x00000000004ed628 in ggc_free (p=<value optimized out>)
    at ../../src-trunk/gcc/ggc-page.c:1421
1421	    pe->in_use_p[word] &= ~(1UL << bit);
Missing separate debuginfos, use: debuginfo-install glibc.x86_64 gmp.x86_64 mpfr.x86_64
(gdb) bt
#0  0x00000000004ed628 in ggc_free (p=<value optimized out>)
    at ../../src-trunk/gcc/ggc-page.c:1421
#1  0x00000000005233c1 in flow_loops_free (loops=0xff0620)
    at ../../src-trunk/gcc/cfgloop.c:217
#2  0x0000000000a1d2eb in rest_of_handle_ira ()
    at ../../src-trunk/gcc/ira.c:1885
#3  0x00000000006374d8 in execute_one_pass (pass=0xf672a0)
    at ../../src-trunk/gcc/passes.c:1279
#4  0x0000000000637705 in execute_pass_list (pass=0xf672a0)
    at ../../src-trunk/gcc/passes.c:1327
#5  0x000000000063771d in execute_pass_list (pass=0xf625c0)
    at ../../src-trunk/gcc/passes.c:1328
#6  0x0000000000707487 in tree_rest_of_compilation (fndecl=0x7f3e946e2300)
    at ../../src-trunk/gcc/tree-optimize.c:418
#7  0x0000000000826554 in cgraph_expand_function (node=0x7f3e942d0700)
    at ../../src-trunk/gcc/cgraphunit.c:1038
#8  0x0000000000826764 in cgraph_output_in_order ()
    at ../../src-trunk/gcc/cgraphunit.c:1186
#9  0x0000000000827cfd in cgraph_optimize ()
    at ../../src-trunk/gcc/cgraphunit.c:1297
#10 0x0000000000451d6d in cp_write_global_declarations ()
    at ../../src-trunk/gcc/cp/decl2.c:3608
#11 0x00000000006cce81 in toplev_main (argc=<value optimized out>, 
---Type <return> to continue, or q <return> to quit---
    argv=<value optimized out>) at ../../src-trunk/gcc/toplev.c:979
#12 0x000000342da1e32a in __libc_start_main () from /lib64/libc.so.6
#13 0x0000000000404369 in _start ()
(gdb)
Comment 1 H.J. Lu 2008-09-12 19:42:21 UTC
It is caused by revision 140285.
Comment 2 Andrew Pinski 2008-09-12 20:33:47 UTC
(In reply to comment #1)
> It is caused by revision 140285.

That does not mean there is a bug in IRA.

Can you attach the preprocessed source?
Comment 3 H.J. Lu 2008-09-12 21:17:00 UTC
Created attachment 16308 [details]
A testcase

[hjl@gnu-6 gcc]$ ./xgcc -B./ -S /tmp/x.ii
/export/gnu/src/gcc-work/gcc/libstdc++-v3/src/compatibility.cc:202: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-6 gcc]$
Comment 4 Andrew Pinski 2008-09-13 01:53:50 UTC
g++.dg/cpp0x/variadic-tuple.C fails for me with an ICE during GC.
Comment 5 Andrew Pinski 2008-09-13 03:52:41 UTC
Here is a reduced testcase for the variadic-tuple.C failure.
Compile with --param ggc-min-expand=0 --param ggc-min-heapsize=0 -w:

namespace std __attribute__ ((__visibility__ ("default"))) {
  template<typename _CharT>     class basic_string;
  typedef basic_string<char> string;
  template<typename _CharT>
  struct basic_string     {
    void  _M_destroy() throw();
    basic_string(const char* __s);
    ~basic_string()       {
      _M_destroy();
    }
  };
  template<typename _CharT>   void basic_string<_CharT>:: _M_destroy() throw ()     {   }
  extern template class basic_string<char>;
};
template<typename... Values> class tuple;
template<> class tuple<> { };
template<typename Head, typename... Tail> struct tuple<Head, Tail...> : private tuple<Tail...>  {
  typedef tuple<Tail...> inherited;
  tuple()  {  }
  template<typename... VValues>   tuple(const tuple<VValues...>& other)
    :
    m_head(other.head())
    ,inherited(other.tail())
  {  }
  const Head &head() const {  }
  const inherited& tail() const {  }
  Head m_head;
};
int main() {
  tuple<int, float, const char*> t3a;
  tuple<long, double, std::string> t3b(t3a);
}

Comment 6 Jan Hubicka 2008-09-13 07:31:38 UTC
Subject: Bug 37500

Author: hubicka
Date: Sat Sep 13 07:30:15 2008
New Revision: 140334

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140334
Log:
	PR middle-end/37500
	* pt.c (tsubst_decl): Do not copy DECL_STRUCT_FUNCTION pointer.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c

Comment 7 Jan Hubicka 2008-09-13 08:01:42 UTC
Fixed by my patch.
Comment 8 Andrew Pinski 2008-09-14 01:17:35 UTC
*** Bug 37511 has been marked as a duplicate of this bug. ***