c++/9307: ICE

shrinivasa@kpit.com shrinivasa@kpit.com
Tue Jan 14 12:11:00 GMT 2003


>Number:         9307
>Category:       c++
>Synopsis:       ICE
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 14 04:06:03 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     shrinivasa@kpit.com
>Release:        GCC 3.2.1. Also observed in GCC 3.2
>Organization:
>Environment:
SH-COFF.
>Description:
When attached file is compiled with  -O2 -g the compiler generates ICE. Try following command.

sh-coff-g++ -S -g -O2 test_code.cpp

-------------------------------------
typedef int int32;
typedef int32 real_const_t;

class real
{
private:
  int32 value;

public:
  real(void) {}
  real(const real & z_a) {value = z_a.value;}
  friend real operator+ (real, real);
};

inline real operator+ (real z_a, real z_b)
{
  real temp;
  temp.value = (z_a.value) + (z_b.value);
  return temp;
}

real r,r1,r2,r3;

void test (void)
{
       r = r1 + r2 + r3;
}
-----------------------------------------------
>How-To-Repeat:
Compile attached file with command line 
> > sh-coff-g++ -S -g -O2 test_code.cpp
>Fix:
I dont have the fix.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test_code.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test_code.cpp"

dHlwZWRlZiBpbnQgaW50MzI7DQp0eXBlZGVmIGludDMyIHJlYWxfY29uc3RfdDsNCg0KY2xhc3Mg
cmVhbA0Kew0KcHJpdmF0ZToNCiAgaW50MzIgdmFsdWU7DQoNCnB1YmxpYzoNCiAgcmVhbCh2b2lk
KSB7fQ0KICByZWFsKGNvbnN0IHJlYWwgJiB6X2EpIHt2YWx1ZSA9IHpfYS52YWx1ZTt9DQogIGZy
aWVuZCByZWFsIG9wZXJhdG9yKyAocmVhbCwgcmVhbCk7DQp9Ow0KDQppbmxpbmUgcmVhbCBvcGVy
YXRvcisgKHJlYWwgel9hLCByZWFsIHpfYikNCnsNCiAgcmVhbCB0ZW1wOw0KICB0ZW1wLnZhbHVl
ID0gKHpfYS52YWx1ZSkgKyAoel9iLnZhbHVlKTsNCiAgcmV0dXJuIHRlbXA7DQp9DQoNCnJlYWwg
cixyMSxyMixyMzsNCg0Kdm9pZCB0ZXN0ICh2b2lkKQ0Kew0KICAgICAgIHIgPSByMSArIHIyICsg
cjM7DQp9DQo=



More information about the Gcc-bugs mailing list