public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47987] New: ICE on legal code (when attempting to inline non-implicitly instantiated template member function)
@ 2011-03-04 11:37 niemayer at isg dot de
  2011-03-04 11:43 ` [Bug c++/47987] " niemayer at isg dot de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: niemayer at isg dot de @ 2011-03-04 11:37 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: ICE on legal code (when attempting to inline
                    non-implicitly instantiated template member function)
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: niemayer@isg.de


Created attachment 23540
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23540
preprocessed and gzipped legal C++ code causing ICE with gcc 4.5.[0-2]

When compiling the attached "crash.ii" file using gcc 4.5.[012] with

> gcc -O3 -fno-implicit-templates -c crash.ii -o crash.o

gcc crashes with a segmentation fault:

> crashtest.cxx: In static member function 'static bool LKV::MatchEntity::init_text_2_3(const LKV::Str&, LKV::Str&, LKV::Str&, LKV::Array<long unsigned int, true, LKV::_T<LKV::AbsPtr>, long unsigned int>*, LKV::Array<long unsigned int, true, LKV::_T<LKV::AbsPtr>, long unsigned int>*)':
crashtest.cxx:130:3:
> 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.


The same code is compiled fine by gcc 4.4.*, it also compiles fine with
-O[0-2].

Notice that this code is part of a library that uses explicit template
instantiations, intriguingly when compiling with "-fimplicit-templates", gcc
4.5.* does not crash - which let's me wonder how "just doing less" can actually
trigger such a bug :-)


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

* [Bug c++/47987] ICE on legal code (when attempting to inline non-implicitly instantiated template member function)
  2011-03-04 11:37 [Bug c++/47987] New: ICE on legal code (when attempting to inline non-implicitly instantiated template member function) niemayer at isg dot de
@ 2011-03-04 11:43 ` niemayer at isg dot de
  2011-03-04 13:29 ` rguenth at gcc dot gnu.org
  2011-09-29 17:57 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: niemayer at isg dot de @ 2011-03-04 11:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from niemayer at isg dot de 2011-03-04 11:43:25 UTC ---
The line that gcc reports to cause the ICE contains:

 if (offset_a2->preallocate(text_1.length())) {

"offset_a2" is an instance of class Array<unsigned long, true, _T<AbsPtr>,
unsigned long> - if that class is declared to be an "extern template by

 extern template class Array<unsigned long, true, _T<AbsPtr>, unsigned long>;

before the function that causes the ICE, compilation works fine as well as it
does with implicit template instantiation. (All class names within namespace
"LKV").


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

* [Bug c++/47987] ICE on legal code (when attempting to inline non-implicitly instantiated template member function)
  2011-03-04 11:37 [Bug c++/47987] New: ICE on legal code (when attempting to inline non-implicitly instantiated template member function) niemayer at isg dot de
  2011-03-04 11:43 ` [Bug c++/47987] " niemayer at isg dot de
@ 2011-03-04 13:29 ` rguenth at gcc dot gnu.org
  2011-09-29 17:57 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-04 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.03.04 13:29:35
                 CC|                            |jamborm at gcc dot gnu.org
      Known to work|                            |4.6.0
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-04 13:29:35 UTC ---
Confirmed.  Seems to be fixed on trunk.  On the brach I get with checking
enabled:

> ../../gcc45-g/gcc/cc1plus  -quiet t.ii -O -fipa-cp -fipa-cp-clone  -fno-implicit-templates
crashtest.cxx:455:22: error: missing callgraph edge for call stmt:
# .MEM_54 = VDEF <.MEM_53(D)>
D.48510_24 = LKV::Array<long unsigned int, true, LKV::_T<LKV::AbsPtr>, long
unsigned int>::preallocate (this_6(D), ni_2);

bool LKV::Array<T, use_memmove, PTR, STYPE>::extend_with_value(size_type, const
X&, bool) [with X = long unsigned int, T = long unsigned int, bool use_memmove
= true, PTR = LKV::_T<LKV::AbsPtr>, STYPE = long unsigned int, size_type = long
unsigned int]/579(537) @0x7ffff40b3138 (inline copy in static bool
LKV::MatchEntity::init_text_2_3(const LKV::Str&, LKV::Str&, LKV::Str&,
LKV::Array<long unsigned int, true, LKV::_T<LKV::AbsPtr>, long unsigned int>*,
LKV::Array<long unsigned int, true, LKV::_T<LKV::AbsPtr>, long unsigned
int>*)/573) availability:available 97 time, 31 benefit 40 size, 15 benefit
reachable body finalized inlinable
  called by: static bool LKV::MatchEntity::init_text_2_3(const LKV::Str&,
LKV::Str&, LKV::Str&, LKV::Array<long unsigned int, true, LKV::_T<LKV::AbsPtr>,
long unsigned int>*, LKV::Array<long unsigned int, true, LKV::_T<LKV::AbsPtr>,
long unsigned int>*)/573 (0.14 per call) (inlined) 
  calls: long int __builtin_expect(long int, long int)/601 (nested in 1 loops)
long int __builtin_expect(long int, long int)/601 (0.14 per call) (nested in 1
loops) long int __builtin_expect(long int, long int)/601 (0.14 per call)
(nested in 1 loops) 
crashtest.cxx:455:22: internal compiler error: verify_cgraph_node failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


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

* [Bug c++/47987] ICE on legal code (when attempting to inline non-implicitly instantiated template member function)
  2011-03-04 11:37 [Bug c++/47987] New: ICE on legal code (when attempting to inline non-implicitly instantiated template member function) niemayer at isg dot de
  2011-03-04 11:43 ` [Bug c++/47987] " niemayer at isg dot de
  2011-03-04 13:29 ` rguenth at gcc dot gnu.org
@ 2011-09-29 17:57 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-29 17:57 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
           Severity|critical                    |normal

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-29 17:35:35 UTC ---
Confirmed Fixed in 4.6.x and mainline. Not a regression.


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

end of thread, other threads:[~2011-09-29 17:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-04 11:37 [Bug c++/47987] New: ICE on legal code (when attempting to inline non-implicitly instantiated template member function) niemayer at isg dot de
2011-03-04 11:43 ` [Bug c++/47987] " niemayer at isg dot de
2011-03-04 13:29 ` rguenth at gcc dot gnu.org
2011-09-29 17:57 ` paolo.carlini at oracle dot com

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).