User account creation filtered due to spam.

Bug 53359 - [4.8 regression] undefined reference to `__gnu_cxx::__numeric_traits_integer<int>::__min'
Summary: [4.8 regression] undefined reference to `__gnu_cxx::__numeric_traits_integer<...
Alias: None
Product: gcc
Classification: Unclassified
Component: libmudflap (show other bugs)
Version: 4.8.0
: P1 normal
Target Milestone: 4.8.0
Assignee: Alexandre Oliva
Depends on:
Reported: 2012-05-15 10:11 UTC by Andreas Schwab
Modified: 2013-01-18 11:17 UTC (History)
2 users (show)

See Also:
Target: powerpc64-*-*
Known to work:
Known to fail: 4.8.0
Last reconfirmed: 2012-12-15 00:00:00

pass41-frag.s (45.37 KB, text/plain)
2012-05-16 13:22 UTC, Andreas Schwab
pass41-frag.cxx.000i.cgraph (19.50 KB, text/plain)
2012-05-16 13:25 UTC, Andreas Schwab
Preprocessed testcase (73.29 KB, text/plain)
2012-12-07 00:01 UTC, Andreas Schwab

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schwab 2012-05-15 10:11:21 UTC
From the libmudflap testsuite:

spawn /daten/gcc/gcc-20120514/Build/./gcc/g++ -shared-libgcc -B/daten/gcc/gcc-20120514/Build/./gcc -nostdinc++ -L/daten/gcc/gcc-20120514/Build/powerpc64-linux/64/libstdc++-v3/src -L/daten/gcc/gcc-20120514/Build/powerpc64-linux/64/libstdc++-v3/src/.libs -B/usr/powerpc64-linux/bin/ -B/usr/powerpc64-linux/lib/ -isystem /usr/powerpc64-linux/include -isystem /usr/powerpc64-linux/sys-include -m64 -fPIC -mstrict-align -ggdb3 -DDEBUG_ASSERT -D_GLIBCXX_ASSERT -fmessage-length=0 -ffunction-sections -fdata-sections -O2 -g -D_GNU_SOURCE -I/daten/gcc/gcc-20120514/libmudflap/testsuite -I/daten/gcc/gcc-20120514/libmudflap/testsuite/.. -I.. -nostdinc++ -I/daten/gcc/gcc-20120514/Build/powerpc64-linux/64/libstdc++-v3/include/powerpc64-linux -I/daten/gcc/gcc-20120514/Build/powerpc64-linux/64/libstdc++-v3/include -I/daten/gcc/gcc-20120514/libstdc++-v3/libsupc++ -I/daten/gcc/gcc-20120514/libstdc++-v3/include/backward -I/daten/gcc/gcc-20120514/libstdc++-v3/testsuite/util -L/daten/gcc/gcc-20120514/Build/powerpc64-linux/64/libmudflap/.libs /daten/gcc/gcc-20120514/libmudflap/testsuite/libmudflap.c++/pass41-frag.cxx -fmudflap -lmudflap -L/daten/gcc/gcc-20120514/Build/powerpc64-linux/64/libmudflap/testsuite -ldl -lm -m64 -o ./pass41-frag.exe
/tmp/ccptOQsc.o:(.toc+0x10): undefined reference to `__gnu_cxx::__numeric_traits_integer<int>::__min'
/tmp/ccptOQsc.o:(.toc+0x18): undefined reference to `__gnu_cxx::__numeric_traits_integer<int>::__max'
/tmp/ccptOQsc.o:(.toc+0x20): undefined reference to `__gnu_cxx::__numeric_traits_integer<unsigned long>::__digits'
/tmp/ccptOQsc.o:(.toc+0x28): undefined reference to `__gnu_cxx::__numeric_traits_integer<char>::__max'
/tmp/ccptOQsc.o:(.toc+0x30): undefined reference to `__gnu_cxx::__numeric_traits_integer<short>::__min'
/tmp/ccptOQsc.o:(.toc+0x38): undefined reference to `__gnu_cxx::__numeric_traits_integer<short>::__max'
/tmp/ccptOQsc.o:(.toc+0x40): undefined reference to `__gnu_cxx::__numeric_traits_integer<long>::__min'
/tmp/ccptOQsc.o:(.toc+0x48): undefined reference to `__gnu_cxx::__numeric_traits_integer<long>::__max'

Regression introduced between revisions 186361 and 187478.
Comment 1 Andreas Schwab 2012-05-15 17:40:50 UTC
ff2a5adaa72fef87cac689a40c23258a30b304c8 is the first bad commit
commit ff2a5adaa72fef87cac689a40c23258a30b304c8
Author: hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Sun Apr 22 21:28:07 2012 +0000

        * lto-symtab.c (lto_varpool_replace_node): Do not merge needed flags.
        * cgraphbuild.c (record_reference, record_type_list, mark_address,
        mark_load, mark_store): Do not mark varpool nodes as needed.
        * cgraph.c (cgraph_new_nodes): Remove.
    git-svn-id: svn+ssh:// 138bc75d-0d04-0410-961f-82ee72b054a4
Comment 2 Jan Hubicka 2012-05-16 12:34:29 UTC
Can you, please get me -fdump-ipa-cgraph and the assembly file?  The testcase seems to work normally and those constants are supposed to be optimized out.  
For me hose are usual comdat vars:
_ZN9__gnu_cxx24__numeric_traits_integerIlE5__minE/388 (const long int __gnu_cxx::__numeric_traits_integer<long int>::__min) @0x7ffff650e528
  Type: variable
  Visibility: public weak comdat comdat_group:_ZN9__gnu_cxx24__numeric_traits_integerIlE5__minE one_only visibility_specified
  Availability: not-ready
  Varpool flags: initialized finalized
Comment 3 Andreas Schwab 2012-05-16 13:22:38 UTC
Created attachment 27422 [details]
Comment 4 Andreas Schwab 2012-05-16 13:25:18 UTC
Created attachment 27423 [details]
Comment 5 Alexandre Oliva 2012-12-06 21:39:50 UTC
I have a hunch that the patch for bug 53952 might fix this, if this happens to be another case of variables that are not addressable being SRAed or otherwise transformed in ways that makes mudflap marked as addressable and checked when they didn't even have to be output in the first place.  A preprocessed testcase would help me test this theory more immediately with a cross compiler, rather than a full cross toolchain.
Comment 6 Andreas Schwab 2012-12-07 00:01:40 UTC
Created attachment 28889 [details]
Preprocessed testcase
Comment 7 Alexandre Oliva 2012-12-15 18:40:39 UTC
Thanks.  It's not the same issue, after all.  These decls are recorded in deferred_static_decls, and mudflap_finish_file emits calls to mf_register for them, so they end up referenced in the toc.  I suppose mudflap_finish_file needs tweaking to tell that GCC decided not to emit the symbol after all.
Comment 8 Alexandre Oliva 2012-12-15 19:04:00 UTC
Jan, does a change like this seem reasonable?

--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -1335,6 +1335,10 @@ mudflap_finish_file (void)
           if (! TREE_PUBLIC (obj) && ! TREE_ADDRESSABLE (obj))
+	  /* If we're not emitting the symbol, don't register it.  */
+	  if (!symtab_get_node (obj))
+	    continue;
           if (! COMPLETE_TYPE_P (TREE_TYPE (obj)))
               warning (OPT_Wmudflap,
Comment 9 Alexandre Oliva 2013-01-18 10:58:18 UTC
Author: aoliva
Date: Fri Jan 18 10:57:58 2013
New Revision: 195290

PR libmudflap/53359
* tree-mudflap.c (mudflap_finish_file): Skip deferred decls
not found in the symtab.

Comment 10 Alexandre Oliva 2013-01-18 11:17:38 UTC