public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "brodhow at all2easy dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/57853] pointer arithmetic on arrays Date: Tue, 09 Jul 2013 04:15:00 -0000 [thread overview] Message-ID: <bug-57853-4-4ztV8sBmuh@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-57853-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57853 --- Comment #10 from Howard Brodale <brodhow at all2easy dot net> --- Should we expect to see "as" in the for loop's printf, for arr[0][0]? YES! And, we do when the pointer arithmetic is NOT being done, above. But, something changed arr[0] to "s" only! What did that? Did I change arr[0] like where I specified arr[0] = "s";? NO! But, something did! Should the C code set arr[0] = "s"? NO! But, it did set a[0] to "s", only! Thats whats happening, erroneously! For when we output array arr again or later or after the pointer arithmetic operation is shown THEN, only "s" appears where "as" used to be! And, also for every where else a[0] is being printed! After the pointer arithmetic operation. This "s" problemm is being shown in the for loop's printf and every where else a[0] is being outputed, AFTER the "++" operation. Where another "++" is not! But, "a" is still not showing up, AFTER the initial "++" operation. Look at all the subsequent printfs, AFTER the "++" operation. Where "as" used to be now only "s" is being outputed. Do you see where the issue is first appearing? Then, by what C code statement the issue is being done by? Though "*++arr[0][0]" does output 's' (correctly); something else is being done that should not be done! Setting *arr[0] EQUAL TO "s"! Which is wrong!
next prev parent reply other threads:[~2013-07-09 4:15 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-07-08 20:03 [Bug c/57853] New: " brodhow at all2easy dot net 2013-07-08 20:10 ` [Bug c/57853] " brodhow at all2easy dot net 2013-07-08 20:17 ` pinskia at gcc dot gnu.org 2013-07-08 22:06 ` brodhow at all2easy dot net 2013-07-08 22:08 ` pinskia at gcc dot gnu.org 2013-07-08 22:10 ` brodhow at all2easy dot net 2013-07-08 22:13 ` brodhow at all2easy dot net 2013-07-08 22:15 ` brodhow at all2easy dot net 2013-07-08 22:18 ` pinskia at gcc dot gnu.org 2013-07-09 3:08 ` brodhow at all2easy dot net 2013-07-09 4:15 ` brodhow at all2easy dot net [this message] 2013-07-09 4:24 ` pinskia at gcc dot gnu.org 2013-07-09 6:52 ` brodhow at all2easy dot net 2013-07-09 7:15 ` schwab@linux-m68k.org 2013-07-09 10:28 ` redi at gcc dot gnu.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=bug-57853-4-4ztV8sBmuh@http.gcc.gnu.org/bugzilla/ \ --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: linkBe 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).