Thread View: gnu.g++
1 messages
1 total messages
Started by Bala Rajaraman
Fri, 05 Jan 1990 01:40
Fatal signal to cc1plus
Author: Bala Rajaraman
Date: Fri, 05 Jan 1990 01:40
Date: Fri, 05 Jan 1990 01:40
76 lines
2642 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads