This is the mail archive of the gcc-bugs@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]

gcc reports syntax errors before doing a segmentation fault.


Originator
	Ken Fuchs

Organization
	SBS Technologies, Inc.

Confidential
	no

Synopsis
	gcc reports syntax errors before doing a segmentation fault.

Severity
	serious

Priority
	low

Category
	c

Class
	sw-bug

Release
	# gcc -v
	Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
	gcc version 2.96 20000731 (Red Hat Linux 7.0)
	#

Environment
	Celeron 450MHz, i810e, and
      Red Hat Linux 7.0 complete install.
	No changes made to install, except standard
	administrative things.

Description
	gcc reports syntax errors before doing a segmentation fault
	in response to the following command:

cc -O2 -g -DDEBUG -fno-strength-reduce   -Wall -Wstrict-prototypes
-I../include -I/usr/src/linux-2.2.16-22/include -D__KERNEL__ -DMODULE
-DEXPORT_SYMTAB -DBT1003  -c -o btp_open.o btp_open.c

After pasting this command into an emacs inferior shell and pressing CR,
the following output is generated (segmentation fault at the end).  The
inferior shell obscures the original command line, replicating parts of
the command followed by spaces and ^H characters.  A simple xterm shell
given the same command line (I typed in in character by character) generates
the same gcc output without these annoying changes to the command line.
Emacs must be making these annoying changes to the inferior shell buffer
AFTER the command has been sent to the inferior shell for processing.

# cc -O2 -g -DDEBUG -fno-strength-reduce   -Wall -Wstrict-prot<-DDEBUG
-fno-strength-reduce   -Wall -Wstrict-proto
types -I../include -I/usr<ce   -Wall
-Wstrict-prototypes -I../include -I/usr/
src/linux-2.2.16-22/inclu<ypes -I../include
-I/usr/src/linux-2.2.16-22/includ
e -D__KERNEL__ -DMODULE
-<rc/linux-2.2.16-22/include -D__KERNEL__ -DMODULE -D
EXPORT_SYMTAB -DBT1003  -< -D__KERNEL__ -DMODULE
-DEXPORT_SYMTAB -DBT1003  -c
 -o btp_open.o btp_open.c
In file included from
/usr/src/linux-2.2.16-22/include/linux/modversions.h:50,
                 from /usr/src/linux-2.2.16-22/include/linux/module.h:19,
                 from btp_open.c:25:
/usr/src/linux-2.2.16-22/include/linux/modules/i386_ksyms.ver:6:18: warning:
"cpu_data" redefined
/usr/src/linux-2.2.16-22/include/asm/processor.h:96:1: warning: this is the
location of the previous definition
/usr/src/linux-2.2.16-22/include/linux/modules/i386_ksyms.ver:28:22:
warning: "smp_num_cpus" redefined
/usr/src/linux-2.2.16-22/include/linux/smp.h:77:1: warning: this is the
location of the previous definition
/usr/src/linux-2.2.16-22/include/linux/modules/i386_ksyms.ver:118:27:
warning: "smp_call_function" redefined
/usr/src/linux-2.2.16-22/include/linux/smp.h:83:1: warning: this is the
location of the previous definition
In file included from btdd.h:91,
                 from btp_open.c:25:
/usr/src/linux-2.2.16-22/include/asm/semaphore.h:54: parse error before
`semaphore_wake_lock'
/usr/src/linux-2.2.16-22/include/asm/semaphore.h:54: warning: type defaults
to `int' in declaration of `semaphore_wake_lock'
/usr/src/linux-2.2.16-22/include/asm/semaphore.h:54: warning: data
definition has no type or storage class
In file included from btp_open.c:25:
btdd.h:1394: parse error before `spinlock_t'
btdd.h:1394: warning: no semicolon at end of struct or union
btdd.h:1396: parse error before `}'
btdd.h:1396: warning: type defaults to `int' in declaration of `bt_mutex_t'
btdd.h:1396: warning: data definition has no type or storage class
btdd.h:1421: parse error before `spinlock_t'
btdd.h:1421: warning: no semicolon at end of struct or union
btdd.h:1422: warning: type defaults to `int' in declaration of `bt_rwlock_t'
btdd.h:1422: warning: data definition has no type or storage class
In file included from /usr/src/linux-2.2.16-22/include/linux/tty.h:24,
                 from /usr/src/linux-2.2.16-22/include/linux/sched.h:22,
                 from btpdd.h:37,
                 from btdd.h:1427,
                 from btp_open.c:25:
/usr/src/linux-2.2.16-22/include/linux/tqueue.h:78: parse error before
`tqueue_lock'
/usr/src/linux-2.2.16-22/include/linux/tqueue.h:78: warning: type defaults
to `int' in declaration of `tqueue_lock'
/usr/src/linux-2.2.16-22/include/linux/tqueue.h:78: warning: data definition
has no type or storage class
/usr/src/linux-2.2.16-22/include/linux/tqueue.h: In function `queue_task':
/usr/src/linux-2.2.16-22/include/linux/tqueue.h:88: warning: implicit
declaration of function `spin_lock_irqsave'
/usr/src/linux-2.2.16-22/include/linux/tqueue.h:91: warning: implicit
declaration of function `spin_unlock_irqrestore'
In file included from /usr/src/linux-2.2.16-22/include/linux/sched.h:22,
                 from btpdd.h:37,
                 from btdd.h:1427,
                 from btp_open.c:25:
/usr/src/linux-2.2.16-22/include/linux/tty.h: At top level:
/usr/src/linux-2.2.16-22/include/linux/tty.h:308: parse error before
`spinlock_t'
/usr/src/linux-2.2.16-22/include/linux/tty.h:308: warning: no semicolon at
end of struct or union
In file included from btpdd.h:37,
                 from btdd.h:1427,
                 from btp_open.c:25:
/usr/src/linux-2.2.16-22/include/linux/sched.h:110: parse error before
`tasklist_lock'
/usr/src/linux-2.2.16-22/include/linux/sched.h:110: warning: type defaults
to `int' in declaration of `tasklist_lock'
/usr/src/linux-2.2.16-22/include/linux/sched.h:110: warning: data definition
has no type or storage class
/usr/src/linux-2.2.16-22/include/linux/sched.h:111: parse error before
`runqueue_lock'
/usr/src/linux-2.2.16-22/include/linux/sched.h:111: warning: type defaults
to `int' in declaration of `runqueue_lock'
/usr/src/linux-2.2.16-22/include/linux/sched.h:111: warning: data definition
has no type or storage class
/usr/src/linux-2.2.16-22/include/linux/sched.h:214: parse error before
`spinlock_t'
/usr/src/linux-2.2.16-22/include/linux/sched.h:214: warning: no semicolon at
end of struct or union
/usr/src/linux-2.2.16-22/include/linux/sched.h:322: parse error before
`spinlock_t'
/usr/src/linux-2.2.16-22/include/linux/sched.h:322: warning: no semicolon at
end of struct or union
/usr/src/linux-2.2.16-22/include/linux/sched.h:335: parse error before `}'
/usr/src/linux-2.2.16-22/include/linux/sched.h:406: field `task' has
incomplete type
/usr/src/linux-2.2.16-22/include/linux/sched.h:408: Internal error:
Segmentation fault.
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
#

How-To-Repeat
	The option -save-temps was added to the above mentioned
      command line giving the command line below and the attached
      bzip2 compressed btp_open.i file which should encapsulate
	all the header files and c source used to generate the
	segmentation fault.  The attached file is MIME encoded.

cc -save-temps -O2 -g -DDEBUG -fno-strength-reduce   -Wall
-Wstrict-prototypes -I../include -I/usr/src/linux-2.2.16-22/include
-D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -DBT1003  -c -o btp_open.o btp_open.c


Fix
	It appears that gcc must be modified to correct this problem,
	given that the source code does not change.

	Removal of the "#define __ASM_SPINLOCK_H" statement in btdd.h
	allows successful compilation with four redefinition warnings:

# cc -O2 -g -DDEBUG -fno-strength-reduce   -Wall -Wstrict-prot<-DDEBUG
-fno-strength-reduce   -Wall -Wstrict-proto
types -I../include -I/usr<ce   -Wall
-Wstrict-prototypes -I../include -I/usr/
src/linux-2.2.16-22/inclu<ypes -I../include
-I/usr/src/linux-2.2.16-22/includ
e -D__KERNEL__ -DMODULE
-<rc/linux-2.2.16-22/include -D__KERNEL__ -DMODULE -D
EXPORT_SYMTAB -DBT1003  -< -D__KERNEL__ -DMODULE
-DEXPORT_SYMTAB -DBT1003  -c
 -o btp_open.o btp_open.c
In file included from
/usr/src/linux-2.2.16-22/include/linux/modversions.h:50,
                 from /usr/src/linux-2.2.16-22/include/linux/module.h:19,
                 from btp_open.c:25:
/usr/src/linux-2.2.16-22/include/linux/modules/i386_ksyms.ver:6:18: warning:
"cpu_data" redefined
/usr/src/linux-2.2.16-22/include/asm/processor.h:96:1: warning: this is the
location of the previous definition
/usr/src/linux-2.2.16-22/include/linux/modules/i386_ksyms.ver:28:22:
warning: "smp_num_cpus" redefined
/usr/src/linux-2.2.16-22/include/linux/smp.h:77:1: warning: this is the
location of the previous definition
/usr/src/linux-2.2.16-22/include/linux/modules/i386_ksyms.ver:118:27:
warning: "smp_call_function" redefined
/usr/src/linux-2.2.16-22/include/linux/smp.h:83:1: warning: this is the
location of the previous definition
#

Sincerely,

Ken Fuchs

SBS Technologies, Connectivity Products
	... solutions for real-time connectivity

Ken Fuchs, Project Engineer
SBS Technologies, Inc., Connectivity Products
1284 Corporate Center Drive, St. Paul MN 55121-1245
Direct:  (651) 905-4755
Main:    (651) 905-4700    Fax:  (651) 905-4701
Email:    kenf@bit3.com    http://www.sbs.com

btp_open.i.bz2


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