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++/518: g++ generates illegal code with -mcpu=ultrasparc on SparcV9



>Number:         518
>Category:       c++
>Synopsis:       g++ generates illegal code with -mcpu=ultrasparc on SparcV9
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 08 12:26:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Torsten Rohlfing
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
Sun Ultra10, Solaris7
>Description:
When compiling with the -mcpu=ultrasparc flag and optimization
(-O), g++ creates a binary file that will terminate with a
"bus error".

A minimal test case is included as an attachment. Even minor
changes (removing parameters with default values, changing
default values, removing comparisons etc) make the problem
disappear.

The Makefile sent under "How-To-Repeat" generates two binaries
from the same source - one with ultrasparc-specific code and
one with the default settings. The binary "bug" will crash, 
while "bug_d" will run without a problem.
>How-To-Repeat:
Use these commands:

g++ -Wall -O -mcpu=ultrasparc -o bug bug.cxx
g++ -Wall -O -o bug_d bug.cxx

to compile this C++ source:

// bug.cxx

class A {
public:
  int f ( double& d0, double& d1, const int i, 
	  double d2 = 0, double d3 = 1 );
};

int A::f ( double& d0, double& d1, const int i, 
	   double d2, double d3 )
{
  return 0;
}

A a;

class B {
public:
  int f ( int i0, int i1 )
  {
    double d0, d1;
    a.f( d0, d1, 0 );

    
    if ( d0 > 1.0 ) {
      i1 = 1;
    };
    
    return (i0 < i1 );
  }

};

int main ( int argc, char *argv[] )
{
  B b;

  int i0, i1;
  b.f( i0, i1 );

  return 0;
}


>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]