🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41905

HELP: Segment Violation When Combining C/C++ codes

#41905
From: ketan shah
Date: Mon, 12 Feb 1996 00:00
23 lines
907 bytes
Hi,

I am getting segment violation on following C code being called from C++ routine, 
when compiled on SunOS 4.1.3. 

	typedef unsigned char cblock[8];

	void func(key) 
	register cblock key;
	{
    		int i;
    		for (i=0; i<sizeof(cblock); i++) 
      		{
---------->		key[i] &= 0xfe;
			key[i] |= 1^parity_char(key[i]);
      		}
  
    		return;
	}

I get segmentation violation at index 1. 

I would greatly appreciate, any help as to why this error occurs. Thanks in advance.
Technical Details
Message-ID: <4fo514$c93@spruce.citicorp.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,4bfd5ad8e7595ee9,start
X-Google-Attributes: gid11318c,public
From: kshah@citicorp.com (ketan shah)
Subject: HELP: Segment Violation When Combining C/C++ codes
Date: 1996/02/12
Message-ID: <4fo514$c93@spruce.citicorp.com>
X-Deja-AN: 139118688
organization: citibank
reply-to: ketan.shah@citicorp.com
newsgroups: gnu.gcc.help