[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#187091: gcc-3.2: restrict is broken in C99 mode

Package: gcc-3.2
Version: 1:3.2.3-0pre6
Severity: normal

When I compile certain files (a testcase is attached), gcc fails to
compile with the following error:
broken-restrict.c:25: invalid use of `restrict'
I am sure this is a valid use of restrict because I have seen it used in
(SUSv3), which is aligned with C99. In fact, that page says, in part:

	The restrict keyword is added to the lio_listio() prototype for
	alignment with the ISO/IEC 9899:1999 standard.

It also fails to compile with the snapshot (with the same error).

You can compile this with:
"gcc -std=c99 -c broken-restrict.c" and it will break or you can use
"gcc -DRESTRICT_IS_FUCKED -std=c99 -c broken-restrict.c" and it will

I've pretty much narrowed it down to the restrict in the brackets (if
you put them on a new line, you will see that they are the cause of the
syntax error).

6ba722aec61848d0b8bad883741f8f7e *broken-restrict.c

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux stonewall 2.4.20-1-k7 #1 Sat Mar 22 15:17:52 EST 2003 i686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8

Versions of packages gcc-3.2 depends on:
ii  binutils       The GNU assembler, linker and bina
ii  cpp-3.2                 1:3.2.3-0pre6    The GNU C preprocessor
ii  gcc-3.2-base            1:3.2.3-0pre6    The GNU Compiler Collection (base 
ii  libc6                   2.3.1-16         GNU C Library: Shared libraries an
ii  libgcc1                 1:3.2.3-0pre6    GCC support library

-- no debconf information

Brian M. Carlson <sandals@crustytoothpaste.ath.cx> 0x560553e7
"Let us think the unthinkable, let us do the undoable. Let us prepare
 to grapple with the ineffable itself, and see if we may not eff it
 after all." --Douglas Adams
/* vim: set si ai ts=4 sw=4 uc=0 tw=80 noet: */
/* public domain. no warranty. */

/* See
 * <http://www.opengroup.org/onlinepubs/007904975/functions/lio_listio.html>
 * for SUSv3's description of lio_listio().

/* This is based on lio_listio(). */

struct foo
	char *x;

struct bar
	int *x;

int foo_lio_listio(int mode,
		struct foo *const list[],
		struct foo *restrict const list[restrict],
		int nent,
		struct bar *sig)
		struct bar *restrict sig)
	return 0;

Attachment: pgp7rhKoxaugA.pgp
Description: PGP signature

Reply to: