[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | C++ |
Notice: | Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS) |
Moderator: | DECCXX::AMARTIN |
|
Created: | Fri Nov 06 1987 |
Last Modified: | Thu Jun 05 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3604 |
Total number of notes: | 18242 |
3460.0. "Internal compiler error detected at line 7071" by NETRIX::"[email protected]" (Roberto Romani) Sun Feb 23 1997 18:12
Hello All,
I am getting the following error message from some customer code
# cxx -v at_ParamClient.cxx
/usr/lib/cmplrs/cxx/gemc_cxx -g0 -O2 -thread_safe
-Xirf./cxx_repository/slashroot.stl.dec.comaaseba -ptr./cxx_repository -
ptsuf.cxx.CXX.C.cc.CC.cpp.c -Xsd./ -o at_ParamClient.o at_ParamClient.cxx
Internal compiler error detected at line 7071 in file
/usr/proj/decc2/v55_cxx/src/cxxfe/cxsymtab.c.
cxx: Fatal: A memory access violation (bus error or segmentation fault)
has occurred. Please submit a problem report.
0.20u 0.05s 0:00.5 50%
#cxx -v at_ParamClient.cxx
cxx (cxx)
DEC C++ V5.5-004 on Digital UNIX (Alpha)
Internal compiler error detected at line 7071 in file
/usr/proj/decc2/v55_cxx/src/cxxfe/cxsymtab.c.
cxx: Fatal: A memory access violation (bus error or segmentation fault)
has occurred. Please submit a problem report.
Here is the cxx and hxx files which produced the internal error
// at_ParamClient.cxx
#include <string.h>
#include "at_ParamClient.hxx"
//////////////////////////////////////////////////////////////////////
at_ParamClient::at_ParamClient(const char* moduleName,
at_ParamClient::ParamSpec* paramSpecPtr
){
itsSpecPtr = paramSpecPtr;
itsModule = new char[strlen(moduleName)+1];
strcpy(itsModule,moduleName);
update();
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::update(){
int i = 0;
while(itsSpecPtr[i].itsParamType != ParamSpec::NULL_PARAM){
update(i);
i++;
}
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::update(char* parName){
int i = 0;
while(itsSpecPtr[i].itsParamType != ParamSpec::NULL_PARAM){
if(itsSpecPtr[i].itsName == parName){
update(i);
}
i++;
}
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::update(int i){
if(itsSpecPtr[i].itsName == "A"){
char* inChar = "A test";
int j = strlen(inChar);
switch(itsSpecPtr[i].itsParamType){
case ParamSpec::CHAR_PARAM:
if(j > itsSpecPtr[i].itsCharLen){
throw ExTooLong(inChar);
}
itsSpecPtr[i].itsPtr.pc = new char [j];
strcpy(itsSpecPtr->itsPtr.pc,inChar);
break;
case ParamSpec::UINT_PARAM:
*itsSpecPtr[i].itsPtr.pu = 3;
break;
case ParamSpec::INT_PARAM:
*itsSpecPtr[i].itsPtr.pi = 4;
break;
case ParamSpec::FLT_PARAM:
*itsSpecPtr[i].itsPtr.pf = 5.5f;
};
} else if(itsSpecPtr[i].itsName == "B"){
char* inChar = "B test";
int j = strlen(inChar);
switch(itsSpecPtr[i].itsParamType){
case ParamSpec::CHAR_PARAM:
if(j > itsSpecPtr[i].itsCharLen){
throw ExTooLong(inChar);
}
itsSpecPtr[i].itsPtr.pc = new char [j];
strcpy(itsSpecPtr->itsPtr.pc,inChar);
break;
case ParamSpec::UINT_PARAM:
*itsSpecPtr[i].itsPtr.pu = 33;
break;
case ParamSpec::INT_PARAM:
*itsSpecPtr[i].itsPtr.pi = 34;
break;
case ParamSpec::FLT_PARAM:
*itsSpecPtr[i].itsPtr.pf = 35.5f;
};
}
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::~at_ParamClient(){
delete [] itsModule;
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::ParamSpec(){
itsParamType = ParamSpec::NULL_PARAM;
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::ParamSpec(const char* paramName,
char* paramPtr,
unsigned int maxLen){
itsParamType = CHAR_PARAM;
itsPtr.pc = paramPtr;
itsName = paramName;
itsCharLen = maxLen;
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::ParamSpec(
const char* paramName,
unsigned int* paramPtr,
unsigned int minValue,
unsigned int maxValue
){
itsParamType = UINT_PARAM;
itsName = paramName;
itsPtr.pu = paramPtr;
itsMin.minu = minValue;
itsMax.maxu = maxValue;
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::ParamSpec(
const char* paramName,
unsigned int* paramPtr
){
itsParamType = UINT_PARAM;
itsName = paramName;
itsPtr.pu = paramPtr;
itsMin.minu = 0;
itsMax.maxu = 0;
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::ParamSpec(
const char* paramName,
int* paramPtr,
int minValue,
int maxValue
){
itsParamType = INT_PARAM;
itsName = paramName;
itsPtr.pi = paramPtr;
itsMin.mini = minValue;
itsMax.maxi = maxValue;
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::ParamSpec(
const char* paramName,
int* paramPtr,
int minValue,
int maxValue
){
itsParamType = INT_PARAM;
itsName = paramName;
itsPtr.pi = paramPtr;
itsMin.mini = 0;
itsMax.maxi = 0;
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::ParamSpec(
const char* paramName,
float* paramPtr,
float minValue,
float maxValue
){
itsParamType = FLT_PARAM;
itsName = paramName;
itsPtr.pf = paramPtr;
itsMin.minf = minValue;
itsMax.maxf = maxValue;
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::ParamSpec(
const char* paramName,
float* paramPtr,
float minValue,
float maxValue
){
itsParamType = FLT_PARAM;
itsName = paramName;
itsPtr.pf = paramPtr;
itsMin.minf = 0.0f;
itsMax.maxf = 0.0f;
}
//////////////////////////////////////////////////////////////////////
at_ParamClient::~ParamSpec()
{
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Header file +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//# at_ParamClient.hxx
//#
//# --------------------------------
//# ATOMS COPYRIGHT NOTICE GOES HERE
//# --------------------------------
//# $Id:$
#ifndef AT_PARAM_CLIENT_HXX
#define AT_PARAM_CLIENT_HXX
#include <errno.h>
// <reviewed reviewer="" date="" tests="" demos="">
// Author: David G Loone<br>
// Last modified: 10-Feb-1997
// </reviewed>
// <etymology>
// <samp>at_ParamClient stands for "Parameter Server Client".
// </etymology>
// <prerequisite>
// </prerequisite>
// <synopsis>
// This class implements the Parameter Server client.
// It is used to obtain run-time parameters from a parameter server.
//
// The parameter server is a central repository of name-value pairs,
// which are served to any process which wants them. The name-value
// pairs are organised into modules, where each module has a unique
// name across the system.
//
// The <samp>ParamClient</samp> class is used to register interest
// in a parameter server module, and retrieve a subset of the
// parameter values contained within that module.
//
// An example of usage of the class follows.
// If the parameter server contains information for a module
// called <samp>myModule</samp> which contains (possibly among
// others) three parameters. There is an unsigned integer called
// <samp>queLen</samp> (which we want to limit to being between
// 5 and 200), an unsigned integer called <samp>timeout</samp>
// and a string called <samp>labelName</samp>.
//
// The program would contain a declaration like:
// <srcblock>
// unsigned int queLen;
// unsigned int timeout;
// char* labelName[30];
// at_ParamClient::ParamSpec[] myModuleParamsSpec = {
// at_ParamClient::ParamSpec("queLen",&queLen,5,200),
// at_ParamClient::ParamSpec("timeout",&timeout),
// at_ParamClient::ParamSpec("labelname,labelName,30)
// }
// at_ParamClient myModuleParams = at_ParamClient(&myModuleParamsSpec);
// </srcblock>
// This last line will fill in the three variables
// <samp>queLen</samp>,
// <samp>timeout</samp> and
// <samp>labelName</samp>
// from the parameter server.
// If any of the parameters is not verified
// (<em>eg</em> an integer is out of range, or a string is
// too long)
// then an excption is thrown.
//
// Any or all of these three variables can be updated from the
// parameter server by calling the <samp>update</samp> method.
// Specifying the <samp>update</samp> method with no parameters
// will up date all parameters listed in the
// <samp>myModuleParams</samp> array. If the <samp>update</samp>
// method is called with the name of a parameter, then just that
// parameter is updated.
//
// The form of the parameter server is not documented here.
// Simple forms of <samp>at_ParamClient</samp> may do something
// as simple as reading the values from a file, or even have them
// hard coded internally.
// </synopsis>
// <todo asof="">
// </todo>
class at_ParamClient {
public:
// Exception.
//
// Indicates that the parameter value received from the parameter
// server is out of range.
class ExOutOfRange {
public:
// The name of the parameter.
const char* name;
// Constructor.
ExOutOfRange(
const char* name
):
name(name)
{}
};
// Exception.
//
// Indicates that the parameter value received was too long.
class ExTooLong {
public:
// The name of the parameter.
const char* name;
// Constructor.
ExTooLong(
const char* name
):
name(name)
{}
};
// Exception.
//
// Indicates that the parameter value received from the parameter
// server is out of range.
class ExInvalid {
public:
// The name of the parameter.
const char* name;
// Constructor.
ExInvalid(
const char* name
):
name(name)
{}
};
// Specifies attributes for one parameter.
// The <samp>at_ParamClient</samp> expects to be passed an
// array of <samp>ParamSpec</samp> objects when it is created.
// There will be one element of this array for each
// parameter the module is interested in,
// plus a null entry at the end of the array.
class ParamSpec {
friend class at_ParamClient;
public:
// Constructor.
//
// Constructor for a null parameter specification.
// Use this to terminate the array of parameter specifications.
ParamSpec();
// Constructor.
//
// Constructor for a parameter specification for a string.
//
// <h3>Parameters:</h3>
// <ul>
// <li><samp>paramName</samp>:
// The name of the parameter.
// <li><samp>paramPtr</samp>:
// The address of the char array to receive the string
// parameter.
// <li><samp>maxLen</samp>:
// The maximum length (including the null terminating character)
// of the string parameter.
// </ul>
ParamSpec(
const char* paramName,
char* paramPtr,
unsigned int maxLen
);
// Constructor.
//
// Constructor for a parameter specification for an unsigned
// integer with up and lower bounds checking.
//
// <h3>Parameters:</h3>
// <ul>
// <li><samp>paramName</samp>:
// The name of the parameter.
// <li><samp>paramPtr</samp>:
// The address of the unsigned integer variable to receive
// the parameter.
// <li><samp>minValue</samp>:
// The minimum value of the parameter.
// <li><samp>maxValue</samp>:
// The maximum calue of the parameter.
// </ul>
ParamSpec(
const char* paramName,
unsigned int* paramPtr,
unsigned int minValue,
unsigned int maxValue
);
// Constructor.
//
// Constructor for a parameter specification for an unsigned
// integer wiht no bounds checking.
//
// <h3>Parameters:</h3>
// <ul>
// <li><samp>paramName</samp>:
// The name of the parameter.
// <li><samp>paramPtr</samp>:
// The address of the unsigned integer variable to receive
// the parameter.
// </ul>
ParamSpec(
const char* paramName,
unsigned int* paramPtr
);
// Constructor.
//
// Constructor for a parameter specfication for an integer with
// upper and lower bounds checking.
//
// <h3>Parameters:</h3>
// <ul>
// <li><samp>paramName</samp>:
// The name of the parameter.
// <li><samp>paramPtr</samp>:
// The address of the integer variable to receive the
// parameter.
// <li><samp>minValue</samp>:
// The minimum value of the parameter.
// <li><samp>maxValue</samp>:
// The maximum calue of the parameter.
// </ul>
ParamSpec(
const char* paramName,
int* paramPtr,
int minValue,
int maxValue
);
// Constructor.
//
// Constructor for a parameter specfication for an integer with no
// bounds checking.
//
// <h3>Parameters:</h3>
// <ul>
// <li><samp>paramName</samp>:
// The name of the parameter.
// <li><samp>paramPtr</samp>:
// The address of the integer variable to receive the
// parameter.
// </ul>
ParamSpec(
const char* paramName,
int* paramPtr
);
// Constructor.
//
// Constructor for a parameter specification for a float with
// upper and lower bounds checking.
//
// <h3>Parameters:</h3>
// <ul>
// <li><samp>paramName</samp>:
// The name of the parameter.
// <li><samp>paramPtr</samp>:
// The address of the float variable to receive the
// parameter.
// <li><samp>minValue</samp>:
// The minimum value of the parameter.
// <li><samp>maxValue</samp>:
// The maximum calue of the parameter.
// </ul>
ParamSpec(
const char* paramName,
float* paramPtr,
float minValue,
float maxValue
);
// Constructor.
//
// Constructor for a parameter specification for a float with
// no bounds checking.
//
// <h3>Parameters:</h3>
// <ul>
// <li><samp>paramName</samp>:
// The name of the parameter.
// <li><samp>paramPtr</samp>:
// The address of the float variable to receive the
// parameter.
// </ul>
ParamSpec(
const char* paramName,
float* paramPtr
);
private:
// Define parameter type codes:
enum paramType {
NULL_PARAM,
CHAR_PARAM,
UINT_PARAM,
INT_PARAM,
FLT_PARAM
};
// Define private class data members.
// Parameter name:
char* itsName;
// Parameter type:
paramType itsParamType;
// Max length for character type parameters:
unsigned int itsCharLen;
// Pointers to the parameters, overlayed in a union:
union uPtr {
char* pc;
unsigned int* pu;
int* pi;
float* pf;
};
uPtr itsPtr;
// Minima for range checked parameters, different types combined in
union:
union uMin {
unsigned int minu;
int mini;
float minf;
};
uMin itsMin;
// Maxima for range checked parameters, different types combined in
union:
union uMax {
unsigned int maxu;
int maxi;
float maxf;
};
uMax itsMax;
};
// Constructor.
//
// Creates a new <samp>at_ParamClient</samp> object,
// which will obtain parameters from the parameter server for
// a single module.
//
// On construction, the object fills in all the variables refered
// to in the array of <samp>ParameterSpec</samp> objects from
// the parameter server, and validates them against the information
// given in that structure.
//
// <h3>Parameters:</h3>
// <ul>
// <li><samp>moduleName</samp>:
// The name of the module this object is interested in.
// A single <samp>at_ParamClient</samp> object can only retrieve
// parameters for a single module.
// <li><samp>paramSpecPtr</samp>:
// The list of parameter specifications,
// terminated by a null entry
// (a ParamSpec made with default constructor).
// </ul>
at_ParamClient(
const char* moduleName,
ParamSpec* paramSpecPtr
)
throw(
ExOutOfRange,
ExTooLong,
ExInvalid
);
// Destructor.
//
// Deletes a <samp>at_ParamClient</samp> object.
~at_ParamClient();
// Update all parameters in this module.
update()
throw(
ExOutOfRange,
ExTooLong,
ExInvalid
);
// Destructor.
//
// Deletes a <samp>at_ParamClient</samp> object.
~at_ParamClient();
// Update all parameters in this module.
update()
throw(
ExOutOfRange,
ExTooLong,
ExInvalid
);
// Update a single parameter in this module.
//
// <h3>Parameters</h3>
// <ul>
// <li><samp>paramName</samp>:
// The name of the parameter to update.
// </ul>
update(
char* paramName
)
throw(
ExOutOfRange,
ExTooLong,
ExInvalid
);
private:
ParamSpec* itsSpecPtr;
char* itsModule;
update(
int index
)
throw(
ExOutOfRange,
ExTooLong,
ExInvalid
);
};
#endif
regards
Roberto Romani
Sydney TSC
Australia
[Posted by WWW Notes gateway]
T.R | Title | User | Personal Name | Date | Lines |
---|
3460.1 | Internal compiler error should have been detected as user error | DECC::J_WARD | | Mon Feb 24 1997 09:01 | 23 |
| /*
cxx shouldn't give you an internal error,
but there is a valid user error in the program.
(which cxx should have told you about...)
Once you fix it, I think the problem should
go away. I believe there a number of places
in the .cxx file where it the ParamSpec
definitions need to be fixed. See below...
*/
struct at_ParamClient {
struct ParamSpec {
ParamSpec();
};
};
/*ERROR HERE*/
at_ParamClient::ParamSpec(){;}
// I think the above should be:
//at_ParamClient::ParamSpec::ParamSpec() {;}
|