This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Warnings with -Og - gcc 4.8
- From: Jeffrey Walton <noloader at gmail dot com>
- To: Lars Gullik BjÃnnes <larsbj at gullik dot org>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 5 Mar 2013 13:46:25 -0500
- Subject: Re: Warnings with -Og - gcc 4.8
- References: <CAOYg4AzUA5qo6VM3n3meDUbe71EKdUVba0YDOxqPgYX06txc=g@mail.gmail.com>
- Reply-to: noloader at gmail dot com
On Tue, Mar 5, 2013 at 1:41 PM, Lars Gullik BjÃnnes <larsbj@gullik.org> wrote:
> I get a lot of warnings with -Og and gcc from trunk.
> I do not get these warnings with any other warning level.
>
> This is a reduced example:
> ----------
> int foo(void);
>
> int failing(void)
> {
> int r;
> unsigned int i;
> struct h * p[3];
>
> for (i = 0; i < sizeof(p) / sizeof(p[0]); ++i) {
> r = foo();
> if (r != 0)
> break;
> }
> return r >= 0;
> }
> -----------
>
> Compile with: gcc -Og -Wall -c fil.c
>
> gcc --version
> gcc (GCC) 4.8.0 20130304 (experimental)
>
> Should I create a bug on this, or will someone else handle that?
What warnings?
The code does not look correct to me (but I could be wrong). Does
'sizeof(p) / sizeof(p[0])' produce correct results when using
pointers?
Jeff