public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: noaml@mainsoft.com
To: gcc-gnats@gcc.gnu.org
Cc: jluu@mainsoft.com, yuvalk@mainsoft.com
Subject: optimization/8302: Pointer casting causes ++ to be ignored when optimizing
Date: Mon, 21 Oct 2002 09:46:00 -0000	[thread overview]
Message-ID: <20021021164142.28112.qmail@sources.redhat.com> (raw)


>Number:         8302
>Category:       optimization
>Synopsis:       Pointer casting causes ++ to be ignored when optimizing
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 21 09:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Noam Lampert
>Release:        gcc version 3.3 20021019 (experimental)
>Organization:
>Environment:
Intel 386. RH 7.3. kernel 2.4.18-3
>Description:
unsigned char *p;
unsigned char x;
....
*(*((unsigned char **)(&p)))++ = x;
as a side effect, p should be incremented. Sometimes, in optimized, it is not.
>How-To-Repeat:
gcc -O2 main.c
a.out
This source is in standard testcase format, and will call abort() upon failure.
>Fix:
Changing the code to 
*(*((unsigned char **)(&p))) = x;
p += sizeof(x);

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-10-21 16:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-21  9:46 noaml [this message]
2002-12-06 12:18 bangerth
2002-12-10  8:34 bangerth

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=20021021164142.28112.qmail@sources.redhat.com \
    --to=noaml@mainsoft.com \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=jluu@mainsoft.com \
    --cc=yuvalk@mainsoft.com \
    /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).