NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/22500: lint breakage for named initializers
The following reply was made to PR toolchain/22500; it has been noted by GNATS.
From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: bin/22500: lint breakage for named initializers
Date: Sun, 31 Jul 2016 22:35:23 +0000
On Sun, Mar 30, 2008 at 06:45:02PM +0000, David Holland wrote:
> --- 3.c ---
> struct {
> struct {
> int b;
> } b;
> struct {
> int d;
> } d;
> } bar = {{.b = .d = {0}}};
> --- end ---
>
> % lint -S 3.c
> 3.c:
> lint: /usr/libexec/lint1 got SIGSEGV
This is actually two problems, of which the first no longer crashes
but instead gives an internal error:
--- 4.c ---
struct {
int a;
} b = {.a = {1}};
--- end ---
% lint -S 4.c
(6): lint error:
/usr/src/usr.bin/xlint/lint1/init.c, 170: popi2()
and
--- 5.c ---
struct {
int a;
} b = {.c = 3};
--- end ---
% lint -S 5.c
5.c:
lint: /usr/libexec/lint1 got SIGSEGV
The problem in case 4 is too many braces; it should not accept the
{1}, or having done so it should fail to match the .a, or something;
anyway the problem seems to be that closing off the second set of
braces causes it to want to pop something off that isn't there.
The problem in case 5 is that .c doesn't exist and nothing checks that
it failed to look up (I guess), so the object has no type and then it
crashes. The crash happens at line 297 of init.c:
switch (istk->i_type->t_tspec)
A third problem is that the grammar in cgram.y permits {.a = .b = 3}
which it shouldn't. This I can fix.
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index