Changeset 7ae39f0 for tests/array.cfa


Ignore:
Timestamp:
May 26, 2023, 5:08:03 PM (11 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ast-experimental, master
Children:
124400b
Parents:
b2fa3c2
Message:

Re-enable testing function prototype taking length-star array, working around false GCC warning.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/array.cfa

    rb2fa3c2 r7ae39f0  
    8181    }
    8282    [ * [int]( [3] int T,
    83             [const 3] int p1,
    84             [static 3] int p2,
    85             [static const 3] int p3
    86             )
     83               [const 3] int p1,
     84               [static 3] int p2,
     85               [static const 3] int p3
     86             )
    8787    ] janes_twin(...) {
    8888    }
    8989    #endif
    9090
     91    // GCC 11+ gives a false warning (-Wvla-parameter) on the valid (C11 ARM p134-135) combination:
     92    // declare with type int[*], define with type int[n].
     93    // https://gcc.gnu.org/bugzilla//show_bug.cgi?id=100420 suggests the internal representation of
     94    // of a[*] is the same as a[0].
     95    // https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wno-vla-parameter explains
     96    // the purpose of -Wvla-parameter is to report conflicts between int[] and int[n], which would
     97    // understandably also include those between int[42] and int[n].
     98    // https://stackoverflow.com/questions/17371645/why-use-an-asterisk-instead-of-an-integer-for-a-vla-array-parameter-of-a-f
     99    // explains the declare-*, define-n pattern.
    91100
    92 //  int fm1( int, int, int[][*] );                      // TODO: investigate gcc-11 warning
    93 //  int fm1( int r, int c, int m[][c] ) {}
     101    // To work around the false warning, and keep to this test's purpose of exercising CFA's
     102    // handling of exotic C array syntax, what would ideally be demonstrated as a declaration of
     103    // fm1, followed by its definition, is instead split into fm1x and fm1y.  And similarly for
     104    // fm5.
     105
     106    int fm1x( int, int, int[][*] );
     107    int fm1y( int r, int c, int m[][c] ) {}
    94108    int fm2( int r, int c, int (*m)[c] ) {}             // same as fm1
    95109E2( int fm3( int r, int c, int m[][static c] ) {}  )    // that's not static
    96110E3( int fm4( int r, int c, int m[][] );            )    // m's immediate element type is incomplete
    97     int fm5( int, int, int[*][*] );                     // same as fm1 decl
     111    int fm5x( int, int, int[*][*] );                    // same as fm1 decl
    98112                                                        #ifndef __cforall
    99     int fm5( int r, int c, int m[r][c] ) {}             // BUG 276: CFA chokes but should accept
     113    int fm5y( int r, int c, int m[r][c] ) {}            // BUG 276: CFA chokes but should accept
    100114                                                        // C: same as fm1 defn
    101115                                                        #endif
Note: See TracChangeset for help on using the changeset viewer.