[Bug c/35210] New: gcc incorrectly allows calling function returning "const void"
const void f(void); void g(void) {f();} This testcase violates the constraint in C99 6.5.2.2p1 ("The expression that denotes the called function shall have type pointer to function returning void or returning an object type other than an array type.", so gcc at the very least must produce a diagnostic when using -pedantic. (BTW, is there any code that depends on this working?) -- Summary: gcc incorrectly allows calling function returning "const void" Product: gcc Version: 4.1.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: eli dot friedman at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35210
[Bug c/35210] gcc incorrectly allows calling function returning "const void"
--- Comment #2 from eli dot friedman at gmail dot com 2008-02-15 18:01 --- Yes, but "const void" is still a distinct type from "void". -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35210
[Bug c/44848] New: Bogus "array subscript is below array bounds" with loops
Testcase (derived from ffmpeg): void av_solve_lls(double (*factor)[33], int count, int min_order){ int i,j,k; for(i=0; i=0; k--) sum -= factor[i][k]*factor[j][k]; factor[i][i]= sum; } } for(j=count-1; j>=min_order; j--){ for(i=j; i>=0; i--){ factor[0][j]= 0; } factor[0][j] = 0; for(i=0; i<=j; i++){ factor[0][j] += 0; } } } With the following command-line: gcc l.c -S -Wall -O2 Gives the following warning: /tmp/l.c: In function av_solve_lls: /tmp/l.c:18:18: warning: array subscript is below array bounds Using gcc 4.5.0 on x86-64-pc-linux-gnu, built from source, configured with "configure --enable-languages=c --disable-bootstrap". The testcase is a little large, but I can't figure out how to reduce it more; the issue seems very sensitive to the precise structure of the code. -- Summary: Bogus "array subscript is below array bounds" with loops Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: eli dot friedman at gmail dot com GCC host triplet: x86-64-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44848
[Bug c/44848] Bogus "array subscript is below array bounds" with loops
--- Comment #2 from eli dot friedman at gmail dot com 2010-07-08 03:08 --- I'm afraid I mis-reduced the issue; try the following (which reproduces on both trunk r161941 and 4.5.0): typedef struct LLSModel{ double variance[32]; int indep_count; }LLSModel; void av_solve_lls(LLSModel *m, double (*factor)[33], int count, int min_order){ int i,j,k; for(i=0; i=0; k--) sum -= factor[i][k]; factor[j][i] = sum; } } for(j=count-1; j>=min_order; j--){ for(i=j; i>=0; i--) factor[j][i]= 1 / factor[i][i]; m->variance[j]= factor[0][0]; for(i=0; i<=j; i++) m->variance[j] += factor[j][i]; } } -- eli dot friedman at gmail dot com changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|DUPLICATE | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44848