bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Testsuite summary for GNU Bison 3.8.2 : FAIL 2


From: Dennis Clarke
Subject: Re: Testsuite summary for GNU Bison 3.8.2 : FAIL 2
Date: Wed, 13 Oct 2021 05:23:29 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:94.0) Gecko/20100101 Thunderbird/94.0

On 10/13/21 01:31, Akim Demaille wrote:
> Hi Dennis,
> 
>> Le 13 oct. 2021 à 00:19, Dennis Clarke <dclarke@blastwave.org> a écrit :
>>
>> On 10/9/21 04:35, Akim Demaille wrote:
>>> Hi Dennis,
>>>
>>> Thanks for this bug report.
>>
>> The least I can do.
> 
> :)
> 
>> You will love this :
>>
>> p = 0x100104410
>> (dbx) print *p
>> *p = {
>>    name  = 0x105bd0 "<bad address 0x0000000000105bd0>"
>>    type  = 260
>>    value = {
>>        var = 2.1225218246347e-314
>>        fun = 0x100103f00
>>    }
>>    next  = 0x1001043e0
>> }
>> (dbx) quit
>> beta $
> 
> Well, maybe the problem is actually very simple: the sym_table pointer is not 
> initialized to NULL by the compiler.  And as a matter of fact, it is probably 
> right, I don't believe the C standard requires it to do it.  It is mandatory 
> for static variables, but that's not the case here.
> 

I can not think of any reason where a pointer is initialized to NULL.
 If we assume otherwise then we get nose demons right ?  :)

> Could you look for the following lines in examples/c/mfcalc/mfcalc.y
> 
> /* The symbol table: a chain of 'struct symrec'. */
> symrec *sym_table;
> 
> and turn it into this?
> 
> /* The symbol table: a chain of 'struct symrec'. */
> symrec *sym_table = NULL;
> 
> That should do it.  Thanks!
> 

Sorry, no joy.

beta $ cat ./test-suite.log
=======================================
   GNU Bison 3.8.2: ./test-suite.log
=======================================

# TOTAL: 8
# PASS:  4
# SKIP:  2
# XFAIL: 0
# FAIL:  2
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: examples/c/mfcalc/mfcalc
==============================

checking for diff --strip-trailing-cr...
diff: illegal option -- strip-trailing-cr
usage: diff [-bitw] [-c | -e | -f | -h | -n | -u] file1 file2
       diff [-bitw] [-C number | -U number] file1 file2
       diff [-bitw] [-D string] file1 file2
       diff [-bitw] [-c | -e | -f | -h | -n | -u] [-l] [-r] [-s] [-S
name] directory1 directory2
checking for diff --strip-trailing-cr...
mfcalc: PASS: 1
mfcalc: PASS: 2
mfcalc: PASS: 3
mfcalc: FAIL: 4 (expected status: 0, effective: 139)
./examples/test: line 50:  5337 Segmentation Fault      (core dumped)
"$abs_medir/$me" "$@"
mfcalc: PASS: 5
FAIL examples/c/mfcalc/mfcalc.test (exit status: 1)

SKIP: examples/c/bistromathic/bistromathic
==========================================

checking for diff --strip-trailing-cr...
diff: illegal option -- strip-trailing-cr
usage: diff [-bitw] [-c | -e | -f | -h | -n | -u] file1 file2
       diff [-bitw] [-C number | -U number] file1 file2
       diff [-bitw] [-D string] file1 file2
       diff [-bitw] [-c | -e | -f | -h | -n | -u] [-l] [-r] [-s] [-S
name] directory1 directory2
checking for diff --strip-trailing-cr...
./examples/test: line 50:  5448 Segmentation Fault      (core dumped)
"$abs_medir/$me" "$@"
checking for readline output...
1,3d0
< > 0
< 0
< >
1d0
< 0
SKIP: this is not the GNU Readline we expect
SKIP examples/c/bistromathic/bistromathic.test (exit status: 77)

FAIL: examples/c/glr/c++-types
==============================

checking for diff --strip-trailing-cr...
diff: illegal option -- strip-trailing-cr
usage: diff [-bitw] [-c | -e | -f | -h | -n | -u] file1 file2
       diff [-bitw] [-C number | -U number] file1 file2
       diff [-bitw] [-D string] file1 file2
       diff [-bitw] [-c | -e | -f | -h | -n | -u] [-l] [-r] [-s] [-S
name] directory1 directory2
checking for diff --strip-trailing-cr...
c++-types: FAIL: 1 (expected status: 0, effective: 139)
./examples/test: line 50:  5549 Segmentation Fault      (core dumped)
"$abs_medir/$me" "$@"
FAIL examples/c/glr/c++-types.test (exit status: 1)

SKIP: examples/c/reccalc/reccalc
================================

checking for diff --strip-trailing-cr...
diff: illegal option -- strip-trailing-cr
usage: diff [-bitw] [-c | -e | -f | -h | -n | -u] file1 file2
       diff [-bitw] [-C number | -U number] file1 file2
       diff [-bitw] [-D string] file1 file2
       diff [-bitw] [-c | -e | -f | -h | -n | -u] [-l] [-r] [-s] [-S
name] directory1 directory2
checking for diff --strip-trailing-cr...
SKIP: gimme one seq
SKIP examples/c/reccalc/reccalc.test (exit status: 77)

beta $

>From a testing perspective I get it that sometimes a segfault is what we
want. However I am guessing we don't want that today :

void example()
{
    some_ptr *p=NULL;

    if(expr1)
    {
        p=foobar();
    }
    else if(expr2)
    {
        p=barbaz();
    }

    do_something(p);
}

So, yeah, if neither expr1 or expr2 then kaboom.

Looking at the first kaboom we see the same situation we had before :

beta $ dbx examples/c/mfcalc/mfcalc
time_1634114818-pid_5337-uid_16411-gid_20002-fid_mfcalc.core
Reading mfcalc
core file header read successfully
Reading ld.so.1
Reading libm.so.2
Reading libc.so.1
program terminated by signal SEGV (no mapping at the fault address)
0xffffffff7eb3c18c: strcmp+0x00cc:      ldx      [%o1 + %o2], %o3
Current function is getsym
 1461       if (strcmp (p->name, name) == 0)
(dbx) where
  [1] strcmp(0x105bd0, 0x100106d60, 0xfffffffeffffee70, 0x0,
0x8080808080808080, 0x101010101010101), at 0xffffffff7eb3c18c
=>[2] getsym(name = 0x100106d60 "a"), line 1461 in "mfcalc.c"
  [3] yylex(), line 1514 in "mfcalc.c"
  [4] yyparse(), line 1076 in "mfcalc.c"
  [5] main(argc = 2, argv = 0xffffffff7ffff278), line 1537 in "mfcalc.c"
(dbx) list
 1461       if (strcmp (p->name, name) == 0)
 1462         return p;
 1463     return NULL;
 1464   }
 1465
 1466   #include <ctype.h>
 1467   #include <stddef.h>
 1468
 1469   int
 1470   yylex (void)
(dbx) print &p
&p = 0xffffffff7fffe758
(dbx) print &name
&name = 0xffffffff7fffe768
(dbx) print name
name = 0x100106d60 "a"
(dbx) print p
p = 0x100104410
(dbx) print *p
*p = {
    name  = 0x105bd0 "<bad address 0x0000000000105bd0>"
    type  = 260
    value = {
        var = 2.1225218246347e-314
        fun = 0x100103f00
    }
    next  = 0x1001043e0
}
(dbx) quit
beta $

I definately made the change :

beta $ cat  ../bison-3.8.2_sunos5.10_sparcv9.002.patch
--- examples/c/mfcalc/mfcalc.y.orig     Sat Sep 25 09:10:40 2021
+++ examples/c/mfcalc/mfcalc.y  Wed Oct 13 08:35:12 2021
@@ -91,7 +91,7 @@
 };

 /* The symbol table: a chain of 'struct symrec'. */
-symrec *sym_table;
+symrec *sym_table = NULL;

 /* Put functions in table. */
 static void

So this is pretty darn odd if that pointer was supposed to be initialized.


-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional



reply via email to

[Prev in Thread] Current Thread [Next in Thread]