Bug 46667 - [4.6 Regression] -freorder-blocks-and-partition -g failed and libstdc++ builds for arm-eabi are broken.
Summary: [4.6 Regression] -freorder-blocks-and-partition -g failed and libstdc++ build...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.6.0
: P3 critical
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-26 00:40 UTC by John Tytgat
Modified: 2010-12-14 13:08 UTC (History)
7 users (show)

See Also:
Host:
Target: arm
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-11-26 11:29:17


Attachments
Testcase for ARM (33.96 KB, application/octet-stream)
2010-12-02 17:54 UTC, Ramana Radhakrishnan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Tytgat 2010-11-26 00:40:00 UTC
Configured gcc 4.6.0 trunk (r167154) as:

  $ /home/joty/projects/gccsdk/gccsdk_svn7/gcc4/srcdir/gcc/configure --target=arm-unknown-eabi --prefix=/home/joty/projects/gccsdk/riscos7/cross --with-gmp=/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/installed-libs-for-cross-gcc --with-mpfr=/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/installed-libs-for-cross-gcc --with-mpc=/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/installed-libs-for-cross-gcc --with-system-zlib --with-ppl=/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/installed-libs-for-cross-gcc --with-host-libstdcxx=-Wl,-lstdc++ --with-cloog=/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/installed-libs-for-cross-gcc --disable-threads --disable-multilib --disable-shared --with-newlib  --enable-interwork --disable-nls --enable-checking=release --enable-languages=c,c++

With:

- newlib from cvs TOT
- binutils 2.20.1
- GMP 5.0.1
- MPFR 3.0.0
- MPC 0.8.2
- PPL 0.10.2
- CLOOG 0.15.9

Building breaks in libstdc++ with "causes a section type conflict" error.  This is the start of the (long) error tail:

--8<--
libtool: compile:  /home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/./gcc/xgcc -shared-libgcc -B/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/./gcc -nostdinc++ -L/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libstdc++-v3/src -L/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libstdc++-v3/src/.libs -nostdinc -B/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/newlib/ -isystem /home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/newlib/targ-include -isystem /home/joty/projects/gccsdk/gccsdk_svn7/gcc4/srcdir/gcc/newlib/libc/include -B/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libgloss/arm -L/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libgloss/libnosys -L/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/srcdir/gcc/libgloss/arm -B/home/joty/projects/gccsdk/riscos7/cross/arm-unknown-eabi/bin/ -B/home/joty/projects/gccsdk/riscos7/cross/arm-unknown-eabi/lib/ -isystem /home/joty/projects/gccsdk/riscos7/cross/arm-unknown-eabi/include -isystem /home/joty/projects/gccsdk/riscos7/cross/arm-unknown-eabi/sys-include -I/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libstdc++-v3/include/arm-unknown-eabi -I/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libstdc++-v3/include -I/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/srcdir/gcc/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -g -O2 -std=gnu++0x -c /home/joty/projects/gccsdk/gccsdk_svn7/gcc4/srcdir/gcc/libstdc++-v3/src/string-inst.cc -o string-inst.o
In file included from /home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libstdc++-v3/include/string:53:0,
                 from /home/joty/projects/gccsdk/gccsdk_svn7/gcc4/srcdir/gcc/libstdc++-v3/src/string-inst.cc:33:
/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libstdc++-v3/include/bits/basic_string.h: In member function 'void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_dispose(const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libstdc++-v3/include/bits/basic_string.h:230:2: error: void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_dispose(const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] causes a section type conflict
/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libstdc++-v3/include/bits/basic_string.h: In destructor 'std::basic_string<_CharT, _Traits, _Alloc>::~basic_string() [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libstdc++-v3/include/bits/basic_string.h:531:7: error: std::basic_string<_CharT, _Traits, _Alloc>::~basic_string() [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>] causes a section type conflict
In file included from /home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libstdc++-v3/include/string:57:0,
                 from /home/joty/projects/gccsdk/gccsdk_svn7/gcc4/srcdir/gcc/libstdc++-v3/src/string-inst.cc:33:
/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libstdc++-v3/include/bits/basic_string.tcc: In member function 'void std::basic_string<_CharT, _Traits, _Alloc>::_M_mutate(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>, std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int]':
/home/joty/projects/gccsdk/gccsdk_svn7/gcc4/builddir/cross-gcc/arm-unknown-eabi/libstdc++-v3/include/bits/basic_string.tcc:468:5: error: void std::basic_string<_CharT, _Traits, _Alloc>::_M_mutate(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>, std::basic_string<_CharT, _Traits, _Alloc>::size_type = unsigned int] causes a section type conflict
...
--8<--

This is a regression compared to a couple of weeks back.
Comment 1 Zdenek Sojka 2010-11-26 00:52:20 UTC
This probably isn't specific to arm, I am getting the same error at x86_64-linux with -freorder-blocks-and-partition -g:

----- testcase.c -----
void foo() {}
----------------------

$ gcc -freorder-blocks-and-partition -g testcase.c
testcase.c: In function 'foo':
testcase.c:1:6: error: foo causes a section type conflict
testcase.c:1:6: error: foo causes a section type conflict
testcase.c:1:6: error: foo causes a section type conflict
Comment 2 Ramana Radhakrishnan 2010-11-26 11:29:17 UTC
I see this failure as well starting from a couple of nights back.

Ramana
Comment 3 H.J. Lu 2010-11-26 15:55:22 UTC
It is caused by revision 167085:

http://gcc.gnu.org/ml/gcc-cvs/2010-11/msg00974.html
Comment 4 Ramana Radhakrishnan 2010-11-26 17:07:54 UTC
arm-eabi builds for libstdc++ are still broken. ARM doesn't use freorder-blocks-and-partition by default thus it's probably more generic than that ! 

So saying freorder-blocks-and-partition is the only thing broken isn't correct.

Ramana
Comment 5 John Tytgat 2010-11-29 23:04:53 UTC
(In reply to comment #3)
> It is caused by revision 167085:
> 
> http://gcc.gnu.org/ml/gcc-cvs/2010-11/msg00974.html

Yes, confirmed here as well.  This is the regression.
Comment 6 Joel Sherrill 2010-12-01 20:34:56 UTC
Also impacts arm-*-rtems*
Comment 7 Ramana Radhakrishnan 2010-12-02 17:52:38 UTC
Here's the backtrace I see for arm-eabi.


#0  error (gmsgid=0xf323c8 "%+D causes a section type conflict") at ../../combined/gcc/diagnostic.c:747
#1  0x0000000000affd0d in get_section (name=0xf324e2 ".text.unlikely", flags=2099456, decl=0x2ba5b228f900) at ../../combined/gcc/varasm.c:301
#2  0x0000000000afff64 in get_named_section (decl=0x2ba5b228f900, name=0xf324e2 ".text.unlikely", reloc=0) at ../../combined/gcc/varasm.c:392
#3  0x0000000000b007ea in get_named_text_section (decl=0x2ba5b228f900, text_section_name=0xf324e2 ".text.unlikely", named_section_suffix=0x0)
    at ../../combined/gcc/varasm.c:531
#4  0x0000000000b00880 in default_function_section (decl=0x2ba5b228f900, freq=NODE_FREQUENCY_UNLIKELY_EXECUTED, startup=0 '\0', exit=0 '\0')
    at ../../combined/gcc/varasm.c:554
#5  0x0000000000b00955 in function_section_1 (decl=0x2ba5b228f900, force_cold=1 '\001') at ../../combined/gcc/varasm.c:605
#6  0x0000000000b009b8 in current_function_section () at ../../combined/gcc/varasm.c:635
#7  0x0000000000b39835 in arm_is_long_call_p (decl=0x2ba5b225cd00) at ../../combined/gcc/config/arm/arm.c:5001
#8  0x0000000000b39937 in arm_function_ok_for_sibcall (decl=0x2ba5b225cd00, exp=0x2ba5b2a84370) at ../../combined/gcc/config/arm/arm.c:5033
#9  0x00000000006b1a4b in expand_call (exp=0x2ba5b2a84370, target=0x0, ignore=1) at ../../combined/gcc/calls.c:2306
#10 0x00000000007614e0 in expand_expr_real_1 (exp=0x2ba5b2a84370, target=0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at ../../combined/gcc/expr.c:9299
#11 0x00000000006c2796 in expand_gimple_stmt (stmt=0x2ba5b22caee0) at ../../combined/gcc/cfgexpand.c:1916
#12 0x00000000006c342b in expand_gimple_basic_block (bb=0x2ba5b253e548) at ../../combined/gcc/cfgexpand.c:2154
#13 0x00000000006c47b8 in gimple_expand_cfg () at ../../combined/gcc/cfgexpand.c:4046
#14 0x0000000000897d6f in execute_one_pass (pass=0x136b600) at ../../combined/gcc/passes.c:1553
#15 0x0000000000898065 in execute_pass_list (pass=0x136b600) at ../../combined/gcc/passes.c:1608
#16 0x000000000099c576 in tree_rest_of_compilation (fndecl=0x2ba5b228f900) at ../../combined/gcc/tree-optimize.c:422
#17 0x0000000000b4d650 in cgraph_expand_function (node=0x2ba5b2465420) at ../../combined/gcc/cgraphunit.c:1508
#18 0x0000000000b50469 in cgraph_optimize () at ../../combined/gcc/cgraphunit.c:1567
#19 0x0000000000b5089d in cgraph_finalize_compilation_unit () at ../../combined/gcc/cgraphunit.c:1031
#20 0x0000000000548c67 in cp_write_global_declarations () at ../../combined/gcc/cp/decl2.c:3973
#21 0x0000000000940051 in toplev_main (argc=25, argv=0x7ffff9418f78) at ../../combined/gcc/toplev.c:591
#22 0x000000350401d974 in __libc_start_main () from /lib64/libc.so.6
#23 0x000000000048a669 in _start ()

In a compiler configured in a combined tree with :

../combined/configure --with-newlib --target=arm-eabi --with-cpu=cortex-a9 --with-fpu=vfpv3-d16 --with-float=softfp --with-gmp=/projects/pl802_weddell/tools/linux_x86_64 --with-mpfr=/projects/pl802_weddell/tools/linux_x86_64 --with-mpc=/projects/pl802_weddell/tools/linux_x86_64 --enable-languages=c,c++
Comment 8 Ramana Radhakrishnan 2010-12-02 17:54:22 UTC
Created attachment 22605 [details]
Testcase for ARM

Backtrace shown in previous comment from the following debugging arguments.

gdb --args /work/fsfwork/git/build-latest-eabi-clone/./gcc/cc1plus -fpreprocessed string-inst.ii -quiet -dumpbase string-inst.cc -mcpu=cortex-a9 -mfloat-abi=softfp -mfpu=vfpv3-d16 -auxbase-strip string-inst.o -g -O2 -Wall -Wextra -Wwrite-strings -Wcast-qual -std=gnu++0x -version -fno-implicit-templates -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -o string-inst.s
Comment 9 Jie Zhang 2010-12-03 03:38:38 UTC
I see the similar issue too when building libstdc++ for arm-none-linux-gnueabi target.
Comment 10 Jie Zhang 2010-12-03 04:22:48 UTC
Chung-Lin Tang told me he had a patch for this:

http://gcc.gnu.org/ml/gcc-patches/2010-12/msg00137.html
Comment 11 Jan Hubicka 2010-12-14 13:07:08 UTC
Author: hubicka
Date: Tue Dec 14 13:07:05 2010
New Revision: 167795

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167795
Log:
	PR middle-end/46667
	* varasm.c (assemble_start_function): Do not call resolve_unique_section.
	* cfgexpand.c (gimple_expand_cfg): Resolve it here.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgexpand.c
    trunk/gcc/varasm.c
Comment 12 Jan Hubicka 2010-12-14 13:08:51 UTC
Fixed.