|
From: | Christian JULLIEN |
Subject: | [Tinycc-devel] RE :Re: Last two warnings |
Date: | Wed, 13 Feb 2013 21:48:49 +0100 (CET) |
Ok I'll push my fix.
Working on mob using:
$ git clone -b mob git://repo.or.cz/tinycc.git
$ cd tinycc
I just have to do a "git pull" ?
Otherwise, here is the diff
diff --git a/tccpp.c b/tccpp.c
index ac01d83..f513a31 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -2807,7 +2807,8 @@ static inline int *macro_twosharps(const int *macro_str)
/* we search the first '##' */
for(ptr = macro_str;;) {
- TOK_GET(&t, &ptr, &cval);
+ CValue ignored; // required by TOK_GET but not used
+ TOK_GET(&t, &ptr, &ignored);
if (t == TOK_TWOSHARPS)
break;
/* nothing more to do if end of string */
----- Message d'origine -----
De : "grischka" <address@hidden>
Date mer. 13/02/2013 14:39 (GMT +01:00)
À : "address@hidden" <address@hidden>
Objet : Re: [Tinycc-devel] Last two warnings
Christian Jullien wrote:
> tccpp.c: In function ‘macro_subst’:
> tccpp.c:2803:12: warning: ‘*((void *)&cval+4)’ is used uninitialized
> in this function [-Wuninitialized]
>
> Because gcc is unable to know if we entered the first loop (which
> possibly can initialize some cval fields), it complains on line 2840
> that cval might be used uninitialized (by 2810 if we do not enter the
> first loop).
>
> To me, the first use is only to find ## and we don't do anything
> with cval, so it is safe to use a local declaration:
>
> /* we search the first '##' */
> for(ptr = macro_str;;) {
> CValue ignored;
> TOK_GET(&t, &ptr, &ignored);
> if (t == TOK_TWOSHARPS)
> break;
> /* nothing more to do if end of string */
> if (t == 0)
> return NULL;
> }
Anyway, this looks like a bug in gcc. If you still want to
fix it in TCC, go for it. Please move both declaration into
their local block, then.
--- grischka
(who wrote:)
> Which doesn't make neither "cval" any more initialized !?!
>
> Maybe just a case of acute GCC warning hysteria.
_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
[Prev in Thread] | Current Thread | [Next in Thread] |