This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/896: ice function-inlining g++ Segmentation fault



>Number:         896
>Category:       c++
>Synopsis:       ice function-inlining g++ Segmentation fault
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 26 16:06:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Peter Schmid
>Release:        2.97 20001120 (experimental)
>Organization:
TU Darmstadt
>Environment:
System: Linux kiste 2.4.0-test10 #20 Thu Nov 2 03:02:57 CET 2000 i686 unknown
Architecture: i686
GNU assembler 001002
GLIBC 2.1.3
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.97/specs
Configured with: ../gcc-20001120/configure -enable-shared --disable-nls --enable-threads=posix --enable-long-long --enable-libstdcxx-v3
gcc version 2.97 20001120 (experimental)
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-20001120/configure -enable-shared --disable-nls --enable-threads=posix --enable-long-long --enable-libstdcxx-v3
>Description:
The simple programm s.C generates a segmentation fault of g++, if function
inlining (-O -finline-functions) is turned on. If function inlining
is turned off, the program works as expected -- even at -O3
-fno-inline-functions. The previous compiler snapshot did not expose
this problem.   
How-To-Repeat:
cat s.C

class A {
  friend A operator+(const A &a1, const A &a2);

public:
  A(const A &copy);
  A(char c, int n = 1);
  A Copy();

private:
  int len;        
};


int main()
{

}

A operator+(const A &a1, const A &a2)
{
  A result(a1.len + a2.len);
  return result;
}

A::A(const A &copy)
{
  *this = copy;
}

A::A(char c, int n)
{}

A  A::Copy()
{
  A t('b');
  return t;
}
Compiling the programm:
g++ -v -Q -o s s.C -O -finline-functions -save-temps
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.97/specs
Configured with: ../gcc-20001120/configure -enable-shared --disable-nls --enable-threads=posix --enable-long-long --enable-libstdcxx-v3
gcc version 2.97 20001120 (experimental)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.97/cpp0 -lang-c++ -v -D__GNUC__=2 -D__GNUC_MINOR__=97 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ s.C s.ii
GNU CPP version 2.97 20001120 (experimental) (cpplib) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++-v3
 /usr/local/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.97/include
 /usr/local/i686-pc-linux-gnu/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.97/cc1plus -fpreprocessed s.ii -lang-c++ -D__GNUG__=2 -D__GXX_ABI_VERSION=100 -dumpbase s.C -O -version -fnew-abi -finline-functions -o s.s
GNU C++ version 2.97 20001120 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 2.97 20001120 (experimental).
options passed:  -fpreprocessed -lang-c++ -D__GNUG__=2
 -D__GXX_ABI_VERSION=100 -O -fnew-abi -finline-functions
options enabled:  -fdefer-pop -fthread-jumps -fpeephole -ffunction-cse
 -finline-functions -finline -fkeep-static-consts -fpcc-struct-return
 -fsched-interblock -fsched-spec -fbranch-count-reg -fexceptions
 -fnew-exceptions -fcommon -fgnu-linker -fargument-alias -fident
 -fmath-errno -m80387 -mhard-float -mno-soft-float -mieee-fp
 -mfp-ret-in-387
 int main() int main() A operator+(const A&, const A&) A operator+(const A&, const A&) A::A(const A&) A::__base_ctor(const A&) A::__base_ctor(const A&) A::__comp_ctor(const A&) A::__comp_ctor(const A&) A::A(char, int) A::__base_ctor(char, int) A::__base_ctor(char, int) A::__comp_ctor(char, int) A::__comp_ctor(char, int) A A::Copy() A A::Copy()
s.C:36: Internal error: Segmentation fault.
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

preprocessor source file: s.ii

# 1 "s.C"
class A {
  friend A operator+(const A &a1, const A &a2);

public:
  A(const A &copy);
  A(char c, int n = 1);
  A Copy();

private:
  int len;
};


int main()
{

}

A operator+(const A &a1, const A &a2)
{
  A result(a1.len + a2.len);
  return result;
}

A::A(const A &copy)
{
  *this = copy;
}

A::A(char c, int n)
{}

A A::Copy()
{
  A t('b');
  return t;
}



>How-To-Repeat:
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]