This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Update to c9xstatus.html


On Sun, 18 Jun 2000, Martin v. Loewis wrote:

> >> more precise aliasing rules via effective type
> 
> Which feature is that? Does it have to do with -fstrict-aliasing?

I _think_ it's the following: the C89 rules implemented by
-fstrict-aliasing (ISO/IEC 9899:1990 6.3) refer to the "declared type" of
the object; C99 defines the "effective type" to clarify the meaning for
allocated storage.  This is 6.5 in the FDIS

    http://www.cl.cam.ac.uk/~mgk25/volatile/ISO-C-FDIS.1999-04.pdf

but there is a defect report (DR219)

    http://wwwold.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_219.htm

concerning this definition, and until a Technical Corrigendum comes out
fixing the standard in this area it may be difficult to determine what GCC
should do here and whether it does it.

> >> new block scopes for selection and iteration statements
> 
> I guess this refers to the C++ish
> 
>   for(int i=0;i<10;i++)...
> 
> (6.8.5) which is MISSING in GCC. I don't know about any change in the
> selection-statement to this respect, though.

Selection and iteration statements get their own scopes to avoid subtle
problems concerning when certain uses of compound literals are undefined
or not, as well as for the above; see the Rationale for further
information.  It is possible to test this within C89 features (it is
Missing in GCC):

	struct foo {
	  char a;
	};

	int
	sfoo (void)
	{
	  if (sizeof (struct foo { int a; double b; char *c; void *d; }))
	    (void)0;
	  return sizeof (struct foo);
	}

	int
	main (void)
	{
	  int t, u;
	  t = sfoo ();
	  u = sizeof (struct foo);
	  /* With C90 scoping rules the new declaration of struct foo
	     is in scope above; with C99 it is local to the if.
	  */
	  if (t == u)
	    return 0; /* C99 rules apply.  */
	  else
	    abort (); /* C90 rules apply.  */
	}

but the quiet change here is somewhat obscure.

> >> idempotent type qualifiers
> 
> What's that?

A type may have the same type qualifier (const/volatile/restrict) more
than once, with the same effect as having it once, whether directly or
through typedefs.

	typedef const int cint;
	const cint foo;

violates the constraints in ISO/IEC 9899:1990 6.5.3 but is permitted in
C99.  (See obvious patch I sent to turn the pedwarn for this usage off for
C99, as well as some other simple adjustments to GCC's pedantic
behaviour.)

-- 
Joseph S. Myers
jsm28@cam.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]