/usr/ports/lang/scm on 5.3-STABLE and 6.0-CURRENT

dai inukai inukai.d at jeans.ocn.ne.jp
Sat Oct 30 12:18:13 PDT 2004


Hi

I recently realized and regret that "scm-5d9_1 is marked as broken:
Segfault during build." This seems not the scm fault but due
to the bug introduced by the gcc FreeBSD adopted for STABLE and
CURRENT. I say gcc bug because scm compiles correctly with gcc-3.4.3
(prerelease from the port.)

My system: 1 CPU Athlon XP 1800+ on M/B K7T266 PRO2

5.3-STABLE: % uname -a 
FreeBSD daip 5.3-STABLE FreeBSD 5.3-STABLE #0: Tue Oct 26 21:47:52 JST
2004 daip at daip:/usr/obj/usr/src/sys/DAIKERNEL i386

6.0-CURRENT: % uname -a
FreeBSD daip 6.0-CURRENT FreeBSD 6.0-CURRENT #0: Sat Oct 23 02:55:12
JST 2004 daip at daip:/usr/obj/usr/src/sys/DAIKERNEL i386

% cc --version
cc (GCC) 3.4.2 [FreeBSD] 20040728

When compiled with FreeBSD defaults, scmlit and scm crash with
Segmentation Fault in eval.c at the line 2090 with core dump output:

eval.c: 2090 x = arg1;

If I trace the program with gdb and dumped core files, the variable
arg1 in the function "static SCM ceval_1(x)" disappears except the
case compiled with the optimization option "-O0 (gcc default)."

This seems to be a similar bug to:

http://gcc.gnu.org/ml/gcc-bugs/2003-10/msg00520.html

and can be avoided with "-DGCC_SPARC_BUG" during the make.

I propose the attached patches until the next version of gcc is
adopted as default.

dai -- http://www4.ocn.ne.jp/~inukai/scheme.html

-------------- next part --------------
*** Makefile.orig	Mon Dec  1 13:49:57 2003
--- Makefile	Sat Oct 30 20:58:29 2004
***************
*** 40,54 ****
  
  # "Makefile" for scm Scheme Interpreter
  # Author: Aubrey Jaffer
  
  SHELL = /bin/sh
! #CC = gcc
  #CFLAGS = -g
  #LIBS =
  #LD = $(CC) -g
! LD = $(CC)
  SCMLIT = ./scmlit
  SCMEXE = ./scm
  
  #BUILD = ./build -hsystem -p svr4-gcc-sun-ld
  BUILD = ./build -hsystem
--- 40,54 ----
  
  # "Makefile" for scm Scheme Interpreter
  # Author: Aubrey Jaffer
  
  SHELL = /bin/sh
! #CC = ccache cc
  #CFLAGS = -g
  #LIBS =
  #LD = $(CC) -g
! LD = $(CC) -O3 -DGCC_SPARC_BUG
  SCMLIT = ./scmlit
  SCMEXE = ./scm
  
  #BUILD = ./build -hsystem -p svr4-gcc-sun-ld
  BUILD = ./build -hsystem
-------------- next part --------------
*** build.scm.orig	Fri Aug 27 21:55:10 2004
--- build.scm	Sun Oct 31 02:45:32 2004
***************
*** 623,633 ****
       (regex darwin "" "" #f () ())
  
       (c freebsd "" "-export-dynamic" #f () ())
       (m freebsd "" "-lm" #f () ())
       (curses freebsd "" "-lncurses" "/usr/lib/libncurses.a" () ())
!      (regex freebsd "" "-lgnuregex" "" () ())
       (editline freebsd "" "-lreadline" "" () ())
       (dlll freebsd "-DSUN_DL" "-export-dynamic" "" () ())
       (nostart freebsd "" "-e start -dc -dp -Bstatic -lgnumalloc" #f ("pre-crt0.c") ())
       (dump freebsd "" "/usr/lib/crt0.o" "" ("unexsunos4.c") ())
       (curses netbsd "-I/usr/pkg/include" "-lncurses" "-Wl,-rpath -Wl,/usr/pkg/lib -L/usr/pkg/lib" () ())
--- 623,633 ----
       (regex darwin "" "" #f () ())
  
       (c freebsd "" "-export-dynamic" #f () ())
       (m freebsd "" "-lm" #f () ())
       (curses freebsd "" "-lncurses" "/usr/lib/libncurses.a" () ())
!      (regex freebsd "-I/usr/include/gnu" "-lgnuregex" "" () ())
       (editline freebsd "" "-lreadline" "" () ())
       (dlll freebsd "-DSUN_DL" "-export-dynamic" "" () ())
       (nostart freebsd "" "-e start -dc -dp -Bstatic -lgnumalloc" #f ("pre-crt0.c") ())
       (dump freebsd "" "/usr/lib/crt0.o" "" ("unexsunos4.c") ())
       (curses netbsd "-I/usr/pkg/include" "-lncurses" "-Wl,-rpath -Wl,/usr/pkg/lib -L/usr/pkg/lib" () ())
***************
*** 1586,1596 ****
  
  (defcommand compile-c-files freebsd
    (lambda (files parms)
      (and (batch:try-chopped-command
  	  parms
! 	  "cc" "-O3 -pipe " "-c"
  	  (c-includes parms)
  	  (c-flags parms)
  	  files)
  	 (map c->o files))))
  (defcommand link-c-program freebsd
--- 1586,1597 ----
  
  (defcommand compile-c-files freebsd
    (lambda (files parms)
      (and (batch:try-chopped-command
  	  parms
! ;	  "cc" "-O3 -pipe " "-c";;gcc 3.4.2 for FreeBSD does not allow options other than default i.e. -O0 if NO -DGCC_SPARC_BUG - dai 2004-10-30
! 	  "cc" "-O3 -pipe -DGCC_SPARC_BUG " "-c"
  	  (c-includes parms)
  	  (c-flags parms)
  	  files)
  	 (map c->o files))))
  (defcommand link-c-program freebsd


More information about the freebsd-ports mailing list