public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/6192: gcc array reference incorrect on multi-dimensional array
@ 2002-04-05 13:06 Andrew M Dunn
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew M Dunn @ 2002-04-05 13:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/6192; it has been noted by GNATS.

From: Andrew M Dunn <amdunn@AxisCT.Net>
To: hp@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, me@andydunn.ca,
   nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c/6192: gcc array reference incorrect on multi-dimensional array
Date: Fri, 05 Apr 2002 16:01:51 -0500

 hp@gcc.gnu.org wrote:
 
 > Synopsis: gcc array reference incorrect on multi-dimensional array
 > 
 > State-Changed-From-To: open->closed
 > State-Changed-By: hp
 > State-Changed-When: Fri Apr  5 12:20:13 2002
 > State-Changed-Why:
 >     Not a bug.
 > 
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6192
 > 
 > 
 
 You're correct, of course.   I can't believe I didn't see that
 (was starting with somebody else's code, and have spent so long
   working on other more braindead languages that I didn't even
   spot it)
 
 
 Andy  ;-)
 
 


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

* Re: c/6192: gcc array reference incorrect on multi-dimensional array
@ 2002-04-05 12:20 hp
  0 siblings, 0 replies; 3+ messages in thread
From: hp @ 2002-04-05 12:20 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, me, nobody

Synopsis: gcc array reference incorrect on multi-dimensional array

State-Changed-From-To: open->closed
State-Changed-By: hp
State-Changed-When: Fri Apr  5 12:20:13 2002
State-Changed-Why:
    Not a bug.

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


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

* c/6192: gcc array reference incorrect on multi-dimensional array
@ 2002-04-05 12:06 me
  0 siblings, 0 replies; 3+ messages in thread
From: me @ 2002-04-05 12:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6192
>Category:       c
>Synopsis:       gcc array reference incorrect on multi-dimensional array
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 05 12:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Michael Dunn
>Release:        gcc-2.96, also others older
>Organization:
>Environment:
RedHat 7.0 2.2.16-22 kernel, also others (eg. Caldera 2.2.5)
>Description:
When accessing a two-dimensional array of ints, writing to
any row (first dimension) of the array then reading from
any row returns the value written (see example provided).

Accessing the array memory space as a linear single-dimension
array of ints proves that only the first row gets written,
regardless of the array index, and only the first row gets
read.

ie.  int array[3,2]

assignment   array[1,0] = 3

the 3 actually gets written into array[0,0]

inspecting    array[0,0], array[1,0] or array[2,0]

all of these return the value 3 (which was written
only into array[0,0] originally


Single-dimension int arrays do not have this problem

>How-To-Repeat:
See attached xtest.c - very reproducible on multiple
machines, kernel revs, gcc versions, etc.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="xtest.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="xtest.c"

I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgYXJyYXlbMywyXTsKCnZvaWQgb3V0cHV0X3NlcXVlbnRp
YWwoYXJyYXkpCmludCBhcnJheVs2XTsKewoJcHJpbnRmKCJhcnJheVswXSA9ICVkICAgYXJyYXlb
MV0gPSAlZCAgICAgIGFycmF5WzJdID0gJWRcbiIsYXJyYXlbMF0sCgkJCWFycmF5WzFdLGFycmF5
WzJdKTsKCXByaW50ZigiYXJyYXlbM10gPSAlZCAgIGFycmF5WzRdID0gJWQgICAgICBhcnJheVs1
XSA9ICVkXG4iLGFycmF5WzNdLAoJCQlhcnJheVs0XSxhcnJheVs1XSk7Cn0KCm1haW4oKQp7Cglp
bnQgemVybzsKCglhcnJheVswLDBdID0gMDsKCWFycmF5WzAsMV0gPSAwOwoJYXJyYXlbMSwwXSA9
IDA7CglhcnJheVsxLDFdID0gMDsKCWFycmF5WzIsMF0gPSAwOwoJYXJyYXlbMiwxXSA9IDA7CgoJ
cHJpbnRmKCJUV08gRElNRU5TSU9OIEFSUkFZLi4uXG5cbiIpOwoJcHJpbnRmKCJCRUZPUkU6IGFy
cmF5WzAsMF0gPSAlZCAgYXJyYXlbMSwwXSA9ICVkIGFycmF5WzIsMF0gPSAlZFxuIiwKCQlhcnJh
eVswLDBdLGFycmF5WzEsMF0sYXJyYXlbMiwwXSk7CglwcmludGYoIiAgICAgICAgYXJyYXlbMCwx
XSA9ICVkICBhcnJheVsxLDFdID0gJWQgYXJyYXlbMiwxXSA9ICVkXG4iLAoJCWFycmF5WzAsMV0s
YXJyYXlbMSwxXSxhcnJheVsyLDFdKTsKCglwcmludGYoIlxuZXhlY3V0aW5nIEFSUkFZWzEsMF0g
PSAzXG4iKTsKCWFycmF5WzEsMF0gPSAzOwoKCXByaW50ZigiXG5leGVjdXRpbmcgQVJSQVlbMiwx
XSA9IDVcbiIpOwoJYXJyYXlbMiwxXSA9IDU7CgoJcHJpbnRmKCJcbkFGVEVSOiBhcnJheVswLDBd
ID0gJWQgIGFycmF5WzEsMF0gPSAlZCBhcnJheVsyLDBdID0gJWRcbiIsCgkJYXJyYXlbMCwwXSxh
cnJheVsxLDBdLGFycmF5WzIsMF0pOwoJcHJpbnRmKCIgICAgICAgYXJyYXlbMCwxXSA9ICVkICBh
cnJheVsxLDFdID0gJWQgYXJyYXlbMiwxXSA9ICVkXG4iLAoJCWFycmF5WzAsMV0sYXJyYXlbMSwx
XSxhcnJheVsyLDFdKTsKCglvdXRwdXRfc2VxdWVudGlhbChhcnJheSk7Cn0K


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

end of thread, other threads:[~2002-04-05 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-05 13:06 c/6192: gcc array reference incorrect on multi-dimensional array Andrew M Dunn
  -- strict thread matches above, loose matches on Subject: below --
2002-04-05 12:20 hp
2002-04-05 12:06 me

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