public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/7209: Faulty array dereferencing
@ 2002-07-04 13:06 jdbuiso
  0 siblings, 0 replies; 4+ messages in thread
From: jdbuiso @ 2002-07-04 13:06 UTC (permalink / raw)
  To: gcc-gnats

[-- 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=


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/7209: Faulty array dereferencing
@ 2002-10-22  2:10 nathan
  0 siblings, 0 replies; 4+ messages in thread
From: nathan @ 2002-10-22  2:10 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jdbuiso, nathan

Synopsis: Faulty array dereferencing

State-Changed-From-To: analyzed->closed
State-Changed-By: nathan
State-Changed-When: Tue Oct 22 02:10:22 2002
State-Changed-Why:
    this will appear in 3.2.1 & 3.3
    2002-10-22  Nathan Sidwell  <nathan@codesourcery.com>
    
    	PR c++/7209
    	* fold_const.c (fold_binary_op_with_conditional_arg): Always
    	build compound_expr if we used save_expr.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7209


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/7209: Faulty array dereferencing
@ 2002-10-16 14:57 nathan
  0 siblings, 0 replies; 4+ messages in thread
From: nathan @ 2002-10-16 14:57 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jdbuiso, nathan, nobody

Synopsis: Faulty array dereferencing

Responsible-Changed-From-To: unassigned->nathan
Responsible-Changed-By: nathan
Responsible-Changed-When: Wed Oct 16 14:57:08 2002
Responsible-Changed-Why:
    fixing

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7209


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/7209: Faulty array dereferencing
@ 2002-09-14 13:11 nathan
  0 siblings, 0 replies; 4+ messages in thread
From: nathan @ 2002-09-14 13:11 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jdbuiso, nobody

Synopsis: Faulty array dereferencing

State-Changed-From-To: open->analyzed
State-Changed-By: nathan
State-Changed-When: Sat Sep 14 13:11:37 2002
State-Changed-Why:
    confirmed, regression 

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7209


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-22  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-04 13:06 c++/7209: Faulty array dereferencing jdbuiso
2002-09-14 13:11 nathan
2002-10-16 14:57 nathan
2002-10-22  2:10 nathan

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).