unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* Segmentation fault in scm_igc
@ 2004-03-04 13:53 David Hansen
  2004-03-07 15:27 ` Neil Jerram
  2004-03-07 23:54 ` Marius Vollmer
  0 siblings, 2 replies; 3+ messages in thread
From: David Hansen @ 2004-03-04 13:53 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 1759 bytes --]


Hello,

my first guile code started with a SIGSEGV.  Not sure if
it's not my fault but looks like a bug to me.

,----[ gtst.c ]
| // -*- compile-command: "gcc -g -Wall `guile-config compile` `guile-config link` gtst.c -o gtst" -*-
| 
| #include <libguile.h>
| 
| int
| main (void)
| {
|         SCM str = scm_makfrom0str ("hello world");
|         return 0;
| }
`----

,----[ gdb ]
| (gdb) run
| Starting program: /home/dhansen/tmp/gtst 
| 
| Program received signal SIGSEGV, Segmentation fault.
| [Switching to Thread 16384 (LWP 15966)]
| 0x4004d398 in scm_igc (what=0x0) at gc.c:1069
| (gdb) bt
| #0  0x4004d398 in scm_igc (what=0x0) at gc.c:1069
| #1  0x4004e54b in check_mtrigger (what=0x0) at gc.c:1959
| #2  0x4004e60a in scm_must_malloc (size=12, what=0x400a8231 "scm_allocate_string") at gc.c:2005
| #3  0x400807da in scm_allocate_string (len=11) at strings.c:241
| #4  0x400806f3 in scm_mem2string (src=0x8048614 "hello world", len=10) at strings.c:209
| #5  0x40080757 in scm_makfrom0str (src=0x8048614 "hello world") at strings.c:221
| #6  0x080484f0 in main () at gtst.c:8
| (gdb) 
`----

,----[ guile --version ]
| Guile 1.6.4
| Copyright (c) 1995, 1996, 1997, 2000, 2001, 2002, 2003 Free Software Foundation
| Guile may be distributed under the terms of the GNU General Public Licence;
| certain other uses are permitted as well.  For details, see the file
| `COPYING', which is included in the Guile distribution.
| There is no warranty, to the extent permitted by law.
`----

I just installed guile-1.6.4 myself using

$ ./configure --prefix=$HOME --with-threads --enable-debug-freelist --enable-debug-malloc --enable-guile-debug --disable-deprecated

I'm not on any lists, so if there's something interesting
for me please Cc: to me.

David

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile

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

* Re: Segmentation fault in scm_igc
  2004-03-04 13:53 Segmentation fault in scm_igc David Hansen
@ 2004-03-07 15:27 ` Neil Jerram
  2004-03-07 23:54 ` Marius Vollmer
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Jerram @ 2004-03-07 15:27 UTC (permalink / raw)
  Cc: bug-guile

David Hansen <david.hansen@physik.fu-berlin.de> writes:

> Hello,
> 
> my first guile code started with a SIGSEGV.  Not sure if
> it's not my fault but looks like a bug to me.
> 
> ,----[ gtst.c ]
> | // -*- compile-command: "gcc -g -Wall `guile-config compile` `guile-config link` gtst.c -o gtst" -*-
> | 
> | #include <libguile.h>
> | 
> | int
> | main (void)
> | {
> |         SCM str = scm_makfrom0str ("hello world");
> |         return 0;
> | }
> `----

You need to follow a more particular model for your main function.
Please see node `A Sample Guile Main Program' in the manual.

        Neil


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


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

* Re: Segmentation fault in scm_igc
  2004-03-04 13:53 Segmentation fault in scm_igc David Hansen
  2004-03-07 15:27 ` Neil Jerram
@ 2004-03-07 23:54 ` Marius Vollmer
  1 sibling, 0 replies; 3+ messages in thread
From: Marius Vollmer @ 2004-03-07 23:54 UTC (permalink / raw)
  Cc: bug-guile

David Hansen <david.hansen@physik.fu-berlin.de> writes:

> Hello,
>
> my first guile code started with a SIGSEGV.  Not sure if
> it's not my fault but looks like a bug to me.

You need to initialize Guile before using it.  For example:

    static void
    inner_main (void *data, int argc, char **argv)
    {
      SCM str = scm_makfrom0str ("hello world");
      /* ... */
    }

    int
    main (int argc, char **argv)
    {
      scm_boot_guile (argc, argv, inner_main, 0);
      return 0; /* never reached */
    }

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile


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

end of thread, other threads:[~2004-03-07 23:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-04 13:53 Segmentation fault in scm_igc David Hansen
2004-03-07 15:27 ` Neil Jerram
2004-03-07 23:54 ` Marius Vollmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).