🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++
Article #487

Fatal signal to cc1plus

#487
From: Bala Rajaraman
Date: Fri, 05 Jan 1990 01:40
76 lines
2642 bytes
Could anyone please tell me what a fatal signal to cc1plus means?
The context is as follows.
	The following programs were used to test accessing of local and
global variables with the same name. I declared the global variable
as a register variable (I know this is wrong, but just testing). The
first program just declares the global variable ii as register and
attempts to access its address. The compiler complains which is OK.
	In the second program the fatal signal to cc1plus arises. Why??

Program 1: tmp.cc
--------------------------------------------------------------------
#include <stdio.h>
#include <stream.h>

register int ii;

main()
{
cout << "Address of ii: " << long(&ii) << "\n";
}
---------------------------------------------------------------------

g++ output: g++ -o tmp tmp.cc
---------------------------------------------------------------------
tmp.cc:4: register name not specified for `ii'
tmp.cc:4: global register variable follows a function definition
In function int main ():
tmp.cc:8: address of global register variable `ii' requested
---------------------------------------------------------------------


Program 2: tmp2.cc
---------------------------------------------------------------------
#include <stdio.h>
#include <stream.h>

int& incr(int&);
register int ii = 20;

main()
{
int ii;

cout << "Address of ii: " << long(&ii) << "\n";
ii = 10;
cout << "ii before: " << ii << "\n";
cout << "II before: " << ::ii << "\n";
incr(ii)++;
cout << "ii before: " << ii << "\n";
cout << "II before: " << ::ii << "\n";
}

int& incr(int& ii)

{
ii++;
return ::ii;
}
---------------------------------------------------------------------


g++ output: g++ -o tmp2 tmp2.cc
---------------------------------------------------------------------
tmp2.cc:5: register name not specified for `ii'
tmp2.cc:5: global register variable has initial value
tmp2.cc:5: global register variable follows a function definition
g++: Program cc1plus got fatal signal 10.
--------------------------------------------------------------------

The second program works ok when the global 'ii' is not declared
register!! 
	Thanks
	Bala
:-)
rajarar@hubcap.clemson.edu
Technical Details
Message-ID: <7569@hubcap.clemson.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!caesar.cs.montana.edu!ogicse!emory!hubcap!rajarar

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!caesar.cs.montana.edu!ogicse!emory!hubcap!rajarar
From: rajarar@hubcap.clemson.edu (Bala Rajaraman)
Newsgroups: gnu.g++
Subject: Fatal signal to cc1plus
Keywords: fatal signal 10
Message-ID: <7569@hubcap.clemson.edu>
Date: 5 Jan 90 01:40:39 GMT
Distribution: na
Organization: Clemson University, Clemson, SC
Lines: 76