Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 76056 - g++ 2.96 segmentation fault in bastring ?
g++ 2.96 segmentation fault in bastring ?
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-10-16 06:26 EDT by Need Real Name
Modified: 2007-04-18 12:47 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-12-15 20:34:05 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2002-10-16 06:26:28 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.2-2 i686)

Description of problem:
The compiler gives a segmentation fault on a simple file containing a class and
a template with complicated template arguments but only when the <complex>
header is included.
#include <string>
#include <complex>

class PDO {
  string name;
  PDO( string p_n) : name(p_n){}

PDO Divg( "div");

template< template<int> class G, template< template<int> class> class P>
P< G>  gradient( P< G> A){
  return P<G>( A);

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Compile the above code with g++ -c
2. The problem disappears by leaving out the <complex> header
3. The problem also disappears by commenting out either the construction of Divg
or the template

Actual Results:  Step 1 gives a segmentation fault during compilation and an
error message

Steps 2 and 3 give no messages

Expected Results:  If the code is erroneous, an error message without core dump,
but I think 
the code is correct

Additional info:

/usr/include/g++-3/std/bastring.h: In method `const charT 
*basic_string<charT, traits, Allocator>::data () const [with charT = 
char, traits = string_char_traits<char>, Allocator = 
__default_alloc_template<true, 0>]':
/usr/include/g++-3/std/bastring.cc:165:   instantiated from `basic_string<charT,
 traits, Allocator>::replace (unsigned int, unsigned int, const charT *, unsigne
d int) [with charT = char, traits = string_char_traits<char>, Allocator = __defa
ult_alloc_template<true, 0>]'
/usr/include/g++-3/std/bastring.h:223:   instantiated from `basic_string<charT, 
traits, Allocator>::assign (const charT *, unsigned int) [with charT = char, tra
its = string_char_traits<char>, Allocator = __default_alloc_template<true, 0>]'
/usr/include/g++-3/std/bastring.h:225:   instantiated from `basic_string<charT, 
traits, Allocator>::assign (const charT *) [with charT = char, traits = string_c
har_traits<char>, Allocator = __default_alloc_template<true, 0>]'
/usr/include/g++-3/std/bastring.h:183:   instantiated from `basic_string<charT, 
traits, Allocator>::basic_string (const charT *) [with charT = char, traits = st
ring_char_traits<char>, Allocator = __default_alloc_template<true, 0>]'
buggy.C:10:   instantiated from here
/usr/include/g++-3/std/bastring.h:157: Internal error: Segmentation 
Please submit a full bug report.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.
Comment 1 Alan Cox 2002-12-15 20:34:05 EST
g++ 3.2 correctly reports

x1.C:3: 'string' is used as a type, but is not defined as a type.
x1.C:4: parse error before `p_n'
x1.C:4: missing ';' before right brace
x1.C: In function `void __static_initialization_and_destruction_0(int, int)':
x1.C:7: no matching function for call to `PDO::PDO(const char[4])'
x1.C:1: candidates are: PDO::PDO()
x1.C:1:                 PDO::PDO(const PDO&)

and does not crash

Note You need to log in before you can comment on or make changes to this bug.