all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* RE: Anyone built Emacs with gcc-3.3?
@ 2003-07-07  8:26 Marshall, Simon
  2003-07-08 14:28 ` Richard Stallman
  0 siblings, 1 reply; 27+ messages in thread
From: Marshall, Simon @ 2003-07-07  8:26 UTC (permalink / raw)
  Cc: emacs-devel

Yes, Emacs works with 3.2.3.  With 3.3 it dumps core on C-x C-c in
__do_global_dtors_aux() after Fkill_emacs() calls exit().

-----Original Message-----
From: Richard Stallman [mailto:rms@gnu.org]
Sent: 05 July 2003 23:26
To: Marshall, Simon
Cc: emacs-devel@gnu.org; emacs-pretesters@gnu.org
Subject: Re: Anyone built Emacs with gcc-3.3?


    I've tried to build emacs-21.3 and 21.1.90 with gcc-3.3 on
solaris-2.8
    but without success.

Does it work with other GCC versions?

			  Emacs builds but coredumps on exit, see bug
#11386
    at GCC Bugzilla via
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11386.

Do you mean it core dumps when you type C-c C-c?

The way to debug this is to treat it as an Emacs bug.  When you
find the bug, it will actually be a miscompiled function (if this
is GCC's fault).  Then you can send a useful GCC bug report.

^ permalink raw reply	[flat|nested] 27+ messages in thread
* RE: Anyone built Emacs with gcc-3.3?
@ 2003-07-14 11:19 Marshall, Simon
       [not found] ` <3F12B8E7.2C387FE7@yk.rim.or.jp>
  2003-07-14 17:47 ` Paul Eggert
  0 siblings, 2 replies; 27+ messages in thread
From: Marshall, Simon @ 2003-07-14 11:19 UTC (permalink / raw)
  Cc: 'emacs-pretesters@gnu.org', 'emacs-devel@gnu.org',
	'ebotcazou@gcc.gnu.org', 'ishikawa@yk.rim.or.jp'

Paul, thanks.  I can confirm that Emacs builds OK for me on s8 with
gcc-3.3 with the below Emacs patches plus your unexelf.c patch.  (Eric's
patch was not relevant for me anyway as I don't build with Xaw.)

I do get a gripe though:

alloc.c:398: warning: initialization makes pointer from integer without
a cast

due to this change:

-Lisp_Object *staticvec[NSTATICS] = {0};
+Lisp_Object *staticvec[NSTATICS] = {1};

Casting 1 with (Lisp_Object *) keeps gcc happy; so does removing the
initialisation.  I'll leave someone else to work out the correct way to
deal with this.

Thanks to everyone for sorting this out.  Simon.

-----Original Message-----
From: Marshall, Simon 
Sent: 11 July 2003 11:38
To: 'Paul Eggert'
Cc: 'ebotcazou@gcc.gnu.org'; 'ishikawa@yk.rim.or.jp'
Subject: RE: Anyone built Emacs with gcc-3.3?


Paul, many thanks.  FYI, I put your email on
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11386, seeing as they have
also looked at it with objdump.  Your input may help them and vice
versa.
I hope this can be fixed for 3.3.1, rather than the target 3.3.2.
Simon.

-----Original Message-----
From: Paul Eggert [mailto:eggert@twinsun.com]
Sent: 11 July 2003 10:55
To: rms@gnu.org
Cc: simon.marshall@misys.com; emacs-devel@gnu.org;
emacs-pretesters@gnu.org
Subject: Re: Anyone built Emacs with gcc-3.3?


> From: Richard Stallman <rms@gnu.org>
> Date: Sat, 05 Jul 2003 18:25:56 -0400
> 
> The way to debug this is to treat it as an Emacs bug.  When you
> find the bug, it will actually be a miscompiled function (if this
> is GCC's fault).  Then you can send a useful GCC bug report.

I looked into this a bit, and there seem to be at least two problems.
One is an Emacs portability problem; the rest I don't know yet.

Emacs assumes that a top-level declaration like "int pure[1000] = {0};"
puts "pure" into the data area.  However, this assumption is no longer
true with GCC 3.3 on Solaris 8, which notices that "pure" has an
initializer that is all zeros, and puts "pure" into BSS instead.
This is a valid optimization, so I guess Emacs should deal with it.

I checked for all static variables that Emacs 21.3 defines to be zero
in Solaris 8, and which become readonly after dumping with GCC 3.2.3
but not with GCC 3.3, and I came up with the following patch to fix
this portability problem.  This fixes part of the bug, but not all;
Emacs still dumps core.  I'll see if I can investigate this further if
I find more time but that won't be before this weekend.

2003-07-11  Paul Eggert  <eggert@twinsun.com>

	GCC 3.3 no longer puts "int foo = 0;" into data; it optimizes
	this case and puts it into BSS instead, at least on Solaris 8.
	* src/alloc.c (pure, staticvec, staticidx):
	Initialize to nonzero, so that it's data.
	* src/emacs.c (bss_end): Likewise.
	(main): Use bss_end==1 to mean it's unset.

	The following changes don't fix any bugs, but they remove
	initializations to zero that do not need to be in pure space.
	I am including them in this patch (if only to document them).
	* src/emacs.c (gdb_data_seg_bits): Do not initialize to zero
	explicitly, since it's OK for this to be in BSS.
	* src/xfns.c (cursor_bits): Likewise.
	* src/xterm.c (Xt_default_resources): Likewise.

diff -pru emacs-21.3/src/alloc.c emacs-21.3-fix/src/alloc.c
--- emacs-21.3/src/alloc.c	2003-01-17 05:45:13.000000000 -0800
+++ emacs-21.3-fix/src/alloc.c	2003-07-11 02:02:37.215626000 -0700
@@ -188,7 +188,7 @@ Lisp_Object Vpurify_flag;
 
 /* Force it into data space! */
 
-EMACS_INT pure[PURESIZE / sizeof (EMACS_INT)] = {0,};
+EMACS_INT pure[PURESIZE / sizeof (EMACS_INT)] = {1,};
 #define PUREBEG (char *) pure
 
 #else /* not HAVE_SHM */
@@ -395,11 +395,11 @@ struct gcpro *gcprolist;
 /* Addresses of staticpro'd variables.  */
 
 #define NSTATICS 1024
-Lisp_Object *staticvec[NSTATICS] = {0};
+Lisp_Object *staticvec[NSTATICS] = {1};
 
 /* Index of next unused slot in staticvec.  */
 
-int staticidx = 0;
+int staticidx = 1;
 
 static POINTER_TYPE *pure_alloc P_ ((size_t, int));
 
diff -pru emacs-21.3/src/emacs.c emacs-21.3-fix/src/emacs.c
--- emacs-21.3/src/emacs.c	2002-08-29 12:27:07.000000000 -0700
+++ emacs-21.3-fix/src/emacs.c	2003-07-11 01:39:19.348060000 -0700
@@ -86,7 +86,7 @@ EMACS_INT gdb_emacs_intbits = sizeof (EM
 #ifdef DATA_SEG_BITS
 EMACS_INT gdb_data_seg_bits = DATA_SEG_BITS;
 #else
-EMACS_INT  gdb_data_seg_bits = 0;
+EMACS_INT gdb_data_seg_bits /* = 0 */;
 #endif
 EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG;
 
@@ -188,10 +188,10 @@ extern Lisp_Object Vwindow_system;
 extern Lisp_Object Vauto_save_list_file_name;
 
 #ifdef USG_SHARED_LIBRARIES
-/* If nonzero, this is the place to put the end of the writable segment
+/* If not 1, this is the place to put the end of the writable segment
    at startup.  */
 
-unsigned int bss_end = 0;
+unsigned int bss_end = 1;
 #endif
 
 /* Nonzero means running Emacs without interactive terminal.  */
@@ -856,7 +856,7 @@ main (argc, argv, envp)
   stack_bottom = &stack_bottom_variable;
 
 #ifdef USG_SHARED_LIBRARIES
-  if (bss_end)
+  if (bss_end != 1)
     brk ((void *)bss_end);
 #endif
 
diff -pru emacs-21.3/src/xfns.c emacs-21.3-fix/src/xfns.c
--- emacs-21.3/src/xfns.c	2002-12-06 09:05:35.000000000 -0800
+++ emacs-21.3-fix/src/xfns.c	2003-07-11 01:26:46.669033000 -0700
@@ -3954,13 +3954,7 @@ x_icon (f, parms)
    background, border and mouse colors; also create the
    mouse cursor and the gray border tile.  */
 
-static char cursor_bits[] =
-  {
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-  };
+static char cursor_bits[32];
 
 static void
 x_make_gc (f)
diff -pru emacs-21.3/src/xterm.c emacs-21.3-fix/src/xterm.c
--- emacs-21.3/src/xterm.c	2002-10-15 07:21:45.000000000 -0700
+++ emacs-21.3-fix/src/xterm.c	2003-07-11 01:25:07.789266000 -0700
@@ -284,7 +284,7 @@ struct frame *pending_autoraise_frame;
 #ifdef USE_X_TOOLKIT
 /* The application context for Xt use.  */
 XtAppContext Xt_app_con;
-static String Xt_default_resources[] = {0};
+static String Xt_default_resources[1];
 #endif /* USE_X_TOOLKIT */
 
 /* Nominal cursor position -- where to draw output.  

^ permalink raw reply	[flat|nested] 27+ messages in thread
* RE: Anyone built Emacs with gcc-3.3?
@ 2003-07-08 15:18 Marshall, Simon
  2003-07-09 15:49 ` Richard Stallman
  2003-07-11  9:57 ` Paul Eggert
  0 siblings, 2 replies; 27+ messages in thread
From: Marshall, Simon @ 2003-07-08 15:18 UTC (permalink / raw)
  Cc: emacs-devel

> >     Yes, Emacs works with 3.2.3.  With 3.3 it dumps core on 
> C-x C-c in
> >     __do_global_dtors_aux() after Fkill_emacs() calls exit().
> > 
> > I have a hunch that relates to unexec.  Perhaps unexec fails to
> > preserve some of the data that __do_global_dtors_aux uses.
> > 
> > Debugging the details is the only way to proceed.

The guys who first raised it on bugzilla had the same hunch.  The
problem is: where do I start?  I can't debug in __do_global_dtors_aux()
as there is no debugging info.  Do I have to build libgcc.a with
debugging (or whatever it is that supplied __do_global_dtors_aux())?

> Someone else reported yesterday that a recent version of ld from 
> binutils has changed the position of some of the data segments in ELF 
> executables, causing problems with unexec. I think it is worth 
> investigating if this is really the cause of the gcc 3.3 
> problems, as it 
> could save a lot of debugging.

Thanks, though in my case I am using Sun as & ld (unless gcc comes with
a binutils ld and is quietly using it).

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: Anyone built Emacs with gcc-3.3?
@ 2003-07-04 12:36 Nelson H. F. Beebe
  0 siblings, 0 replies; 27+ messages in thread
From: Nelson H. F. Beebe @ 2003-07-04 12:36 UTC (permalink / raw)
  Cc: beebe

If any of you have an earlier version of gcc still installed after
installing gcc-3.3 (I kept 2.95.3 around), I suggest that you try to
debug the core dump problem by successively recompiling one file at a
time with the older gcc.  This can be automated with a modest script,
and I've found it a useful technique in the past to deal with compiler
errors in large programs.

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- Center for Scientific Computing       FAX: +1 801 581 4148                  -
- University of Utah                    Internet e-mail: beebe@math.utah.edu  -
- Department of Mathematics, 110 LCB        beebe@acm.org  beebe@computer.org -
- 155 S 1400 E RM 233                       beebe@ieee.org                    -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe  -
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- Center for Scientific Computing       FAX: +1 801 581 4148                  -
- University of Utah                    Internet e-mail: beebe@math.utah.edu  -
- Department of Mathematics, 110 LCB        beebe@acm.org  beebe@computer.org -
- 155 S 1400 E RM 233                       beebe@ieee.org                    -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe  -
-------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Anyone built Emacs with gcc-3.3?
@ 2003-07-04  8:33 Marshall, Simon
  2003-07-04  8:41 ` Dhruva Krishnamurthy
                   ` (3 more replies)
  0 siblings, 4 replies; 27+ messages in thread
From: Marshall, Simon @ 2003-07-04  8:33 UTC (permalink / raw)


I've tried to build emacs-21.3 and 21.1.90 with gcc-3.3 on solaris-2.8
but without success.  Emacs builds but coredumps on exit, see bug #11386
at GCC Bugzilla via http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11386.

Have any of you guys built with gcc-3.3 or any snapshot prior to its
release?  I ask because the bug looks like it might be tricky to track
down; the gcc guy dealing with it wants a lot more input; it's not clear
whether it is platform-dependent (the guy who got around to reporting it
before me is also on solaris-2.8).

Simon.

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2003-07-15 22:31 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-07  8:26 Anyone built Emacs with gcc-3.3? Marshall, Simon
2003-07-08 14:28 ` Richard Stallman
2003-07-08 14:39   ` Jason Rumney
2003-07-09  5:34     ` Dhruva Krishnamurthy
2003-07-09  7:36       ` Pascal Obry
2003-07-09  7:59       ` Jason Rumney
  -- strict thread matches above, loose matches on Subject: below --
2003-07-14 11:19 Marshall, Simon
     [not found] ` <3F12B8E7.2C387FE7@yk.rim.or.jp>
2003-07-14 14:41   ` Eric Botcazou
2003-07-14 17:47 ` Paul Eggert
2003-07-14 19:40   ` Eric Botcazou
2003-07-08 15:18 Marshall, Simon
2003-07-09 15:49 ` Richard Stallman
2003-07-11  9:57 ` Paul Eggert
2003-07-04 12:36 Nelson H. F. Beebe
2003-07-04  8:33 Marshall, Simon
2003-07-04  8:41 ` Dhruva Krishnamurthy
2003-07-04 16:17 ` puneet
2003-07-08 22:41   ` Dave Love
2003-07-09 12:31     ` Puneet Goel
2003-07-15 22:31       ` Dave Love
2003-07-05 22:25 ` Richard Stallman
2003-07-11  9:55   ` Paul Eggert
2003-07-11 22:52     ` Paul Eggert
2003-07-13 14:56       ` Simon Leinen
2003-07-14  5:52         ` Paul Eggert
2003-07-12  5:32     ` Richard Stallman
2003-07-08 22:30 ` Dave Love

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.