[prev in list] [next in list] [prev in thread] [next in thread]
List: openbsd-bugs
Subject: Re: user/5586: PCC initializes a struct incorrectly
From: Otto Moerbeek <otto () drijf ! net>
Date: 2007-09-22 14:55:01
Message-ID: 200709221455.l8MEt1UR026400 () cvs ! openbsd ! org
[Download RAW message or body]
The following reply was made to PR user/5586; it has been noted by GNATS.
From: Otto Moerbeek <otto@drijf.net>
To: TAKAHASHI Tamotsu <tamo@mutt.no-ip.org>
Cc: gnats@cvs.openbsd.org
Subject: Re: user/5586: PCC initializes a struct incorrectly
Date: Sat, 22 Sep 2007 16:37:55 +0200 (CEST)
On Sat, 22 Sep 2007, TAKAHASHI Tamotsu wrote:
> * Thu Sep 20 2007 gnats@cvs.openbsd.org <gnats@cvs.openbsd.org>
> > >Category: user
> > >Responsible: bugs
> > >Synopsis: PCC initializes a struct incorrectly
> > >Arrival-Date: Thu Sep 20 08:30:01 GMT 2007
>
> Hi,
> Thanks for debugging, Otto!
> Is this a correct patch?
You were close.... I just committed the fix ragge made.
-Otto
>
> Index: cc/ccom/init.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/pcc/cc/ccom/init.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 init.c
> --- cc/ccom/init.c 15 Sep 2007 22:04:38 -0000 1.2
> +++ cc/ccom/init.c 22 Sep 2007 05:46:35 -0000
> @@ -120,7 +120,7 @@ static struct instk {
> struct instk *in_prev; /* linked list */
> struct symtab **in_xp; /* member in structure initializations */
> struct symtab *in_sym; /* stab index */
> - union dimfun *in_df; /* dimenston of array */
> + union dimfun *in_df; /* dimension of array */
> TWORD in_t; /* type for this level */
> int in_n; /* number of arrays seen so far */
> int in_fl; /* flag which says if this level is controlled by {} */
> @@ -335,7 +335,7 @@ stkpop(void)
> break;
> if (pstk->in_df->ddim == 0 ||
> pstk->in_n < pstk->in_df->ddim)
> - break; /* ger more elements */
> + break; /* get more elements */
> }
> }
> #ifdef PCC_DEBUG
> @@ -376,8 +376,6 @@ findoff(void)
> * - this type is ARY, offset is ninit*stsize.
> */
> for (off = 0, is = pstk; is; is = is->in_prev) {
> - if (is->in_prev && is->in_prev->in_t == STRTY)
> - off += is->in_sym->soffset;
> if (ISARY(is->in_t)) {
> /* suesize is the basic type, so adjust */
> TWORD t = is->in_t;
> @@ -389,6 +387,8 @@ findoff(void)
> while (is->in_prev && ISARY(is->in_prev->in_t))
> is = is->in_prev;
> }
> + if (is->in_prev && is->in_prev->in_t == STRTY)
> + off += is->in_sym->soffset;
> }
> if (idebug>1) {
> printf("findoff: off %lld\n", off);
>
> --
> tamo
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic