🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2257

Re: Interaction between storage class and qualifiers

#2257
From: David B.Anderson
Date: Tue, 08 Jan 1991 19:26
43 lines
2141 bytes
In article <1991Jan8.000756.24432@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:
>In article <2760@charon.cwi.nl> jack@cwi.nl (Jack Jansen) writes:
>>The SGI C compiler treats the following two pointers as unequal:

Henry's corrections are appropriate. What started this is a compiler
bug that caused rejection of a legal assignment.

By e-mail, Jack Jensen sent me a complete example:
volatile struct foo { int y; } *ptr;
main() {
    register volatile struct foo *p1;
    volatile register struct foo *p2; /* compiler gets ``wrong struct'' */
    p1 = ptr;
    p2 = ptr; /* compiler rejects this: compiler bug */
}
ccom: Warning: tv2.c, line 11: illegal structure pointer combination
          p2 = ptr;
      ------------^

CHARACTERIZATION: Considering: 
	  X to be volatile, const, int, char, unsigned, struct foo (etc)
		or a combination
	and
	  Y to be register, auto, extern, static, typedef
	then
		X Y X
	would not always get the compiler-internal Node data correct. 
	the type would be right, but other data (like the structure index)
	would come from the first X only and ignore the second.

WORKAROUND: Using
		Y X
	instead is recommended practice and works around the bug. 

FIX:
	This previously unknown bug will be fixed (today) for the next 
	major release (4.0).

Thanks to Jack Jensen for letting us know about the problem.

Sorry for any inconvenience this may have caused....
[ David B. Anderson  Silicon Graphics  (415)335-1548  davea@sgi.com ]
[``What can go wrong?''                           --Calvin to Hobbes]
Technical Details
Message-ID: <80324@sgi.sgi.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!spool2.mu.edu!uunet!decwrl!sgi!davea@quasar.wpd.sgi.com
References: <2760@charon.cwi.nl> <1991Jan8.000756.24432@zoo.toronto.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!spool2.mu.edu!uunet!decwrl!sgi!davea@quasar.wpd.sgi.com
From: davea@quasar.wpd.sgi.com (David B.Anderson)
Newsgroups: comp.std.c
Subject: Re: Interaction between storage class and qualifiers
Message-ID: <80324@sgi.sgi.com>
Date: 8 Jan 91 19:26:26 GMT
References: <2760@charon.cwi.nl> <1991Jan8.000756.24432@zoo.toronto.edu>
Sender: guest@sgi.sgi.com
Reply-To: davea@quasar.UUCP (David B.Anderson)
Organization: Silicon Graphics, Inc., Mountain View, CA
Lines: 43