This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/27272] New: Strange order of components of multidimensional array pointer with the same cast


char *yn;
yn = (char *) malloc (sizeof (char) * x * y);
First subroutine included with {}:
char (*pointer)[x][y] = (char (*)[x][y]) yn;
&((*pointer)[0][0]) is 0x8052100
&((*pointer)[0][1]) is 0x8052107

Second routine independent function passed as pointer yn as parameter;
char (*pointer)[x][y] = (char (*)[x][y]) yn;

In second routine the pointers only is the same if (x) y replaced with (y) and
(y) with (x)

&((*pointer)[0][0]) with pointer 0x8052100
&((*pointer)[1][0]) with pointer 0x8052107


-- 
           Summary: Strange order of components of multidimensional array
                    pointer with the same cast
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: prog1 at yobinario dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27272


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]