Re: sparse segv with simple test

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


On Mon, 31 Aug 2009 00:53:58 +0200
Kamil Dudka <kdudka@xxxxxxxxxx> wrote:

> On Monday 31 of August 2009 00:32:02 Stephen Hemminger wrote:
> > I was checking up on some enum issues and tried running the following:
> > 	sparse -Wenum-mismatch enum.c
> > It dies here:
> > gdb) run -Wenum-mismatch e.c
> > Starting program: /home/shemminger/src/sparse/sparse -Wenum-mismatch enum.c
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x0805c81d in linearize_store_gen (ep=0xb7e7600c, value=0xb7e4e00c,
> >     ad=0xbfd43134) at linearize.h:293
> > 293		return (p && p->type != PSEUDO_VOID && p->type != PSEUDO_VAL);
> > (gdb) where
> > #0  0x0805c81d in linearize_store_gen (ep=0xb7e7600c, value=0xb7e4e00c,
> >     ad=0xbfd43134) at linearize.h:293
> > #1  0x080609da in linearize_symbol (sym=0xb7e244cc) at linearize.c:1526
> > #2  0x080494bd in main (argc=-1209907772, argv=0xb7e245c4) at sparse.c:266
> > ------
> > #include <stdio.h>
> >
> > enum x { A, B, C };
> >
> > static enum x foo(int n) {
> > 	return (n > 0) ? A : B;
> > }
> >
> > int main(int ac, char **av) {
> > 	int x = foo(ac);
> > 	enum x y = 99;
> >
> > 	printf("%d %d\n", x, y);
> > 	return 0;
> > }
> 
> I am unable to reproduce the crash, tested with sparse 0.4.1 and current git 
> HEAD. Even no suspicious place reported by valgrind. Maybe your <stdio.h> is 
> the trigger. Could you please attach the preprocessed code?
> 
> Kamil

Not sure why, but the crash went away after a 'make clean; make' so maybe
something was stale on that machine?

It still doesn't give any warnings. about assigning an enum with a value
out of range thou.

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Newbies FAQ]     [Kernel List]     [Site Home]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [DDR & Rambus]     [Trinity Fuzzer Tool]

Powered by Linux