Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 25802
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Joseph S. Myers <jsm28@gcc.gnu.org>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 25802 depends on: Show dependency tree
Show dependency graph
Bug 25802 blocks: 16989

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2006-01-16 01:19 Opened: 2006-01-16 00:32
GCC doesn't diagnose function-scope VM declarations of variables with external
or internal linkage.  (VM declarations of function-local statics are OK.)  Four
tests (all should be rejected unconditionally, none are even with -std=c99
-pedantic-errors):

extern int (*a)[];
void f(int b) { extern int (*a)[b]; }

static int (*a)[];
void f(int b) { extern int (*a)[b]; }

extern int (*a)[];
void f(int b) { typedef int (*T)[b]; extern T a; }

static int (*a)[];
void f(int b) { typedef int (*T)[b]; extern T a; }

------- Comment #1 From Andrew Pinski 2006-01-16 01:19 -------
Confirmed.

------- Comment #2 From Mike Stump 2006-05-06 21:24 -------
I have a fix for this, will post.

------- Comment #3 From mrs@gcc.gnu.org 2006-05-18 18:22 -------
Subject: Bug 25802

Author: mrs
Date: Thu May 18 18:22:12 2006
New Revision: 113888

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113888
Log:
        Fix up vla, vm and [*] sematics.

        PR c/18740
        PR c/7948
        PR c/25802
        * c-tree.h (struct c_arg_info): Add had_vla_unspec.
        (c_vla_unspec_p): Add.
        (c_vla_type_p): Add.
        * c-decl.c (struct c_scope): Add had_vla_unspec.
        (build_array_declarator): Add support for [*].
        (grokdeclarator): Likewise.
        (grokparms): Likewise.
        (get_parm_info): Likewise.
        * c-objc-common.c (c_vla_unspec_p): Likewise.
        * c-objc-common.h (LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P): Likewise.
        * c-parser.c (c_parser_typeof_specifier): Evaluate arguments to
        typeof when argument is a variably modified type not inside sizeof or
alignof.
        (c_parser_direct_declarator_inner): Propagate errors.
        (c_parser_sizeof_expression): Add support for [*].
        * c-typeck.c (c_vla_type_p): Add.
        (composite_type): Add support for vla compositing.
        (comptypes_internal): Add support for vla compatibility.
        (c_expr_sizeof_expr): Evaluate vla arguments.
        * tree.c (variably_modified_type_p): Update comment for [*].

testsuite:
        * gcc.dg/c90-arraydecl-1.c: Update for vla, vm [*] fixups.
        * gcc.dg/vla-4.c: Add.
        * gcc.dg/vla-5.c: Add.
        * gcc.dg/vla-6.c: Add.

Added:
    trunk/gcc/testsuite/gcc.dg/vla-4.c
    trunk/gcc/testsuite/gcc.dg/vla-5.c
    trunk/gcc/testsuite/gcc.dg/vla-6.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/c-objc-common.c
    trunk/gcc/c-objc-common.h
    trunk/gcc/c-parser.c
    trunk/gcc/c-tree.h
    trunk/gcc/c-typeck.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/c90-arraydecl-1.c
    trunk/gcc/tree.c

------- Comment #4 From Mike Stump 2006-05-18 19:29 -------
aka radr://4336222

------- Comment #5 From Joseph S. Myers 2006-06-04 17:03 -------
Fixed for 4.2.

------- Comment #6 From Andrew Pinski 2006-09-19 03:33 -------
*** Bug 29126 has been marked as a duplicate of this bug. ***

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug