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/19033] New: Passing array as a function parameter in C99 style fails


The following code fails to compile:
pl-1.c:

void print(int res, int K, double a[K][K])
{
}

int inverse(int K,double in[K][K],double out[K][K])
{
        return 0;

}
int main(void)
{
        int K;

        double a[K][K];
        double b[K][K];

        print(inverse(K, a, b),K,b);
        return 0;
}

[bonzo@unicorn ~]$ gcc -v -save-temps -O2 -std=gnu99 pl-1.c
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/specs
Configured with: ../gcc-3.4.3/configure --prefix=/usr --sysconfdir=/etc --
localstatedir=/var --enable-shared --with-gnu-as --with-gnu-ld --enable-
threads --enable-__cxa_atexit --enable-initfini-array --disable-nls --with-
system-zlib --enable-java-awt=gtk,xlib
Thread model: posix
gcc version 3.4.3
 /usr/libexec/gcc/i686-pc-linux-gnu/3.4.3/cc1 -E -quiet -v pl-1.c -
mtune=pentiumpro -std=gnu99 -O2 -o pl-1.i
ignoring nonexistent directory "/usr/lib/gcc/i686-pc-linux-
gnu/3.4.3/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/include
 /usr/include
End of search list.
 /usr/libexec/gcc/i686-pc-linux-gnu/3.4.3/cc1 -fpreprocessed pl-1.i -quiet -
dumpbase pl-1.c -mtune=pentiumpro -auxbase pl-1 -O2 -std=gnu99 -version -o pl-
1.s
GNU C version 3.4.3 (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.3.
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64552
pl-1.c: In function `print':
pl-1.c:6: error: prior parameter's size depends on 'K'
pl-1.c:6: error: prior parameter's size depends on 'K'
pl-1.c:6: error: prior parameter's size depends on 'K'
pl-1.c:6: error: prior parameter's size depends on 'K'
[bonzo@unicorn ~]$

It compiles OK with -O0 and -O1.

-- 
           Summary: Passing array as a function parameter in C99 style fails
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bonzo at lib dot msu dot ru
                CC: gcc-bugs at gcc dot gnu dot org


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


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