public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fastsnip-bcard1 at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/21322] O2 and O3 memory access error - compiled program - incorrect debug output
Date: Sun, 01 May 2005 20:30:00 -0000	[thread overview]
Message-ID: <20050501203018.10095.qmail@sourceware.org> (raw)
In-Reply-To: <20050501191141.21322.fastsnip-gcc@yahoo.com>


------- Additional Comments From fastsnip-bcard1 at yahoo dot com  2005-05-01 20:30 -------
Subject: Re:  O2 and O3 memory access error - compiled program - incorrect debug output

On Sunday 01 May 2005 16:25, you wrote:
> ------- Additional Comments From fastsnip-bcard1 at yahoo dot com 
> 2005-05-01 20:24 ------- Subject: Re:  O2 and O3 memory access error -
> compiled program - incorrect debug output
>
> On Sunday 01 May 2005 15:40, you wrote:
> > ------- Additional Comments From pinskia at gcc dot gnu dot org 
> > 2005-05-01 19:40 ------- (In reply to comment #5)
> >
> > > Subject: Re:  O2 and O3 memory access error - compiled program -
> > > incorrect debug output
> > >
> > > On Sunday 01 May 2005 15:19, you wrote:
> > > > ------- Additional Comments From pinskia at gcc dot gnu dot org
> > > > 2005-05-01 19:19 ------- Also can you look to see you have any
> > > > warnings with -W -Wall? The warnings about unsigned vs signed were
> > > > there before just enabled with -pedantic.
> > > >
> > > > Also does -fno-strict-aliasing help if so this might not be a bug in
> > > > GCC but your code.
> > >
> > > Compiled with the above flag as you suggested - no change - I still get
> > > a memory access error using "-O3" optiomization.
> > >
> > > Will try the "-W -Wall" flags top see what that produces and let you
> > > know.
> > >
> > > Terry
> >
> > Hmm, try -O1 -funit-at-a-time also make sure that you are not going past
> > an array bounds. Also make sure that you are not invoking undefined
> > behavior.
>
> Okay I tried the following optimizing options:
>
> -O1 -funit-at-a-time ==== program ran fine
> -O1                       ==== program ran fine
> -O2 -funit-at-a-time ==== memory access error
> -O3 -funit-at-a-time ==== memory access error
>
> It seems that O2 and O3 only trigger the memory access error.
>
>
> Do not know exactly what you mean by "Also make sure that you are not
> invoking undefined behavior." Exactly how do I do this. Is there something
> in 4.0.0 that wasn't in 2.95 through 3.4.3 that would trigger this? The
> program compiled and ran fine under previous versions with the same
> compilation optimization options.
>
> > I get a lot of warnings about uninitialized variables like so:
> > awkpcmp.c: In function 'c_pop':
> > awkpcmp.c:57: warning: 'R_Token' may be used uninitialized in this
> > function awkpcmp.c: In function 'c_primary_expr':
> > awkpcmp.c:159: warning: 'arg2' may be used uninitialized in this function
> > awkpcmp.c:158: warning: 'arg1' may be used uninitialized in this function
> > awkpcmp.c: In function 'c_statement':
> > awkpcmp.c:1122: warning: 'Last_Token' may be used uninitialized in this
> > function awkpcmp.c: In function 'set_user_fun':
> > awkpcmp.c:1789: warning: 'name' may be used uninitialized in this
> > function
> >
> > so you might just be invoking undefined.

Yes these warnings are fine to have and check - unfortunately  the compiler 
cannot run through the code logic and I find that these warnings are 
generated spuriously because of that. Once you cycle through the code logic, 
the warning is unfounded. Again, good as a check, but it can generatea lot of 
un-necessary warnings and create a LOT of work checking logic.

Thanks,
Terry



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21322


  parent reply	other threads:[~2005-05-01 20:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-01 19:11 [Bug c/21322] New: " fastsnip-gcc at yahoo dot com
2005-05-01 19:13 ` [Bug c/21322] " pinskia at gcc dot gnu dot org
2005-05-01 19:19 ` pinskia at gcc dot gnu dot org
2005-05-01 19:21 ` fastsnip-gcc at yahoo dot com
2005-05-01 19:28 ` pinskia at gcc dot gnu dot org
2005-05-01 19:34 ` fastsnip-bcard1 at yahoo dot com
2005-05-01 19:40 ` pinskia at gcc dot gnu dot org
2005-05-01 20:04 ` fastsnip-bcard1 at yahoo dot com
2005-05-01 20:05 ` fastsnip-bcard1 at yahoo dot com
2005-05-01 20:25 ` fastsnip-bcard1 at yahoo dot com
2005-05-01 20:30 ` fastsnip-bcard1 at yahoo dot com [this message]
2005-05-03 20:17 ` [Bug other/21322] " jsm28 at gcc dot gnu dot org
2005-07-06 14:29 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050501203018.10095.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).