Bug 45828

Summary: Segmentation fault when type-casting templates
Product: [Retired] Red Hat Linux Reporter: Need Real Name <ttimonen>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: low    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-12-15 15:14:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Need Real Name 2001-06-25 16:19:49 UTC
Description of Problem:

When I compile a sample program below
---- cut here ----
template <class T> class A {
  T *d;
  public: void f() { (T[10])d; }
};
---- cut here ----
the compiler fails by throwing Segmentation fault. 
The code itself does nothing, but as far as I know, 
it seems semantically ok. 
I can typecast pointer to an array, can I?


How Reproducible:
Everytime


Steps to Reproduce:
1. compile the code.

Actual Results:
bugtest.cpp: In method `void A<T>::f ()':
bugtest.cpp:3: Internal error: Segmentation fault.

Expected Results:
Clean compilation or atleast more descriptive error message.


Additional Information:
Code compiles fine with IBM C++ for OS/2.

Comment 1 Jakub Jelinek 2001-08-09 14:21:04 UTC
Seems to be fixed with http://gcc.gnu.org/ml/gcc-patches/2001-01/msg00941.html
which will appear in gcc-2.96-96.