subscripted value is neither array nor pointer

Peter Jordan pjordan@noname.blackwire.com
Sun Mar 12 22:46:00 GMT 2000


Hi,


../../../lib/ext2fs/swapfs.c: In function `ext2fs_swap_inode':
../../../lib/ext2fs/swapfs.c:119: subscripted value is neither array nor pointer

	Ran into problems when trying to build e2fsprogs-1.18.tar.gz.

Went back to e2fsprogs-1.12 and e2fsprogs-1.15 and had the same problem.
The lines in question haven't changed.

They are (119-121) :

                t->osd2.linux2.l_i_reserved2[0] =
                        ext2fs_swab32(f->osd2.linux2.l_i_reserved2[0]);
                t->osd2.linux2.l_i_reserved2[1] =
                        ext2fs_swab32(f->osd2.linux2.l_i_reserved2[1]);


It seems to me that l_i_reserved which is of type __u32,
can not be accessed byte wise anymore, it worked in

littleone:/usr/src/e2fsprogs-1.15/lib/ext2fs#gcc -v
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnu/2.95.1/specs
gcc version 2.95.1 19990816 (release)

BUt I am now using:

noname:/usr/src/e2fsprogs-1.18#gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/2.96/specs
gcc version 2.96 20000306 (experimental)


		Can anyone help me out with a workaround.
I have already submitted a bug report to the e2fsprogs maintainer.

(several days ago with no word, I imagine he thinks it's my fault for
using an 'experimental' gcc)

The compiler dies with the following error:

make[1]: Entering directory `/usr/src/e2fsprogs-1.18/build/lib/ext2fs'
cc  -DHAVE_LINUX_FS_H=1 -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDARG_H=1 -DHAVE_ERRNO_H=1 -DHAVE_MALLOC_H=1 -DHAVE_MNTENT_H=1 -DHAVE_PATHS_H=1 -DHAVE_DIRENT_H=1 -DHAVE_GETOPT_H=1 -DHAVE_SETJMP_H=1 -DHAVE_SIGNAL_H=1 -DHAVE_TERMIOS_H=1 -DHAVE_LINUX_FD_H=1 -DHAVE_LINUX_MAJOR_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_NET_IF_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_VPRINTF=1
-DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DSIZEOF_LONG_LONG=8 -DHAVE_GETRUSAGE=1 -DHAVE_LLSEEK=1 -DHAVE_STRDUP=1 -DHAVE_STRCASECMP=1 -DHAVE_SRANDOM=1 -DHAVE_FCHOWN=1 -DHAVE_MALLINFO=1 -DHAVE_INO_T=1 -DHAVE_EXT2_IOCTLS=1   -g -O2  -I../../lib -I../../../lib   -c ../../../lib/ext2fs/swapfs.c -o swapfs.o
../../../lib/ext2fs/swapfs.c: In function `ext2fs_swap_inode':
../../../lib/ext2fs/swapfs.c:119: subscripted value is neither array nor pointer../../../lib/ext2fs/swapfs.c:120: subscripted value is neither array nor pointer../../../lib/ext2fs/swapfs.c:121: subscripted value is neither array nor pointer../../../lib/ext2fs/swapfs.c:122: subscripted value is neither array nor pointermake[1]: *** [swapfs.o] Error 1
make[1]: Leaving directory `/usr/src/e2fsprogs-1.18/build/lib/ext2fs'
make: *** [all-libs-recursive] Error 1


In /usr/src/e2fsprogs-1.18/include/linux/ext2_fs.h I find the following:
Lines 219-277:

struct ext2_inode {
	__u16	i_mode;		/* File mode */
	__u16	i_uid;		/* Owner Uid */
	__u32	i_size;		/* Size in bytes */
	__u32	i_atime;	/* Access time */
	__u32	i_ctime;	/* Creation time */
	__u32	i_mtime;	/* Modification time */
	__u32	i_dtime;	/* Deletion Time */
	__u16	i_gid;		/* Group Id */
	__u16	i_links_count;	/* Links count */
	__u32	i_blocks;	/* Blocks count */
	__u32	i_flags;	/* File flags */
	union {
		struct {
			__u32  l_i_reserved1;
		} linux1;
		struct {
			__u32  h_i_translator;
		} hurd1;
		struct {
			__u32  m_i_reserved1;
		} masix1;
	} osd1;				/* OS dependent 1 */
	__u32	i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
	__u32	i_version;	/* File version (for NFS) */
	__u32	i_file_acl;	/* File ACL */
	__u32	i_dir_acl;	/* Directory ACL */
	__u32	i_faddr;	/* Fragment address */
	union {
		struct {
			__u8	l_i_frag;	/* Fragment number */
			__u8	l_i_fsize;	/* Fragment size */
			__u16	i_pad1;
			__u32	l_i_reserved2[2];
		} linux2;
		struct {
			__u8	h_i_frag;	/* Fragment number */
			__u8	h_i_fsize;	/* Fragment size */
			__u16	h_i_mode_high;
			__u16	h_i_uid_high;
			__u16	h_i_gid_high;
			__u32	h_i_author;
		} hurd2;
		struct {
			__u8	m_i_frag;	/* Fragment number */
			__u8	m_i_fsize;	/* Fragment size */
			__u16	m_pad1;
			__u32	m_i_reserved2[2];
		} masix2;
	} osd2;				/* OS dependent 2 */
};

#define i_size_high     i_dir_acl

#if defined(__KERNEL__) || defined(__linux__)
#define i_reserved1     osd1.linux1.l_i_reserved1
#define i_frag          osd2.linux2.l_i_frag
#define i_fsize         osd2.linux2.l_i_fsize
#define i_reserved2     osd2.linux2.l_i_reserved2


Regards,

Peter


More information about the Gcc mailing list