* Martin Buck <[EMAIL PROTECTED]> [2006-03-17 12:28]:
> OK, if the testsuite just exits with an error status without printing any
> error messages, the calc binary has exited unexpectedly (usually with a
> segfault). "make check" should tell us where exactly this happens. And
> running under gdb should easily find the function that segfaults, so it
> shouldn't be too difficult to come up with a small test case for the gcc
> folks that shows the problem.

That's the smallest test case I can come up with:

$ cat test.cal
global prob;
define test_booleans()
{
        if (0)
                print '**** if (0)';

        if (1)
                print '301: if (1)';

        if (2)
                print '302: if (2)';

}
./calc -d -q read ./test
zsh: segmentation fault  ./calc -d -q read ./test


(gdb) run -d -q read ./test
Starting program: /home/tbm/src/apcalc-2.11.11/calc -d -q read ./test

Program received signal SIGSEGV, Segmentation fault.
stralloc () at string.c:1048
1048            freeStr = temp->s_next;
(gdb) where
#0  stralloc () at string.c:1048
#1  0x0809190a in addstring (str=0xafd032dc "302: if (2)", len=11) at 
string.c:1233
#2  0x08094159 in gettoken () at token.c:544
#3  0x0804d122 in getstatement (contlabel=<value optimized out>, 
breaklabel=0x0, nextcaselabel=0x0,
    defaultlabel=0x0) at codegen.c:936
#4  0x0804cfd1 in getstatement (contlabel=0x0, breaklabel=0x0, 
nextcaselabel=0x0, defaultlabel=0x0)
    at codegen.c:721
#5  0x0804de7b in getbody (contlabel=0x0, breaklabel=0x0, nextcaselabel=0x0, 
defaultlabel=0x0)
    at codegen.c:457
#6  0x0804e677 in getcommands (toplevel=0) at codegen.c:406
#7  0x0804e365 in getcommands (toplevel=0) at codegen.c:178
#8  0x08049df8 in main (argc=0, argv=0xafd0b994) at calc.c:583
(gdb)


Can you investigate further?


Or slightly smaller:

global prob;
define test_booleans()
{
        if (0)
                print 'x';
        if (1)
                print 'a';
        if (2)
                print 'xx';

}

It works if you remove one x from 'xx'...
-- 
Martin Michlmayr
http://www.cyrius.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to