public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: jdbuiso@cs.vu.nl
To: gcc-gnats@gcc.gnu.org
Subject: c++/7209: Faulty array dereferencing
Date: Thu, 04 Jul 2002 13:06:00 -0000	[thread overview]
Message-ID: <20020704195831.29045.qmail@sources.redhat.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1656 bytes --]


>Number:         7209
>Category:       c++
>Synopsis:       Faulty array dereferencing
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 04 13:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jornand de Buisonjé
>Release:        3.1
>Organization:
>Environment:
DOS (DJGPP) and Linux, both x86.
>Description:
Dereferencing an array using a ternary operation (?:) and a function return value as indices can give faulty (and variable) results. In the example code one or more of the asserts can fail (depending on the optimization level), but only when compiling as C++.
>How-To-Repeat:

>Fix:
Doing the ternary operation and/or function call before the array indexing solves (avoids) the problem.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="Bug.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Bug.cpp"

I2luY2x1ZGUgPGFzc2VydC5oPg0KDQp1bnNpZ25lZCBjaGFyIGFbMl1bMV1bMTZdPXsNCiAge3sw
eDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgw
MCwweDAwLDB4MDAsMHgwMCwweDAwfX0sDQogIHt7MHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4
MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMH19fTsN
Cg0KaW50IGYoKQ0Kew0KICByZXR1cm4gMDsNCn0NCg0KaW50IG1haW4oKQ0Kew0KICBpbnQgZD0w
Ow0KICB1bnNpZ25lZCBjaGFyKiBjMSwqIGMyOw0KICBjMT1hW2Q9PTAgPyAwIDogMV1bZigpXTsN
CiAgYzI9YVtkPT0wID8gMCA6IDFdW2YoKV07DQogIGFzc2VydCgoaW50KWE9PShpbnQpYzEpOw0K
ICBhc3NlcnQoYzE9PWMyKTsNCiAgcmV0dXJuIDA7DQp9DQo=


             reply	other threads:[~2002-07-04 20:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-04 13:06 jdbuiso [this message]
2002-09-14 13:11 nathan
2002-10-16 14:57 nathan
2002-10-22  2:10 nathan

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=20020704195831.29045.qmail@sources.redhat.com \
    --to=jdbuiso@cs.vu.nl \
    --cc=gcc-gnats@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).