This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
patches for BSD/OS and GCC 2.8.0-971225
- To: egcs-bugs at cygnus dot com
- Subject: patches for BSD/OS and GCC 2.8.0-971225
- From: Paul Eggert <eggert at twinsun dot com>
- Date: Sun, 28 Dec 1997 16:07:09 -0800
Date: Sun, 28 Dec 1997 18:53:36 -0500
From: David Edelsohn <dje@watson.ibm.com>
To: Paul Eggert <eggert@twinsun.com>
Are you sending all of your patches to EGCS as well, especially
with EGCS merging in GCC-2.8 changes that appear to be causing
considerable BSD/OS problems?
No, I didn't know about the recent merge; I'm not well plugged into
EGCS, for lack of time. Here are copies of the three recent messages
I've sent to gcc2 on this subject. Sorry about the duplicates, for
those of you on both lists.
From: Paul Eggert <eggert@twinsun.com>
To: gcc2@cygnus.com
Subject: gcc-2.8.0-971225 build failure due to asserts in GCC
gcc-2.8.0-971225 won't build on BSD/OS 3.0 using the native compiler,
which is gcc 2.7.2.1. Here are the symptoms:
gcc -DIN_GCC -g -DHAVE_CONFIG_H -o cc1 c-parse.o ...
except.c:1970: Undefined symbol ___eprintf referenced from text segment
...
dwarf2out.c:570: Undefined symbol ___eprintf referenced from text segment
...
The problem is that some assert calls have crept into the GCC code
over the past few weeks. These don't work properly when compiling
with older versions of GCC, since the assert interface has changed,
and `#include "assert.h"' gets the new assert.h which may not work
with the old compiler. In general, there's no guarantee that GCC's
assert.h will work with the host C compiler, so GCC shouldn't include
assert.h.
The simplest way to work around this problem is to not include
assert.h in GCC proper. It should be OK to include assert.h in objc,
cp, etc., since these are compiled only with GCC.
Here's a proposed patch.
1997-12-27 Paul Eggert <eggert@twinsun.com>
Do not use `assert' in GCC proper, since it might not work
properly when compiling GCC with other compilers, including
older versions of GCC.
* config/arm/arm.c, config/i960/i960.c, config/m88k/m88k.c,
dwarf2out.c, except.c: Do not include assert.h.
* config/i960/i960.c (i960_arg_size_and_align),
config/m88k/m88k.c (expand_block_move),
except.c (scan_region):
Rewrite to avoid assert.
* dwarf2out.c (assert): New macro, since we can't use system assert.
* except.c (save_eh_status, restore_eh_status, scan_region):
Don't bother testing whether pointer is null,
as we'll dump core right away anyway if it isn't.
===================================================================
RCS file: ./config/arm/arm.c,v
retrieving revision 2.8
retrieving revision 2.8.0.1
diff -c -r2.8 -r2.8.0.1
*** ./config/arm/arm.c 1997/12/04 12:00:33 2.8
--- ./config/arm/arm.c 1997/12/28 07:40:17 2.8.0.1
***************
*** 24,30 ****
#include "config.h"
#include <stdio.h>
#include <string.h>
- #include "assert.h"
#include "rtl.h"
#include "regs.h"
#include "hard-reg-set.h"
--- 24,29 ----
===================================================================
RCS file: ./config/i960/i960.c,v
retrieving revision 2.8
retrieving revision 2.8.0.1
diff -c -r2.8 -r2.8.0.1
*** ./config/i960/i960.c 1997/08/22 17:32:03 2.8
--- ./config/i960/i960.c 1997/12/28 07:40:17 2.8.0.1
***************
*** 35,41 ****
#include "flags.h"
#include "tree.h"
#include "insn-codes.h"
- #include "assert.h"
#include "expr.h"
#include "except.h"
#include "function.h"
--- 35,40 ----
***************
*** 2241,2247 ****
else if (mode == VOIDmode)
{
/* End of parm list. */
! assert (type != 0 && TYPE_MODE (type) == VOIDmode);
size = 1;
}
else
--- 2240,2247 ----
else if (mode == VOIDmode)
{
/* End of parm list. */
! if (type == 0 || TYPE_MODE (type) != VOIDmode)
! abort ();
size = 1;
}
else
===================================================================
RCS file: ./config/m88k/m88k.c,v
retrieving revision 2.8
retrieving revision 2.8.0.1
diff -c -r2.8 -r2.8.0.1
*** ./config/m88k/m88k.c 1997/11/16 13:35:32 2.8
--- ./config/m88k/m88k.c 1997/12/28 07:40:17 2.8.0.1
***************
*** 27,33 ****
#include <time.h>
#include <ctype.h>
- #include "assert.h"
#include "rtl.h"
#include "regs.h"
#include "hard-reg-set.h"
--- 27,32 ----
***************
*** 501,509 ****
int bytes = (constp ? INTVAL (operands[2]) : 0);
int target = (int) m88k_cpu;
! assert (PROCESSOR_M88100 == 0);
! assert (PROCESSOR_M88110 == 1);
! assert (PROCESSOR_M88000 == 2);
if (constp && bytes <= 0)
return;
--- 500,509 ----
int bytes = (constp ? INTVAL (operands[2]) : 0);
int target = (int) m88k_cpu;
! if (! (PROCESSOR_M88100 == 0
! && PROCESSOR_M88110 == 1
! && PROCESSOR_M88000 == 2))
! abort ();
if (constp && bytes <= 0)
return;
===================================================================
RCS file: ./dwarf2out.c,v
retrieving revision 2.8
retrieving revision 2.8.0.1
diff -c -r2.8 -r2.8.0.1
*** ./dwarf2out.c 1997/12/21 19:50:54 2.8
--- ./dwarf2out.c 1997/12/28 07:40:17 2.8.0.1
***************
*** 41,48 ****
#include "except.h"
#include "dwarf2.h"
! /* #define NDEBUG 1 */
! #include "assert.h"
/* Decide whether we want to emit frame unwind information for the current
translation unit. */
--- 41,54 ----
#include "except.h"
#include "dwarf2.h"
! /* We cannot use <assert.h> in GCC source, since that would include
! GCC's assert.h, which may not be compatible with the host compiler. */
! #undef assert
! #ifdef NDEBUG
! # define assert(e)
! #else
! # define assert(e) do { if (! (e)) abort (); } while (0)
! #endif
/* Decide whether we want to emit frame unwind information for the current
translation unit. */
===================================================================
RCS file: ./except.c,v
retrieving revision 2.8
retrieving revision 2.8.0.1
diff -c -r2.8 -r2.8.0.1
*** ./except.c 1997/12/12 23:27:40 2.8
--- ./except.c 1997/12/28 07:40:17 2.8.0.1
***************
*** 404,410 ****
#include "insn-config.h"
#include "recog.h"
#include "output.h"
- #include "assert.h"
/* One to use setjmp/longjmp method of generating code for exception
handling. */
--- 404,409 ----
***************
*** 1967,1974 ****
save_eh_status (p)
struct function *p;
{
- assert (p != NULL);
-
p->ehstack = ehstack;
p->ehqueue = ehqueue;
p->catch_clauses = catch_clauses;
--- 1966,1971 ----
***************
*** 1989,1996 ****
restore_eh_status (p)
struct function *p;
{
- assert (p != NULL);
-
protect_list = p->protect_list;
caught_return_label_stack = p->caught_return_label_stack;
false_label_stack = p->false_label_stack;
--- 1986,1991 ----
***************
*** 2054,2064 ****
/* Assume we can delete the region. */
int delete = 1;
! assert (insn != NULL_RTX
! && GET_CODE (insn) == NOTE
! && NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
! && NOTE_BLOCK_NUMBER (insn) == n
! && delete_outer != NULL);
insn = NEXT_INSN (insn);
--- 2049,2059 ----
/* Assume we can delete the region. */
int delete = 1;
! if (! (GET_CODE (insn) == NOTE
! && NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
! && NOTE_BLOCK_NUMBER (insn) == n
! && delete_outer != NULL))
! abort ();
insn = NEXT_INSN (insn);
From: Paul Eggert <eggert@twinsun.com>
To: gcc2@cygnus.com
In-reply-to: <199712280808.AAA22626@shade.twinsun.com> (eggert@twinsun.com)
Subject: gcc-2.8.0-971225 build failure due to asserts in GCC (supplement fix)
References: <199712280808.AAA22626@shade.twinsun.com>
Here's a supplement to the patch I sent out a couple of hours ago to
get GCC to build properly on hosts where GCC's assert.h isn't
understood by the system compiler. I forgot to patch dwarfout.c using
the same idea as my dwarf2out.c patch. This makes no difference on
BSD/OS 3.0, where dwarfout.c is ifdeffed out, but it might make a
difference on some other host.
1997-12-28 Paul Eggert <eggert@twinsun.com>
* dwarfout.c ("assert.h"): Do not include.
(assert): New macro, since we can't use system assert.
===================================================================
RCS file: dwarfout.c,v
retrieving revision 2.8
retrieving revision 2.8.0.1
diff -c -r2.8 -r2.8.0.1
*** dwarfout.c 1997/12/03 13:10:52 2.8
--- dwarfout.c 1997/12/28 09:17:21 2.8.0.1
***************
*** 33,41 ****
#include "output.h"
#include "defaults.h"
- /* #define NDEBUG 1 */
- #include "assert.h"
-
#if defined(DWARF_TIMESTAMPS)
#if defined(POSIX)
#include <time.h>
--- 33,38 ----
***************
*** 61,66 ****
--- 58,72 ----
#endif
#endif
+ /* We cannot use <assert.h> in GCC source, since that would include
+ GCC's assert.h, which may not be compatible with the host compiler. */
+ #undef assert
+ #ifdef NDEBUG
+ # define assert(e)
+ #else
+ # define assert(e) do { if (! (e)) abort (); } while (0)
+ #endif
+
extern char *getpwd ();
#ifdef NEED_DECLARATION_INDEX
From: Paul Eggert <eggert@twinsun.com>
To: gcc2@cygnus.com
Subject: GCC 2.8.0-971225 build failure on BSD/OS 3.0
Here are the symptoms:
...
if [ -f /usr/include/float.h ] && if grep 'ifndef _FLOAT_H___' /usr/include/float.h >/dev/null; then false; else :; fi; then SYS_FLOAT_H_WRAP=1; else :; SYS_FLOAT_H_WRAP=0; fi; ./xgcc -B./ -DIN_GCC -g -I./include -DNO_MEM -DNO_LONG_DOUBLE_IO -O0 -DSYS_FLOAT_H_WRAP=$SYS_FLOAT_H_WRAP -I. -c ./enquire.c
enquire.c:2:Junk character 47.
enquire.c:2:Rest of line ignored. 1st junk character valued 32 ( ).
...
The problem is that GCC's assembly language output for enquire.s
looks like this:
.file "enquire.c"
/ GNU C version 2.8.0 (i386-pc-bsdi3.0) compiled by GNU C version 2.7.2.1.
/ options passed: -g -O0
...
On BSD/OS 3.0, the assembly language comment char is #, not /.
For now I think it's best to turn off those comments by default, as
they're a porting problem. Normally they're not needed, and anybody
who needs them for debugging can easily enable them with -fverbose-asm.
Here's a proposed patch. This patch also changes config/i386/bsd386.h
to specify # as the comment character, but this is just an untested
guess on my part, as I don't know whether # is new in BSD/OS 3.0, or
whether it's also used in previous BSD/OS releases, or whether it's
also used in other BSD hosts like FreeBSD.
1997-12-28 Paul Eggert <eggert@twinsun.com>
* toplev.c (flag_verbose_asm): Default to 0, not 1;
this avoids some porting problems.
* config/i386/bsd386.h (ASM_COMMENT_START): Define to " #",
since BSD/OS 3.0 uses gas with # as the comment char.
===================================================================
RCS file: RCS/toplev.c,v
retrieving revision 2.8
retrieving revision 2.8.0.1
diff -c -r2.8 -r2.8.0.1
*** toplev.c 1997/12/23 10:19:14 2.8
--- toplev.c 1997/12/28 23:14:24 2.8.0.1
***************
*** 587,596 ****
the generated assembly code (to make it more readable). This option
is generally only of use to those who actually need to read the
generated assembly code (perhaps while debugging the compiler itself).
! -fverbose-asm is the default. -fno-verbose-asm causes the extra information
to be omitted and is useful when comparing two assembler files. */
! int flag_verbose_asm = 1;
/* -dA causes debug commentary information to be produced in
the generated assembly code (to make it more readable). This option
--- 587,596 ----
the generated assembly code (to make it more readable). This option
is generally only of use to those who actually need to read the
generated assembly code (perhaps while debugging the compiler itself).
! -fno-verbose-asm, the default, causes the extra information
to be omitted and is useful when comparing two assembler files. */
! int flag_verbose_asm = 0;
/* -dA causes debug commentary information to be produced in
the generated assembly code (to make it more readable). This option
===================================================================
RCS file: RCS/flags.h,v
retrieving revision 2.8
retrieving revision 2.8.0.1
diff -c -r2.8 -r2.8.0.1
*** flags.h 1997/08/02 17:12:52 2.8
--- flags.h 1997/12/28 23:14:24 2.8.0.1
***************
*** 349,355 ****
the generated assembly code (to make it more readable). This option
is generally only of use to those who actually need to read the
generated assembly code (perhaps while debugging the compiler itself).
! -fverbose-asm is the default. -fno-verbose-asm causes the extra information
to not be added and is useful when comparing two assembler files. */
extern int flag_verbose_asm;
--- 349,355 ----
the generated assembly code (to make it more readable). This option
is generally only of use to those who actually need to read the
generated assembly code (perhaps while debugging the compiler itself).
! -fno-verbose-asm, the default, causes the extra information
to not be added and is useful when comparing two assembler files. */
extern int flag_verbose_asm;
===================================================================
RCS file: RCS/invoke.texi,v
retrieving revision 2.8
retrieving revision 2.8.0.1
diff -c -r2.8 -r2.8.0.1
*** invoke.texi 1997/12/04 11:52:29 2.8
--- invoke.texi 1997/12/28 23:14:24 2.8.0.1
***************
*** 5277,5283 ****
who actually need to read the generated assembly code (perhaps while
debugging the compiler itself).
! @samp{-fverbose-asm} is the default. @samp{-fno-verbose-asm} causes the
extra information to be omitted and is useful when comparing two assembler
files.
--- 5277,5283 ----
who actually need to read the generated assembly code (perhaps while
debugging the compiler itself).
! @samp{-fno-verbose-asm}, the default, causes the
extra information to be omitted and is useful when comparing two assembler
files.
===================================================================
RCS file: config/i386/bsd386.h,v
retrieving revision 2.8
retrieving revision 2.8.0.1
diff -c -r2.8 -r2.8.0.1
*** config/i386/bsd386.h 1995/04/02 12:16:00 2.8
--- config/i386/bsd386.h 1997/12/28 23:14:24 2.8.0.1
***************
*** 1,5 ****
! /* Configuration for an i386 running BSDI's BSD/386 1.1 as the target
! machine. */
#include "i386/386bsd.h"
--- 1,5 ----
! /* Configuration for an i386 running BSDI's BSD/OS (formerly known as BSD/386)
! as the target machine. */
#include "i386/386bsd.h"
***************
*** 16,18 ****
--- 16,22 ----
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32
+
+ /* This is suitable for BSD/OS 3.0; we don't know about earlier releases. */
+ #undef ASM_COMMENT_START
+ #define ASM_COMMENT_START " #"